Very basic set of scripts to deploy a sample go
program over SSH using Chef and sh scripts.
On local node:
- Deploy the content of the
app
folder to the destination node using SSH - Remotely execute the
install.sh
script on the destination node
In the install.sh
script:
- Install required packages to execute Chef cookbooks
- Execute the
default.rb
Chef cookbook usingchef-solo
In the default.rb
cookbook:
- Install packages required to run the sample
go
program - Execute the sample
go
programsample.go
- SSH keys set up so that
ssh [email protected]
opens the ssh session without prompting for password (usessh-agent
if you want to keys with password) - Git installed on the host (from which the scripts are deployed to the destination node)
curl -s https://raw.githubusercontent.com/amiramix/chef_go_sample/master/init.sh | sh -s [email protected]
Where [email protected] is the node on which the sample program should be installed and started
Scripts have been developed and tested on a base FreeBSD server (without any ports or packages installed):
- They don't use
sudo
, which is not present in the base. Installing and configuringsudo
in addition to this sample program would be an easy, but unnecessary addition considering the purpose of this example. - Because of the same reason, some commands may not work as expected in GNU versions of those commands on Linux servers.