Automating Server Provision for Edeliver/Distillery Releases

Hey,

so I’ve been getting down the server provisioning rabbit hole lately. Although I was happy creating images in AWS or whatever cloud platform that I could just re-use, I wanted to understand a bit more about this, plus the way releases work sometimes made it difficult to set up correctly the environment for building the release correctly. I looked at Ansible, Chef and Docker. I found out chef had a way to be run “locally” (or solo) in order to be more similar to ansible and useful for small rigs so I started exploring that.

This is the result of that exploration, a .sh script that packs your recipes and deploys them on a server instance running Ubuntu. Included are a bunch of recipes for:

  • provisioning a server ready to run a simple release packing phoenix, served behind a basic nginx conf (http only) with systemd
  • provision a postgresql database
  • provision certbot & automatic renewal of the certificates
  • provision a full https nginx configuration (to use with the certbot recipe)
  • provision a fully working build server with Erlang, Elixir, Node and Yarn and correctly setting up the environment for the build

After setting one environment file, you basically run it like this:
./deploy_kitchen.sh ubuntu@your_instance_address ‘recipe[elixir_web::default],recipe[elixir_web::postgresql],recipe[elixir_web::certbot],recipe[elixir_web::nginx]’

And you have a ready server to deploy your release, serving the app on https, etc.

You can find the full repo at https://github.com/mnussbaumer/chef_local_elixir
Hope it’s useful for anyone looking to explore this topic

3 Likes