Akkoma compilation issues running under v3.8.0 with Elixir under asdf and user running under systemd

So I’m running an Akkoma instance under Ubuntu 22.04 setup under the normal Debian setup guide, and recently, I decided to update my instance to v3.8.0 . However, Elixir in the Ubuntu package manager only goes up to v1.12, so I had to install asdf under the akkoma user to install elixir 1.14 . While running Akkoma directly in the shell of the akkoma user with mix phx.server works fine. Trying to run it through systemd results in an error that keeps it from starting. It seems to be this:

Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]: 14:21:27.468 [notice] Application mime exited: :stopped
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]: 14:21:27.469 [notice] Application eex exited: :stopped
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]: ** (MatchError) no match of right hand side value: {:error, {:telemetry, {{:shutdown, {:failed_to_start_chil>
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (phoenix 1.6.16) lib/mix/tasks/compile.phoenix.ex:19: Mix.Tasks.Compile.Phoenix.run/1
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/tasks/compile.all.ex:33: Mix.Tasks.Compile.All.run/1
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
Apr 21 14:21:27 social.thetooniverse.xyz mix[131379]:     (mix 1.14.3) lib/mix/tasks/compile.ex:135: Mix.Tasks.Compile.run/1

So far, in order to get this setup with asdf to actually work, I have edited akkoma.service so that it includes Environment="ASDF_DATA_DIR=/opt/asdf", which is where I installed asdf. And modified ExecStart to be ExecStart=/opt/asdf/shims/mix phx.server. Within my .bashrc for my akkoma user. I’ve appended the following:

. "/opt/asdf/asdf.sh"
. "/opt/asdf/completions/asdf.bash"
export MIX_ENV=prod
export ASDF_DATA_DIR=/opt/asdf/
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/bashrc"
export PATH=/opt/asdf/shims/:$PATH

Could there be any issues with my configuration that might be stopping Akkoma from working correctly?

I have the same setup and have also put asdf in /opt/. My service file also contains

Environment=ASDF_DIR=/opt/asdf

and my PATH also includes /opt/asdf/bin

This wont be helpful unless you are in a position to change OS, but I got fed up with asdf on Debian arm64 and went to Fedora37 where it had already everything I needed. I have never used Fedora before; I just tried vps images until one had what I needed (Hetzner arm64)

Alright, I’m going to try compiling elixir from source and set it up, and see if that fixes the problem.

1 Like

Can we get some official responses in this thread?

This was a major change with very little instruction on how to get it working, just a link to asdf’s site and saying “good luck”.

It would be helpful that with a big change like this, requiring versions of erlang that aren’t supported by distros yet, we took the time to include careful per-distro instructions – or not require these changes at all. A lot of Akkoma admins are not tech-savvy and depend on your instructions, and Ubuntu is far from being a niche setup

I am currently struggling to update it myself as getting asdf and elixir working seems to break everything, so I’ll likely just wait until this gets worked out.

I’m personally moving away from using asdf and skipping straight to just compiling elixir from source

1 Like

If you get it working please post the steps you took!

I updated to v3.7.1 after a few attempts, hoping maybe it’ll go smoother updating from that to 3.8.

If I can get it working I’ll post the steps I did too.

Based on an old script i have, the following should be what worked for me. If you got the correct versions already, you can probably skip to the Systemd part.

Set up Elixir and Erlang using asdf

with Akkoma user in home directory, sudo -u akkoma /bin/bash, do

touch $HOME/.tool-versions
"erlang 25.0" > $HOME/.tool-versions
"elixir 1.14.2" >> $HOME/.tool-versions
git clone --quiet https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch v0.8.0 2>/dev/null
echo ". $HOME/.asdf/asdf.sh" >> "$HOME"/.bashrc
echo ". $HOME/.asdf/completions/asdf.bash" >> "$HOME"/.bashrc

source $HOME/.bashrc
asdf plugin-add erlang
asdf plugin-add elixir
asdf install

Now elixir --version ran as the Akkoma user should show that you have 1.14.2

Adapt Systemd service file

Systemd won’t have this in the PATH, and it uses the absolute path to the binary. So we need to adapt the service file. Assuming the HOME directory is /opt/akkoma

; This needs to be added
Environment="PATH=/opt/akkoma/.asdf/shims:/opt/akkoma/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
; This needs to be changed
ExecStart=/opt/akkoma/.asdf/shims/mix phx.server 

References

I got this from a script I wrote a long time ago.

1 Like

I have mainly followed the instructions provided. But I’ve noticed that when I actually tried to start Akkoma wih mix phx.server, what happens is that Akkoma exits but keeps listening with this [notice] Application pleroma exited: :stopped. I also keep getting these warnings as well:

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:phoenix, :endpoint, :stop, :duration]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:phoenix, :router_dispatch, :stop, :duration]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:pleroma, :repo, :query, :total_time]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:pleroma, :repo, :query, :decode_time]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:pleroma, :repo, :query, :query_time]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:pleroma, :repo, :query, :queue_time]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:pleroma, :repo, :query, :idle_time]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:vm, :memory, :total]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:vm, :total_run_queue_lengths, :total]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:vm, :total_run_queue_lengths, :cpu]

21:23:05.888 [warning] Metric type summary is unsupported. Dropping measure. metric_name:=[:vm, :total_run_queue_lengths, :io]

Ok, just realized that in the debugging process Caddy died and i accidentally deleted my frontend lol. mix phx.server seems to work, and so does systemd

yeh i kept getting metric type unsupported also, seemed to run fine though.

metric type unsupported is expected - the phoenix live dashboard doesn’t support some metrics that prometheus does and vice versa,

1 Like