Run natively/local

I have the last years worked on an application written mainly in Elixir and Phoenix, and recently added Elm frontend. Because of the sensitivity of the data (a users bank transactions and financial information), and because it would be nice to not have to think about server costs until I might have customers on it, I have tried to find an easy way to run it locally/native for now, also for users that are non-technical.

I develope it on Manjaro, so there I could use a simple script to install everything, start the backend and then open an electron window by using nativefier. The problem is mainly on windows, both in making a package with what I need and make it all run.

I tried building it with distillery and run it in foreground on windows, but I only got error messages. I think it can have something to do with having Erlang 21 and Elixir 1.18 with Erlang 20 as opt on Windows, while I have Elixir 1.18 with Erlang 21 as opt on Manjaro. But I did not figure out how to upgrade the opt Erlang on Windows.

I know this is not the “right way” to use an Elixir/Phoenix application, but I would assume there is a way to make it work, at least for now so that I can test it on people without thinking about server costs or security.

Does anybody have any tips how I can make it run locally/native on Windows?

Firstly note that a Distillery release must be built on the same architecture and OS as the target. So to run a release on Windows, you will need to build it on Windows.

You can also have a docker image and run it universally.

Docker is probably not a solution for the non-tech people. Especially docker for windows.

4 Likes

Just a few things to consider (sorry for not answering your question):

  • thick client requires maintenance on machines that are out of your control
  • thick client is a pain to upgrade (you have to keep at least some backwards compatibility)
  • server cost is a temporary problem that will go away, the decisions stay
  • webapps are precisely the thing for non-technical users due to lack of installation and configuration on user side
  • you need to transmit the sensitive information to the server either way regardless if they come from a native app or browser
  • you are likely to keep the web interface as well having two products to maintain in the end
3 Likes

I agree that in the long run, a having it on the web will be the most “optimal” solution, or rewriting it to a native application. But for now, it would be great if I could run it native. With that, I meant also having the database for each user locally on their computer. Since it would be financial information, I don’t feel competent enough at the moment to assure the potential users that the application is secure enough for that kind of information.

Seems the best approach would be to wrap your webapp with an in-app/embedded browser. I have little experience in this though… This thread might be worth a look…

I use exrm to release as Windows Service, I have tried distillery, it doesn’t work. After release, strip your beam files of debug symbols, and edit the bat script as necessary, eg add new firewall rule to open up ports. I use InnoSetup to ship the entire release (elixir server plus a local GUI app), which also takes care of calling the install/uninstall script.

A small problem with this is starting up the database, for now I’m using sqlite so the entire service is standalone. But I think there’s a way to configure windows service dependency so you ask postgresql/etc to start first, or just have the service do delayed startup.

1 Like

I have wrapped the frontend in Electron trough nativelify, but the problem is the backend. But I will take a look at the thread!