summaryrefslogtreecommitdiff
path: root/installation
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2019-09-21 03:15:09 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-02-20 21:24:24 +0100
commiteffb4a3d48462060e31db23bfcfd3e7c989d3141 (patch)
tree9babf326318ea7f09ea5e558422335d3eb8f24ff /installation
parent3eddd9caa61a2ac431eb57cd4c835db608702a7d (diff)
init.d/pleroma: Add option to attach an elixir console
Diffstat (limited to 'installation')
-rwxr-xr-xinstallation/init.d/pleroma48
1 files changed, 36 insertions, 12 deletions
diff --git a/installation/init.d/pleroma b/installation/init.d/pleroma
index ed50bb551..384536f7e 100755
--- a/installation/init.d/pleroma
+++ b/installation/init.d/pleroma
@@ -1,21 +1,45 @@
#!/sbin/openrc-run
-
-# Requires OpenRC >= 0.35
-directory=/opt/pleroma
-
-command=/usr/bin/mix
-command_args="phx.server"
+supervisor=supervise-daemon
command_user=pleroma:pleroma
command_background=1
-
-export PORT=4000
-export MIX_ENV=prod
-
# Ask process to terminate within 30 seconds, otherwise kill it
retry="SIGTERM/30/SIGKILL/5"
-
pidfile="/var/run/pleroma.pid"
+directory=/opt/pleroma
+healthcheck_delay=60
+healthcheck_timer=30
+
+: ${pleroma_port:-4000}
+
+# Needs OpenRC >= 0.42
+#respawn_max=0
+#respawn_delay=5
+
+# put pleroma_console=YES in /etc/conf.d/pleroma if you want to be able to
+# connect to pleroma via an elixir console
+if yesno "${pleroma_console}"; then
+ command=elixir
+ 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"
+
+ start_post() {
+ einfo "You can get a console by using this command as pleroma's user:"
+ einfo "iex --name console@127.0.0.1 --remsh pleroma@127.0.0.1"
+ }
+else
+ command=/usr/bin/mix
+ command_args="phx.server"
+fi
+
+export MIX_ENV=prod
depend() {
- need nginx postgresql
+ need nginx postgresql
+}
+
+healthcheck() {
+ # put pleroma_health=YES in /etc/conf.d/pleroma if you want healthchecking
+ # and make sure you have curl installed
+ yesno "$pleroma_health" || return 0
+
+ curl -q "localhost:${pleroma_port}/api/pleroma/healthcheck"
}