arpan

arpan

Ways to distribute a phoenix project?

Hi, I have been working on a side project/tool in the elixir for loading which loads CSV files to the database.

It is an umbrella project, with 2 apps: an elixir application which holds the main logic, and a phoenix live view application that provides an interface to the user to use the tool. The user has to run the phoenix server locally and use the browser as an interface to the app. It just like other tools like phpMyAdmin that use the browser to provide an interface.

Now, I want to distribute this application to users, and my requirement is that there should be minimal dependencies and the user experience should be good.

There are some ideas to do this but I haven’t found a solution yet.

I have thought of 3 options to do this…

  • 1st idea, using an Escript: I have earlier used escripts to distribute this app, and it worked fine, escripts only require the user to have erlang installed and have no OS dependency like releases. Also, escripts is a single binary file which makes it convenient to distribute and use.

Problems: Since now the project is an umbrella project and with the addition of the phoenix live view app, now I am not sure if escript will work. Not sure if things like assets and node modules in the phoenix app can be packed inside an escript. Can anyone guide me on this?


  • 2nd idea, using releases: This seems like a good idea to me, there are no dependencies that the user needs here.

Problems:

As the docs say…

Once a release is assembled, it can be packaged and deployed to a target, as long as the target runs on the same operating system (OS) distribution and version as the machine running the mix release command.

So should I make a different release for each different OS distributions?
I work on ubuntu 18.04, in order to make releases for other OS distributions can I run the OS distribution in docker and execute mix release from inside the docker container running the required OS distribution, will this work? Any ideas anyone?


  • 3rd idea, using Docker: I can package my app as a docker image using a docker file, we can get rid of all the dependencies on OS, etc. This seems good idea but…

Problems:

The users now will have to install docker first and run my app’s docker container to use it.

Also, my elixir application needs to access files from the user’s system, using docker means we will have to use docker volumes or bind mounts to access CSV files on the host machine, all this adds complexity and hampers user experience, which I would like to avoid.


These are the approaches I can think of there might be a better way to do this, that is not listed above, please share any ideas or suggestions you have.

Thank you! :slight_smile:

Most Liked

Qqwy

Qqwy

TypeCheck Core Team

Yes, this works. Using Docker to build a release in the same environment as where the application will be executed is a common approach to working with releases.

joshtaylor

joshtaylor

You could use something like Github Actions (free/cheap) or another CI tool that supports multiple OSs to basically build on each platform then distribute those binaries?

LostKobrakai

LostKobrakai

Architecture hopefully is clear: x86 doesn’t run on arm based hardware.
For Vendor you already said Linux.
So you’re left with ABI / NIF dependencies.
This is difficult to answer, because some of those dependencies are of otp itself (e.g. ssl – musl vs gnu) while other dependencies are because of third party code you pulled in or NIFs of your project, which of cause nobody here knows about.
In general even major version changes on the same linux distribution might require you to build separate releases.

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement