mirror of
https://github.com/vale981/phoebe
synced 2025-03-05 09:51:37 -05:00
rails: Automatically rotate log files
This commit is contained in:
parent
c5dc7d83be
commit
72d3974626
1 changed files with 21 additions and 0 deletions
|
@ -76,6 +76,21 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
##############################################################################
|
||||
# Log rotation:
|
||||
appLogRotation = app:
|
||||
''
|
||||
${app.home}/log/*.log {
|
||||
size 64M
|
||||
rotate 16
|
||||
missingok
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
'';
|
||||
|
||||
##############################################################################
|
||||
# Generate a systemd service for a Ruby on Rails application:
|
||||
appService = app: service: {
|
||||
|
@ -202,5 +217,11 @@ in
|
|||
# Each application gets one or more systemd services to keep it
|
||||
# running.
|
||||
systemd.services = collectApps appServices;
|
||||
|
||||
# Rotate all of the log files:
|
||||
services.logrotate = {
|
||||
enable = true;
|
||||
config = concatMapStringsSep "\n" appLogRotation (attrValues cfg.apps);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue