diff --git a/conf/sidekiq.service b/conf/sidekiq.service index d4ac998..d8b569e 100644 --- a/conf/sidekiq.service +++ b/conf/sidekiq.service @@ -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 diff --git a/conf/streaming.service b/conf/streaming.service index a5fcfa0..73b6629 100644 --- a/conf/streaming.service +++ b/conf/streaming.service @@ -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__-strealing.log +StandardError=inherit # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/conf/web.service b/conf/web.service index 2b615dd..fbfb16b 100644 --- a/conf/web.service +++ b/conf/web.service @@ -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 diff --git a/scripts/_common.sh b/scripts/_common.sh index d2debeb..50fa1a7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,8 @@ MEMORY_NEEDED="2560" RUBY_VERSION="3.2.2" NODEJS_VERSION="16" +admin_mail=$(ynh_user_get_info --username=$admin --key='mail') + # Workaround for Mastodon on Bullseye # See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463 if [ "$(lsb_release --codename --short)" = "bullseye" ]; diff --git a/scripts/install b/scripts/install index e521697..82c6dbc 100644 --- a/scripts/install +++ b/scripts/install @@ -121,6 +121,10 @@ yunohost service add "$app-streaming" --description="$app streaming service" ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-sidekiq.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-streaming.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-web.log + #================================================= # APP INITIAL CONFIGURATION #================================================= diff --git a/scripts/remove b/scripts/remove index fd6d361..6b63965 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,6 +50,8 @@ ynh_remove_nodejs # Remove other various files specific to the app... such as : ynh_secure_remove --file="/etc/cron.d/$app" +ynh_remove_logrotate + # Remove swap ynh_del_swap diff --git a/scripts/restore b/scripts/restore index 406b28c..21f973b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -78,6 +78,10 @@ yunohost service add "$app-streaming" --description="$app streaming service" # Other various files... +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-sidekiq.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-streaming.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-web.log + ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 009092b..8e11572 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -admin_mail=$(ynh_user_get_info --username=$admin --key='mail') config="$install_dir/live/.env.production" upgrade_type=$(ynh_check_app_version_changed) @@ -138,6 +137,12 @@ yunohost service add "$app-streaming" --description="$app streaming service" ynh_add_systemd_config +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" + +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-sidekiq.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-streaming.log +ynh_use_logrotate --logfile=/var/log/__APP__/__APP__-web.log + #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= @@ -151,8 +156,6 @@ ynh_add_config --template="../conf/.env.production.sample" --destination="$confi chmod 400 "$config" chown $app:$app "$config" -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" - #================================================= # START SYSTEMD SERVICE #=================================================