Learning resources about deploying Phoenix (no fly.io, no Docker)

Hi all,

is there any up to date resource out there (blog, talk, video, book…) about deploying elixir applications using releases?
In particular, I am interested in Phoenix apps.

I am looking for something that does not use a manged solution.
I am looking for something that does not use Docker.

Thank you

5 Likes

What kind of resources?

Run mix release, open the release folder and find the binary to start your application. The code, runtime and configurations are all packed with the release.

6 Likes

What can I say, it worked the first time after just reading the official releases documentation (that you summarized nicely here).

I am quite impressed! This is great!

Thank you

3 Likes

Usually docker is used because that’s the simplest way to make sure the architecture between an external build machine and machines used to run the release are the same. If you can have the build machine match without using docker that works just as much.

2 Likes

I am building the release on the target directly (I use Ansible to automate).
It worked the first time with just a couple of env variables, that’s really amazing.

2 Likes

Yeah that works. Not a common solution though as you need build tooling on that server and you also have the load of doing the build there. Both things people tend to avoid in production.

2 Likes

Yeah yeah, that’s fair and stated in the docs :wink:

Just wanted to start from the basics and climb to state of the art.

2 Likes

This is my article about deploying to Ubuntu <= 20.04 LTS

5 Likes

What is the best way to deploy a Phoenix application to EC2 or Digital Ocean? - #5 by sanswork is how I used to do it though I use fly these days.

2 Likes

There’s Deployment Archives - StakNine but the latest is 2022. He produced a book at Phoenix Deployment Handbook. There’s also Deploying Elixir - Miguel Cobá with his companion at Deploying Elixir eBook. Both are great resources and I’ve seen some other tutorials for Digital Ocean or running Elixir processes with supervisord. There’s also a library that helps create the scripts for that like mix release but it’ll take me a while to find that in my sea of GitHub stars.

5 Likes

Hi Carlo. Ansible is the way I went in combination with droplets on Digital Ocean. I found some excellent articles on the Cogini blog when it was starting out like yourself trying to figure out an approach. It takes some work but if you are down for it the work can be pretty rewarding. I wrote my own scripts using the information on Coflgini as a reference. I did not want to use theirs as is because it felt like I would be putting someone else in charge of my Devops and I needed to know how everything works under the hood in case issues arise. Hopefully it helps.

2 Likes

What has been your experience using Fly?

I asked the same question a while back, looking for a way to deploy to a server.

Glad this discussion surfaced to the homepage.

Thank you, very nice!

1 Like

I started using asdf via cimon-io.asdf to get the exact version of elixir/erlang on the server.

Then I am building the release on the server (I know it’s sub-optimal, but it’s ok-ish for a toy project).

I am also building the assets on the server (again, sub-optimal, but acceptable for my use case).

I am using nginx as the proxy, no problem with that.

Everything was straightforward, I was really impressed.

Cheers

PS: I would say that if you already know ansible, reading the docs for mix releases and phoenix releases is enough to get you started

1 Like

Mostly positive though for a long time I continued to self host our databases. I’d still prefer if they had a fully managed Postgres solution but what is there is generally good enough.

They’ve definitely had some growing issues over the last year though I’ve been lucky to avoid most of them causing us outages but I know for many other people that haven’t been so lucky there has been quite a bit of downtime.

Support definitely needs an improvement though we pay for email support and often my emails about outages won’t be responded to until like a day later.

1 Like

My servers are all FreeBSD hosts. So I use FreeBSD jails.
I automate everything with gitlab pipelines.
So at the end, I make a merge request. Tag it with a version. Then the pipeline tests and builds the code with mix release, deploys it, creates a completely new jail with the release and fires its up.

All I have to do is, merge the request, tag it and done.

I will write something about it as soon as I have the time.

4 Likes

Please, write an article about your process. I’ve been learning FreeBSD for some time and would like to see real world usage, related to Elixir, because I plan on using the OS on my servers.

Currently, I’m able to build a service on the FreeBSD host, using releases, and then restart the system service.

2 Likes

Some FreeBSD things to look at:

1 Like

The problem is I’m not there yet and I don’t want to jump on orchestration before knowing my way around the OS. Yes, I can manage jails, but not VNET. I want to be able to set up and shape a network as I want, with no surprises afterwards. I’m the type of person who wants to know the fundamentals first.

1 Like