Riccardo Lemmi: Deployment Automation
Talk by Riccardo Lemmi at the Plone Conference 2019 in Ferrara.
We wanted to find an easy way to reproduce the installation process. We use:
- Boto 3 / awscli
Vagrant manages virtual machines and containers, for example with VirtualBox. I use the init command to do some more configuration on a default box.
Then I use Fabric to make an ssh connection to the machine and do remote actions. It uses invoke and paramiko for this. You can let it run the same actions on different machines. You can also use it to transfer files to and from the server, or use sudo to restart Apache.
More libraries with Fabric:
- fabtools to make sure that for example Python is installed, or a user is created.
- Cuisine: update files. You can also use this tool to ensure packages and users, so parts are very similar to fabtools.
Next as AWS, Amazon Web Services. With this we deploy production and test machines in a simple and replicable way. You can choose to add more CPUs, bigger disks, more memory, etcetara. I use EC2 (elastic compute cloud), EBS (elastic block storage) and EIP (elastic IP) for the most. Snapshots as simple backup tool. Security group rules as a firewall.
I create a machine with Boto 3 or awscli, both available with pip install. Why would I script this? To have "infrastructure as code". When you manually try to replicate a server, you can easily forget things.