Skip to content

Instantly share code, notes, and snippets.

@iamdbc
Last active September 20, 2023 14:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iamdbc/f73b1984a8ffe239b5e197ad8f5e9e87 to your computer and use it in GitHub Desktop.
Save iamdbc/f73b1984a8ffe239b5e197ad8f5e9e87 to your computer and use it in GitHub Desktop.
logrotate for puma on rails
# file location: /etc/logrotate.d
/home/deploy/app/your-app/shared/log/*.log {
daily
missingok
rotate 14
compress
delaycompress
dateext
notifempty
copytruncate
create 0640 deploy deploy # set file owner & group
sharedscripts
postrotate
kill -HUP `cat /home/deploy/app/your-app/shared/tmp/pids/puma.pid` # puma.pid
invoke-rc.d nginx rotate >/dev/null 2>&1 # You could put nginx log of your app into rails log folder, ignore this line if your nginx log not in your rails log foler.
endscript
}
# kill -HUP reopen puma.*.log, more details in https://github.com/puma/puma/blob/master/docs/signals.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment