The plan; use Distillery to build the Elixir apps in a Docker container. Then create Docker containers with the compiled apps. Use those to deploy on AWS Beanstalk. Build the AWS Beanstalk setup with Terraform. And deploy through a Makefile to automate things.

It’s a lot of setup to deploy an app!

There’s a lot here so I’ve split it out into multiple posts.

The App(s)

The project is an Elixir Umbrella application. There is a Web app and an Admin app. They are backed by a business logic app, called Company here, that manages the database interactions.

Overview

  1. Use Distillery to create two releases, one for the Web and one for the Admin.

  2. Use Terraform to create the database on RDS and the Beanstalk applications for each of the releases.

  3. Make to build the docker images, push to AWS, and update the Beanstalk applications.

Tools

Distillery to build the production releases. Building Releases with Distillery

Docker to build the releases and to build an image to deploy. Elixir and Docker

Beanstalk to run the docker images. Be anything that runs docker images. Terraform with Beanstalk

Terraform to manage the Beanstalk and database infrastructure on AWS. Terraform with Beanstalk

Make to build everything and deploy the releases to Beanstalk. Elixir Deploys with Make

Next steps

There are still some things to take care of.

  • Manage the DNS with Terraform
  • Manage SSH with Terraform to get to the instances.
  • Setup Continuous Integration & Deployments.

Resources

I’ve tried to keep track of all the places that helped get this working. I probably forgot some, including some StackOverflow posts. Sorry!