1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00

Add dedicated log files and yunohost service

This commit is contained in:
Jean-Baptiste Holcroft 2019-01-08 22:17:04 +01:00
parent 729d71536f
commit 8e470c76de
6 changed files with 55 additions and 3 deletions

View file

@ -8,7 +8,11 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp beat -l INFO
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory=
LogsDirectory=__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp beat \
--loglevel INFO --logfile=/var/log/__APP__/beat.log
NoNewPrivileges=true NoNewPrivileges=true
PrivateDevices=true PrivateDevices=true

View file

@ -8,7 +8,11 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
ExecStart=__FINALPATH__/code/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory=
LogsDirectory=__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers \
--loglevel INFO --logfile=/var/log/__APP__/server.log
NoNewPrivileges=true NoNewPrivileges=true
PrivateDevices=true PrivateDevices=true

View file

@ -8,7 +8,11 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory=
LogsDirectory=__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO \
--loglevel INFO --logfile=/var/log/__APP__/worker.log
NoNewPrivileges=true NoNewPrivileges=true
PrivateDevices=true PrivateDevices=true

View file

@ -228,6 +228,15 @@ chmod -R 755 "$final_path/code/front/dist/"
ynh_add_fail2ban_config "/var/log/nginx/$domain-access.log" "<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" 5 ynh_add_fail2ban_config "/var/log/nginx/$domain-access.log" "<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" 5
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add "$app-server" --log "/var/log/$app/server.log"
yunohost service add "$app-worker" --log "/var/log/$app/worker.log"
yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================

View file

@ -37,6 +37,29 @@ ynh_remove_systemd_config "$app-beat"
ynh_secure_remove "/etc/systemd/system/$app.target" ynh_secure_remove "/etc/systemd/system/$app.target"
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q "$app-server"
then
echo "Remove $app-server service"
yunohost service remove "$app-server"
fi
if yunohost service status | grep -q "$app-worker"
then
echo "Remove $app-worker service"
yunohost service remove "$app-worker"
fi
if yunohost service status | grep -q "$app-beat"
then
echo "Remove $app-beat service"
yunohost service remove "$app-beat"
fi
#================================================= #=================================================
# REMOVE THE PostgreSQL DATABASE # REMOVE THE PostgreSQL DATABASE
#================================================= #=================================================

View file

@ -115,6 +115,14 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name"
# Restore permissions on app files # Restore permissions on app files
chown -R "$app": "$final_path" chown -R "$app": "$final_path"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add "$app-server" --log "/var/log/$app/server.log"
yunohost service add "$app-worker" --log "/var/log/$app/worker.log"
yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================