I’m trying to install erlang using asdf on Ubuntu 20.04 production machine. Based on asdf Erlang docs, before installing erlang I should run
apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk
to install all needed libraries. The thing is, running this commands installs several unnecessary additional libraries and apps, it even installs a firefox browser. As this is a production machine, I would prefer to install only apps and libraries that are really needed.
Do you have any advice on how to handle this?
fop (it will use
openjdk (if you do not need JNI interface). Also it may be handy to pass
--enable-systemd option to make
epmd possible to start via socket activation (you will need
libsystemd-dev or whatever it is named on the Ubuntu).
Probably my answer is out of context but, have you tried using releases in Erlang or Elixir?
With a release it is not necessary to install anything in the production machine.
I am using releases. The thing is that my dev and production machines are not the same so I push the code from my dev machine to git, then I pull the code from git to production machine and I create a release there. It’s not perfect but it works. Can you recommend me a better way on how to do it?
Thanks, I tried this over the weekend it mostly worked, but it still installs gnome. Is there a way to avoid installing it?
If you want it headless, then why you install Wx?
It’s my unfamiliarity with all the different packages at fault here. So, I installed it without wx packages (
libwxgtk3.0-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev) and it worked. Thanks.
I have a virtual machine with Ubuntu Server in VirtualBox with all the development tools installed. I copy my local code files to the virtual machine, create the release there and then copy the release files to the production machine.
In the production machine I use a folder for each version; in case of a problem I can revert to the previous version easily.
If I want to upgrade to a new Erlang or Elixir version I only have to create a new virtual machine to generate the release, but I do not need to do anything in the production server.
I like this approach, it would make the whole process cleaner, especially when updating Elixir and Erlang. I will try it. Thanks!
I’m leaving this here because it might help others as I’ve experimented with multiple options and I too was considering the asdf route…
Usually most of us will have different OS versions (even if using Linux on both platforms) and Erlang Releases require everything to be exactly the same.
There are 2 best options to be used without complicating your CI/CD system and without investing too much time in overly complex solutions or getting a lock in into expensive cloud providers. Either using Docker/podman or Vagrant/Virtualbox for *the release building process. Meaning, you won’t need them on your server. Because you’ll just copy the release with scp. (Or can automate it)
THis approach is perfect because you won’t need kubernetes, docker, and all the complications on your server and you can further increase the security there.
Vagrant can do the automation process of OS/tools/erlang versions installation just like docker, It’s usefull when you have different OS types but beware, it uses a FULL virtual machine which is not what you might want.
REcently I’ve switched to using simply Podman (Docker alternative) FOR the release building process and I have created a script which builds, copies the release from within Docker and pushes it to the server and restarts the systemd service.