38 lines
1 KiB
Text
38 lines
1 KiB
Text
|
|
#!/bin/sh
|
||
|
|
# shellcheck disable=SC2034
|
||
|
|
|
||
|
|
# PROVIDE: funquail_server
|
||
|
|
# REQUIRE: LOGIN postgresql nginx redis
|
||
|
|
# KEYWORD: shutdown
|
||
|
|
#
|
||
|
|
# Add the following lines to /etc/rc.conf to enable funquail_server:
|
||
|
|
# funquail_server (bool): Set it to "YES" to enable FunQuail web server.
|
||
|
|
# Default is "NO".
|
||
|
|
|
||
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||
|
|
|
||
|
|
# shellcheck disable=SC1091
|
||
|
|
. /etc/rc.subr
|
||
|
|
|
||
|
|
desc="FunQuail server"
|
||
|
|
name="funquail_server"
|
||
|
|
rcvar="funquail_server_enable"
|
||
|
|
|
||
|
|
load_rc_config "$name"
|
||
|
|
|
||
|
|
: "${funquail_server_enable:=NO}"
|
||
|
|
|
||
|
|
funquail_server_chdir="/usr/local/www/funquail/api"
|
||
|
|
funquail_server_user="funquail"
|
||
|
|
funquail_server_env="$(grep -v '^#' /usr/local/www/funquail/config/.env | xargs)"
|
||
|
|
command_interpreter="/usr/local/www/funquail/venv/bin/python3"
|
||
|
|
|
||
|
|
command="/usr/local/www/funquail/venv/bin/gunicorn"
|
||
|
|
command_args="\
|
||
|
|
config.asgi:application \
|
||
|
|
--workers 4 \
|
||
|
|
--worker-class uvicorn.workers.UvicornWorker \
|
||
|
|
--bind 127.0.0.1:5000 \
|
||
|
|
>> /var/log/funquail/${name##funquail_}.log 2>&1 &"
|
||
|
|
|
||
|
|
run_rc_command "$1"
|