From f9778458a2241a1d2b85bf3985a02bdc4e555c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Niel?= Date: Wed, 22 Aug 2018 20:23:06 +0200 Subject: [PATCH] FreeBSD System V startup scripts. --- deploy/FreeBSD/README.md | 21 ++++++++++++++++++++ deploy/FreeBSD/funkwhale_beat | 35 +++++++++++++++++++++++++++++++++ deploy/FreeBSD/funkwhale_server | 32 ++++++++++++++++++++++++++++++ deploy/FreeBSD/funkwhale_worker | 34 ++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100644 deploy/FreeBSD/README.md create mode 100755 deploy/FreeBSD/funkwhale_beat create mode 100755 deploy/FreeBSD/funkwhale_server create mode 100755 deploy/FreeBSD/funkwhale_worker diff --git a/deploy/FreeBSD/README.md b/deploy/FreeBSD/README.md new file mode 100644 index 000000000..5880f2b39 --- /dev/null +++ b/deploy/FreeBSD/README.md @@ -0,0 +1,21 @@ +### System V rc script for FreeBSD + +Copy the file in `/usr/local/etc/rc.d` + +``` +# cp /path/to/funkwhale/deploy/FreeBSD/funkwhale_* /usr/local/etc/rc.d +``` + +If not add executable bit to the files. + +``` +# chmod +x /usr/local/etc/rc.d/funkwhale_* +``` + +Enable services in rc.conf + +``` +# sysrc funkwhale_server=YES +# sysrc funkwhale_worker=YES +# sysrc funkwhale_beat=YES +``` diff --git a/deploy/FreeBSD/funkwhale_beat b/deploy/FreeBSD/funkwhale_beat new file mode 100755 index 000000000..6a2b37b75 --- /dev/null +++ b/deploy/FreeBSD/funkwhale_beat @@ -0,0 +1,35 @@ +#!/bin/sh + +# PROVIDE: funkwhale_beat +# REQUIRE: LOGIN postgresql nginx redis +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable funkwhale_beat: +# funkwhale_beat (bool): Set it to "YES" to enable Funkwhale task beat. +# Default is "NO". + + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin + +. /etc/rc.subr + +desc="Funkwhale beat" +name=funkwhale_beat +rcvar=funkwhale_beat_enable + +load_rc_config $name + +: ${funkwhale_beat_enable:=NO} + +funkwhale_beat_chdir="/usr/local/www/funkwhale/api" +funkwhale_beat_user=funkwhale +funkwhale_beat_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs) +pidfile="/var/run/funkwhale/${name##funkwhale_}.pid" +command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3" + +command="/usr/local/www/funkwhale/virtualenv/bin/celery" +command_args="-A funkwhale_api.taskapp beat -l INFO \ +--pidfile=${pidfile} \ +>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &" + +run_rc_command "$1" diff --git a/deploy/FreeBSD/funkwhale_server b/deploy/FreeBSD/funkwhale_server new file mode 100755 index 000000000..1d7f29ce5 --- /dev/null +++ b/deploy/FreeBSD/funkwhale_server @@ -0,0 +1,32 @@ +#!/bin/sh + +# PROVIDE: funkwhale_server +# REQUIRE: LOGIN postgresql nginx redis +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable funkwhale_server: +# funkwhale_server (bool): Set it to "YES" to enable Funkwhale web server. +# Default is "NO". + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin + +. /etc/rc.subr + +desc="Funkwhale server" +name=funkwhale_server +rcvar=funkwhale_server_enable + +load_rc_config $name + +: ${funkwhale_server_enable:=NO} + +funkwhale_server_chdir="/usr/local/www/funkwhale/api" +funkwhale_server_user=funkwhale +funkwhale_server_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs) +command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3" + +command="/usr/local/www/funkwhale/virtualenv/bin/daphne" +command_args="-b 127.0.0.1 -p 5000 config.asgi:application --proxy-headers \ +>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &" + +run_rc_command "$1" diff --git a/deploy/FreeBSD/funkwhale_worker b/deploy/FreeBSD/funkwhale_worker new file mode 100755 index 000000000..e9aab90fd --- /dev/null +++ b/deploy/FreeBSD/funkwhale_worker @@ -0,0 +1,34 @@ +#!/bin/sh + +# PROVIDE: funkwhale_worker +# REQUIRE: LOGIN postgresql nginx redis +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable funkwhale_worker: +# funkwhale_worker (bool): Set it to "YES" to enable Funkwhale task worker. +# Default is "NO". + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin + +. /etc/rc.subr + +desc="Funkwhale worker" +name=funkwhale_worker +rcvar=funkwhale_worker_enable + +load_rc_config $name + +: ${funkwhale_worker_enable:=NO} + +funkwhale_worker_chdir="/usr/local/www/funkwhale/api" +funkwhale_worker_user=funkwhale +funkwhale_worker_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs) +pidfile="/var/run/funkwhale/${name##funkwhale_}.pid" +command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3" + +command="/usr/local/www/funkwhale/virtualenv/bin/celery" +command_args="-A funkwhale_api.taskapp worker -l INFO \ +--pidfile=${pidfile} \ +>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &" + +run_rc_command "$1"