1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Use logrotate

This commit is contained in:
Tagada 2023-08-01 04:15:46 +02:00 committed by Félix Piédallu
parent adead8f7a8
commit 1d825936e1
8 changed files with 28 additions and 8 deletions

View file

@ -13,7 +13,8 @@ Environment="MALLOC_ARENA_MAX=2"
ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec sidekiq -c 25
TimeoutSec=15
Restart=always
StandardError=syslog
StandardOutput=append:/var/log/__APP__/__APP__-sidekiq.log
StandardError=inherit
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -13,7 +13,8 @@ Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ ./streaming
TimeoutSec=15
Restart=always
StandardError=syslog
StandardOutput=append:/var/log/__APP__/__APP__-streaming.log
StandardError=inherit
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -13,7 +13,8 @@ ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec puma -C config/puma.rb
ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15
Restart=always
StandardError=syslog
StandardOutput=append:/var/log/__APP__/__APP__-web.log
StandardError=inherit
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -29,6 +29,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================

View file

@ -177,6 +177,11 @@ yunohost service add "$app-streaming" --description="$app streaming service"
# Create a cron file
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
# Use logrotate to manage application logfile(s)
mkdir /var/log/$app
chown $app:$app /var/log/$app
ynh_use_logrotate
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -48,6 +48,9 @@ ynh_remove_nginx_config
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
# Remote logrotate config
ynh_remove_logrotate
# Remove metapackage and its dependencies
ynh_remove_ruby
ynh_remove_nodejs

View file

@ -96,6 +96,10 @@ yunohost service add "$app-streaming" --description="$app streaming service"
ynh_restore_file --origin_path="/etc/cron.d/$app"
mkdir -p /var/log/$app
chown -R $app:$app /var/log/$app
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -120,11 +120,6 @@ if [[ $db_name = *'_production' ]]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
if ynh_compare_current_package_version --comparison lt --version 2023.06.19~ynh2
then
ynh_remove_logrotate
fi
# If service doesn't exist, create it
if [[ -z "$service" ]]; then
# Set `service` settings to support `yunohost app shell` command
@ -225,6 +220,11 @@ yunohost service add "$app-streaming" --description="$app streaming service"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
# Use logrotate to manage app-specific logfile(s)
mkdir -p /var/log/$app
chown $app:$app /var/log/$app
ynh_use_logrotate --non-append
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================