FIX: Use `sharedscripts` in `/etc/logrotate.d/rails` (#819)
authorAlan Guo Xiang Tan <gxtan1990@gmail.com>
Wed, 31 Jul 2024 04:04:14 +0000 (12:04 +0800)
committerGitHub <noreply@github.com>
Wed, 31 Jul 2024 04:04:14 +0000 (12:04 +0800)
commitfa4c815dbc445dfd1177a3667c2143171b344092
tree9bbcc5090e21b644b8facae871210afbee3e6aba
parentf2d50d70087394d4a470137e05106016b64a1c9e
FIX: Use `sharedscripts` in `/etc/logrotate.d/rails` (#819)

This commit adds `sharedscripts` which will ensure that our `postrotate`
script is only ran once even if multiple log files in the `/shared/log/rails/`
are rotated. If `sharedscripts` is not specified, we are sending `sv 1
unicorn` once per log file rotated and this has resulted in weird
behaviours like our Sidekiq process hanging indefinitely.

Note the following from the manpage for logrotate:

```
sharedscripts
Normally, prerotate and postrotate scripts are run for each log which is rotated and the absolute path to the log file is passed as first argument to the script. That means a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If sharedscripts is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern, and whole pattern is passed to them.
```
templates/web.template.yml