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

handle log dir creation out of SystemD

This commit is contained in:
Jean-Baptiste Holcroft 2019-01-14 21:30:46 +01:00
parent 8f6d0020b2
commit 992def3f22
7 changed files with 24 additions and 22 deletions

View file

@ -9,9 +9,6 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/log/__APP__
ExecStartPre=/bin/chown __APP__:__APP__ /var/log/__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp beat \ ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp beat \
--loglevel INFO --logfile=/var/log/__APP__/beat.log --loglevel INFO --logfile=/var/log/__APP__/beat.log

View file

@ -9,9 +9,6 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/log/__APP__
ExecStartPre=/bin/chown __APP__:__APP__ /var/log/__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers \ ExecStart=__FINALPATH__/code/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers \
--verbosity 1 --access-log=/var/log/__APP__/server.log --verbosity 1 --access-log=/var/log/__APP__/server.log

View file

@ -9,9 +9,6 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/log/__APP__
ExecStartPre=/bin/chown __APP__:__APP__ /var/log/__APP__
ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO \ ExecStart=__FINALPATH__/code/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO \
--loglevel INFO --logfile=/var/log/__APP__/worker.log --loglevel INFO --logfile=/var/log/__APP__/worker.log

View file

@ -226,6 +226,9 @@ systemctl restart "$app".target
chown -R "$app": "$final_path" chown -R "$app": "$final_path"
chmod -R 755 "$final_path/code/front/dist/" chmod -R 755 "$final_path/code/front/dist/"
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================

View file

@ -24,19 +24,6 @@ redis_db=$(ynh_app_setting_get $app redis_db)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
systemctl stop "$app".target
# Remove the dedicated systemd config
ynh_remove_systemd_config "$app-server"
ynh_remove_systemd_config "$app-worker"
ynh_remove_systemd_config "$app-beat"
ynh_secure_remove "/etc/systemd/system/$app.target"
#================================================= #=================================================
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
@ -60,6 +47,19 @@ then
yunohost service remove "$app-beat" yunohost service remove "$app-beat"
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
systemctl stop "$app".target
# Remove the dedicated systemd config
ynh_remove_systemd_config "$app-server"
ynh_remove_systemd_config "$app-worker"
ynh_remove_systemd_config "$app-beat"
ynh_secure_remove "/etc/systemd/system/$app.target"
#================================================= #=================================================
# REMOVE THE PostgreSQL DATABASE # REMOVE THE PostgreSQL DATABASE
#================================================= #=================================================
@ -88,6 +88,8 @@ ynh_remove_app_dependencies
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove "$final_path"
ynh_secure_remove "/var/log/$app"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -115,6 +115,9 @@ 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"
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================

View file

@ -236,6 +236,9 @@ systemctl restart "$app".target
chown -R "$app": "$final_path" chown -R "$app": "$final_path"
chmod -R 755 "$final_path/code/front/dist/" chmod -R 755 "$final_path/code/front/dist/"
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================