This is a guide for serving your Phoenix project and setting up a continuous integration/deployment pipeline. The goal is to have an automated process to run your tests when you push to GitHub, and deploy the project to a production server if they pass.
In this guide, you will learn to:
- Build a build server that will compile Erlang/Elixir applications
- Build a production server to serve your app over HTTPS
- Use eDeliver to automate the build/deploy process
- Use CircleCI to make testing/deploying automated and continuous
How to read this
I've organized the steps in this guide into small bite-sized sections. The sections are grouped into chapters. This is my first attempt at GitBook (I like it!) and I think this format is going to work well for most readers. You can use the left/right arrow keys to move around.
You should read the chapters/sections in the guide in order. Many sections depend on certain things covered earlier being in place.
Please let me know if you find the format or language of this guide better/worse compared to other tutorials/how-tos you have read. Start a discussion or leave in-line comments.
- Ubuntu 16.04 for the build server and app server
- asdf to manage installations of Elixir and Erlang
- nginx to handle HTTPS connections
- Let's Encrypt for managing SSL certificates
- eDeliver to automate deployment
- CircleCI to orchestrate continuous integration/deployment
You will needs servers (obviously); at least 2, possibly 3 if you want a separate staging server. I use Linode, but any VM solution will do. Please report any issues you run into with other providers.
No hot upgrades
The deployment process involves building a fresh exrm release of your project (as opposed to an upgrade). This means live updates are not supported as the running project must be restarted. I am working on a way to do hot upgrades, and will update this guide when I'm done.
No static assets
I use Phoenix as a backend for apps that I write using Ember.js. Accordingly, I don't serve any static assets with Phoenix. If you need to compile and serve static assets, you will have to modify the nginx configs and the build commands presented here.
Get started by creating a Phoenix Project. Right arrow!