forked from Botanical/BotanJS
Rewrite service files for uwsgi & systemctl
This commit is contained in:
15
setup/celery.conf
Normal file
15
setup/celery.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
# Absolute or relative path to the 'celery' command:
|
||||
CELERY_BIN="BIN_ROOT/celery"
|
||||
|
||||
CELERYD_NODES="w1 w2"
|
||||
CELERY_APP="botanjs.service.jwork"
|
||||
|
||||
# How to call manage.py
|
||||
CELERYD_MULTI="multi"
|
||||
|
||||
# - %n will be replaced with the first part of the nodename.
|
||||
# # - %I will be replaced with the current child process index
|
||||
# # and is important when using the prefork pool to avoid race conditions.
|
||||
CELERYD_PID_FILE="RUN_ROOT/tasks-%n.pid"
|
||||
CELERYD_LOG_FILE="PROJ_ROOT/logs/tasks-%n.log"
|
||||
CELERYD_LOG_LEVEL="INFO"
|
19
setup/compiler-tasks.service
Normal file
19
setup/compiler-tasks.service
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=BotanJS Compiler Tasks
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=-ETC_ROOT/celery.conf
|
||||
WorkingDirectory=PROJ_ROOT
|
||||
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
|
||||
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
|
||||
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
|
||||
--pidfile=${CELERYD_PID_FILE}'
|
||||
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
|
||||
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
13
setup/config
Executable file
13
setup/config
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $CONFIG ]] && return
|
||||
CONFIG=1
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR="$( realpath "$SCRIPT_DIR" )"
|
||||
PROJ_ROOT="$( cd "$SCRIPT_DIR/../" && pwd )"
|
||||
ENV_ROOT="$PROJ_ROOT/env"
|
||||
BIN_ROOT="$ENV_ROOT/bin"
|
||||
ETC_ROOT="$ENV_ROOT/etc"
|
||||
RUN_ROOT="$ENV_ROOT/run"
|
||||
PYTHON="$BIN_ROOT/python3"
|
21
setup/install
Executable file
21
setup/install
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
INST_DIR=$( dirname "${BASH_SOURCE[0]}" )
|
||||
source "$INST_DIR/config"
|
||||
|
||||
mkdir -p "$RUN_ROOT"
|
||||
mkdir -p "$ETC_ROOT"
|
||||
|
||||
sed -e "s|PROJ_ROOT|$PROJ_ROOT|g" \
|
||||
-e "s|BIN_ROOT|$BIN_ROOT|g" \
|
||||
-e "s|RUN_ROOT|$RUN_ROOT|g" \
|
||||
"$INST_DIR/celery.conf" > "$ETC_ROOT/celery.conf"
|
||||
|
||||
sed -e "s|PROJ_ROOT|$PROJ_ROOT|g" \
|
||||
-e "s|ETC_ROOT|$ETC_ROOT|g" \
|
||||
-e "s|RUN_AS|$RUN_AS|g" \
|
||||
"$INST_DIR/compiler-tasks.service" > $HOME/.config/systemd/user/botanjs-tasks.service
|
||||
|
||||
systemctl --user enable botanjs-tasks.service
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user start botanjs-tasks.service
|
Reference in New Issue
Block a user