How can I compile and build a Phoenix application locally so that I can upload a compiled one to a server?

So far I’ve deployed my Phoenix application by edeliver and distillery.

However, since my local machine and a remove one both are arch linux, x64, does this mean that I can build my Phoenix application locally and upload a compiled one to my server? If so, how exactly? and what exactly will I have to upload after I’ve compiled and built it locally?

It sounds like that’s what you’ve already been doing… or have you been using your “destination server” as the build server for Edeliver? Because yes, you can absolutely build it locally, and then just deploy the packaged release (which should work with pretty much any Linux system, if built on Linux). No other dependencies needed.

This is the approach I’ve been using with Edeliver:

TL;DR - We build locally, in a Docker container, and then Edeliver ships off the release to the destination server(s).

I can also recommend building regular OS packages of your desired flavor, using Distillery. I don’t know if there’s anything available for Arch, but I’ve successfully built .deb packages for Ubuntu. Which approach works best - Edeliver or OS package, or even just the plain tar archive that Distillery provides by default - will depend a lot on your overall deployment workflow.

For our Edelivery use case, we were targeting servers that were not solidly under our control from a configuration control perspective, so deploying by the OS package route would have been cumbersome. It was easier to go through the one-time administrative task of setting up a deployment account on the servers, and then just deploying by a simple Edeliver command whenever we wanted to.

If you can ship OS packages to a local repo in a convenient manner though, and you’re somewhat in control of how the servers pull in package updates, then that approach can be very nice too. With our .deb packages, we can easily provide custom metadata, init scripts, etc, so it’s ready to go just like any other service on the system where it’s installed.

On the other hand, if you settle for the tar archive, that’ll require some scripting to get stuff deployed as you need to copy the archive to the server, unpack it in the correct location, and issue an upgrade or restart command to your application.

I don’t use docker and don’t want to.

How exactly should I compile it locally? What files exactly should I upload to a remote server after I’ve compiled them locally?

What does it have to do with edeliver if I’m compiling or building it locally? My question is how to get rid of edevelier because my build server will be my local machine.

You should be able to simply run the distillery commands on your local machine and it’s going to build you the release. Also the distillery documentation does probably have all the information you need about what files to upload and the needed commands to build a release.

Here’s how I’ll read this:

The answer to that lies, as suggested, in Distillery… the Walkthrough docs, as well as Use With Phoenix, are useful to get started.

Here’s a blog writeup that’s pretty detailed, too:
https://medium.com/@east5th/deploying-elixir-applications-with-distillery-f7f01d040a20

2 Likes

Why sorry? You don’t have to be sorry, I forgive you.

That’s not it.

Why do you want to build a release without using Distillery? Using Distillery to build locally and copying the resultant tar to the server seems to be what you’re after in your original post. I use a simple bash script (after having read the intro docs that @jwarlander mentions).

1 Like

Yeah you want to build a release via either distillery or it’s older variant. You can build a release manually but that is painful (personal experience).