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.
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.