I followed the following steps to deploy this website to production.
If it is a simple app, then use Sqlite. It will save us from having to setup and configure a more robust database like Postgres.
Go to Linode. Creating an account is very simple. I created the smallest, cheapest shared Linode with Arch Linux. The output should be a root user account and an IP address that we can SSH into.
Using an SSH client, log into the newly created Linux machine as root. Create a personal user account in order to not have to login as root again. Add the newly created user to the wheel group, and the sudoers list. Install the following packages (sudo pacman -S <package name>):
Git clone the project, then follow instructions found in the “Introduction to Deployment” doc (https://hexdocs.pm/phoenix/deployment.html) to create a production environment and start the phoenix server. Start the website synchronously (without backgrounding it) and test to see if it worked by going to the ipaddress:port for your project.
Register a domain if you don’t already have one. Edit the domain’s DNS records and create an A-record to point to the newly created server’s IP address.
It is possible to serve multiple websites (serving multiple domains) from this one tiny server. In order to facilitate this, each website will have to run off a different port and Nginx should be configured to act as a proxy to forward requests to the corresponding project. Our nginx.conf should look like this: https://gist.github.com/vishaldpatel/1aa05edfe345087e035b9fe00d779f6f
Our project-specific nginx config will look like this: https://gist.github.com/vishaldpatel/d9fb76bf2d027e6d2cd0e2a0886ac29d
Be sure to run nginx -t to make sure your configs are error free.
Run Certbot to get a free SSL certificate from the wonderful people at Let’s Encrypt. We can have it automatically update nginx’s settings with the correct SSL info, but I sometimes have to go in and clean things up, so be careful.
Start the Phoenix app. Visit the domain. We should have a working https://… and our project should light right up.
Start the server in background mode. In order to restart it, for now, I kill the existing process.
Start iex using MIX_ENV=prod iex -S mix to create any users I needed.
Next, I will try to figure out how to make proper use of Phoenix / Elixir deploys, but for now, I have a working website in production, and so can you! =)