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:
parent
adead8f7a8
commit
1d825936e1
8 changed files with 28 additions and 8 deletions
|
@ -13,7 +13,8 @@ Environment="MALLOC_ARENA_MAX=2"
|
||||||
ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec sidekiq -c 25
|
ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec sidekiq -c 25
|
||||||
TimeoutSec=15
|
TimeoutSec=15
|
||||||
Restart=always
|
Restart=always
|
||||||
StandardError=syslog
|
StandardOutput=append:/var/log/__APP__/__APP__-sidekiq.log
|
||||||
|
StandardError=inherit
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
|
@ -13,7 +13,8 @@ Environment="__YNH_NODE_LOAD_PATH__"
|
||||||
ExecStart=__YNH_NODE__ ./streaming
|
ExecStart=__YNH_NODE__ ./streaming
|
||||||
TimeoutSec=15
|
TimeoutSec=15
|
||||||
Restart=always
|
Restart=always
|
||||||
StandardError=syslog
|
StandardOutput=append:/var/log/__APP__/__APP__-streaming.log
|
||||||
|
StandardError=inherit
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
|
@ -13,7 +13,8 @@ ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec puma -C config/puma.rb
|
||||||
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
||||||
TimeoutSec=15
|
TimeoutSec=15
|
||||||
Restart=always
|
Restart=always
|
||||||
StandardError=syslog
|
StandardOutput=append:/var/log/__APP__/__APP__-web.log
|
||||||
|
StandardError=inherit
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
|
@ -29,6 +29,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP LOGROTATE
|
||||||
|
#=================================================
|
||||||
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -177,6 +177,11 @@ yunohost service add "$app-streaming" --description="$app streaming service"
|
||||||
# Create a cron file
|
# Create a cron file
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -48,6 +48,9 @@ ynh_remove_nginx_config
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
# Remote logrotate config
|
||||||
|
ynh_remove_logrotate
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_ruby
|
ynh_remove_ruby
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
|
@ -96,6 +96,10 @@ yunohost service add "$app-streaming" --description="$app streaming service"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -120,11 +120,6 @@ if [[ $db_name = *'_production' ]]; then
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
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 service doesn't exist, create it
|
||||||
if [[ -z "$service" ]]; then
|
if [[ -z "$service" ]]; then
|
||||||
# Set `service` settings to support `yunohost app shell` command
|
# 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"
|
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...)
|
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue