Our small team here in London is going through a transformation, albeit a slow one. One from a centralised monolith to smaller services that make up something bigger, from process as a gateway to process as an enabler, etc.
To help drive towards this vision I've been working a good amount on the infrastructure side of things. I'm not saying I'm a networking/infrastructure god, like the people that support us, but I have been learning Chef, Ruby (ewww), basic networking, how all the pieces fit together, along with a few others.
Our build pipelines use Octopus Deploy, which is optimised for deployments to Windows. Recently, around v3 or a little before, they added support for Linux deployments via SSH.
That's great, but after setting up our CentOS based Chef cookbook, I found there were no cookbooks for Octopus which supported Linux; they only seem support Windows.
It's super simple in the fact that it just uses the Octopus API. Let's get into a small example.
If you're using Octopus < v3.16, you will need to install mono on your node. There's a cookbook for that, or just add the yum repo and go for it.
Registering Your Node
# add dependency depends 'octopus_ssh_tentacle_registration'
# use the LWRP register_ssh_octopus_tenacle 'sample-server' do server_url 'https://my.octopus.server.me' api_key 'Octopus API Key' ssh_account_id 'Account ID of SSH user being used to connect to the boxes' environments ['environments', 'to put this', 'box in'] roles ['roles this', 'box has'] end
We use Vault to get these values, but you can also use data bags. Try not to hardcode the API key, horrible practice.
Note: This is safe to run multiple times. If your node has already been registered, it will not be registered again.
You should either see some inform messages saying:
- Your node has been registered with the server
- Your node has already been registered with the server, it will not be registered again
- An API error occurred with the request and response data