Nothing much just a build up of things
[anni] / installation / init.d / pleroma
1 #!/sbin/openrc-run
2 supervisor=supervise-daemon
3 command_user=pleroma:pleroma
4 command_background=1
5 # Ask process to terminate within 30 seconds, otherwise kill it
6 retry="SIGTERM/30/SIGKILL/5"
7 pidfile="/var/run/pleroma.pid"
8 directory=/opt/pleroma
9 healthcheck_delay=60
10 healthcheck_timer=30
11 no_new_privs="yes"
12
13 : ${pleroma_port:-4000}
14
15 # Needs OpenRC >= 0.42
16 #respawn_max=0
17 #respawn_delay=5
18
19 # put pleroma_console=YES in /etc/conf.d/pleroma if you want to be able to
20 # connect to pleroma via an elixir console
21 if yesno "${pleroma_console}"; then
22         command=elixir
23         command_args="--name pleroma@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"
24
25         start_post() {
26                 einfo "You can get a console by using this command as pleroma's user:"
27                 einfo "iex --name console@127.0.0.1 --remsh pleroma@127.0.0.1"
28         }
29 else
30         command=/usr/bin/mix
31         command_args="phx.server"
32 fi
33
34 export MIX_ENV=prod
35
36 depend() {
37         need nginx postgresql
38 }
39
40 healthcheck() {
41         # put pleroma_health=YES in /etc/conf.d/pleroma if you want healthchecking
42         # and make sure you have curl installed
43         yesno "$pleroma_health" || return 0
44
45         curl -q "localhost:${pleroma_port}/api/pleroma/healthcheck"
46 }