X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=installation%2Finit.d%2Fakkoma;fp=installation%2Finit.d%2Fakkoma;h=bf70c34fbcc3eeeb907a38564200ca8189672c5c;hb=c0e6f30e4d17bd69b7ddd26aa0c0f1433184128a;hp=0000000000000000000000000000000000000000;hpb=3d9dabd9147d2ba001d64de0ea5527bc5727dda6;p=akkoma diff --git a/installation/init.d/akkoma b/installation/init.d/akkoma new file mode 100755 index 000000000..bf70c34fb --- /dev/null +++ b/installation/init.d/akkoma @@ -0,0 +1,45 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon +command_user=akkoma:akkoma +command_background=1 +# Ask process to terminate within 30 seconds, otherwise kill it +retry="SIGTERM/30/SIGKILL/5" +pidfile="/var/run/akkoma.pid" +directory=/opt/akkoma +healthcheck_delay=60 +healthcheck_timer=30 + +: ${akkoma_port:-4000} + +# Needs OpenRC >= 0.42 +#respawn_max=0 +#respawn_delay=5 + +# put akkoma_console=YES in /etc/conf.d/akkoma if you want to be able to +# connect to akkoma via an elixir console +if yesno "${akkoma_console}"; then + command=elixir + command_args="--name akkoma@127.0.0.1 --erl '-kernel inet_dist_listen_min 9001 inet_dist_listen_max 9001 inet_dist_use_interface {127,0,0,1}' -S mix phx.server" + + start_post() { + einfo "You can get a console by using this command as akkoma's user:" + einfo "iex --name console@127.0.0.1 --remsh akkoma@127.0.0.1" + } +else + command=/usr/bin/mix + command_args="phx.server" +fi + +export MIX_ENV=prod + +depend() { + need nginx postgresql +} + +healthcheck() { + # put akkoma_health=YES in /etc/conf.d/akkoma if you want healthchecking + # and make sure you have curl installed + yesno "$akkoma_health" || return 0 + + curl -q "localhost:${akkoma_port}/api/akkoma/healthcheck" +}