+ - file:
+ path: /etc/logrotate.d/rails
+ contents: |
+ /shared/log/rails/*.log
+ {
+ rotate 14
+ dateext
+ daily
+ missingok
+ notifempty
+ delaycompress
+ compress
+ postrotate
+ sv 1 unicorn
+ endscript
+ }
+
+ - file:
+ path: /etc/logrotate.d/nginx
+ contents: |
+ /var/log/nginx/*.log {
+ daily
+ missingok
+ rotate 14
+ compress
+ delaycompress
+ notifempty
+ create 0640 www-data www-data
+ sharedscripts
+ postrotate
+ sv 1 nginx
+ endscript
+ }
+
+ # move state out of the container this fancy is done to support rapid rebuilds of containers,
+ # we store anacron and logrotate state outside the container to ensure its maintained across builds
+ # later move this snipped into an intialization script
+ # we also ensure all the symlinks we need to /shared are in place in the correct structure
+ # this allows us to bootstrap on one machine and then run on another
+ - file:
+ path: /etc/runit/1.d/00-ensure-links
+ chmod: +x
+ contents: |
+ #!/bin/bash
+ if [[ ! -L /var/lib/logrotate ]]; then
+ rm -fr /var/lib/logrotate
+ mkdir -p /shared/state/logrotate
+ ln -s /shared/state/logrotate /var/lib/logrotate
+ fi
+ if [[ ! -L /var/spool/anacron ]]; then
+ rm -fr /var/spool/anacron
+ mkdir -p /shared/state/anacron-spool
+ ln -s /shared/state/anacron-spool /var/spool/anacron
+ fi
+ if [[ ! -d /shared/log/rails ]]; then
+ mkdir -p /shared/log/rails
+ chown -R discourse:www-data /shared/log/rails
+ fi
+ if [[ ! -d /shared/uploads ]]; then
+ mkdir -p /shared/uploads
+ chown -R discourse:www-data /shared/uploads
+ fi
+ if [[ ! -d /shared/backups ]]; then
+ mkdir -p /shared/backups
+ chown -R discourse:www-data /shared/backups
+ fi
+
+ # change login directory to Discourse home
+ - file:
+ path: /root/.bash_profile
+ chmod: 644
+ contents: |
+ cd $home