Thank you very much for writing this - it’s almost exactly what I’m planning to do once I get my app to a state where it’s worth deploying. When that happens (which may still be a few weeks away), I’ll give this a go and let you know how I get on.
I would strongly suggest using a package manager like asdf (or other) to install elixir and even node (to be able to maintain dev/staging/prod parity by installing very specific versions - and also to have elixir compiled against the used otp version)
Making nginx optional - eg showing how to run phoenix directly on port 80, would be a nice addition. + ssl maybe?
Thanks for the info in the article @tmartin314! Its the best comprehensive guide that is up to date I’ve been able to find for deploying apps w/o docker to your VPS of choice. Systemd and SSL are important final steps but this gets you 95% of the way there.
You can use them both, they complement each other.
Terraform config files declaratively describe the servers/VMs to be created and is meant to be provider agnostic so you can create a mix of cloud servers at AWS, Azure, Digital Ocean, etc etc and local (VMWare), etc. When run it compares the current state of your infrastructure with how you declared you want it to change and it provisions/changes any new resources for you. It’s like CloudFormation but instead of just working with AWS it works with dozens of other providers. IMO it’s very good stuff.
After the infrastructure is created then Ansible (or if you prefer Chef, Puppet, Saltstack, etc) installs, configures, and manages software (such as Nginx, PostgreSQL, Distillery releases, etc) on the newly created servers.
Another issue was ** (Mix) The task "release" could not be found. The reason turns out to be I didn’t commit to git master branch and I was in a branch. Solution and detail of problem.
After deploying. I couldn’t figure out why I was getting server error. I figure out after a few minute that my db wasn’t built. After tinkering with config I realize I had to do. mix edeliver migrate production I skimed through the Admin commands section thinking that it wasn’t necessary.