volumes:
- volume:
host: /var/docker/shared/app/rails-log
guest: /shared/log/rails
- volume:
host: /var/docker/shared/app/var-log
guest: /var/log
- volume:
host: /var/docker/shared/app/uploads
guest: /shared/uploads
- volume:
host: /var/docker/shared/app/backups
guest: /shared/backups
This lets us pull all of the state right out of the container and leave it on the host filesystem. Log rotation can then also be done from the host or the guest as we decide. The only slightly weird thing is the /shared/log/rails mount - it’s there due to the symlinks in the app dir:
- ln -s /shared/log/rails $home/log
- ln -s /shared/uploads $home/public/uploads
- ln -s /shared/backups $home/public/backups
but I’d rather have it slightly weird there than worry about breaking any existing installs.
So… how do we tell unicorn to rotate logfiles?