FIX: logrotation for containers that constantly rebuild
authorSam <sam.saffron@gmail.com>
Thu, 28 Aug 2014 00:51:22 +0000 (10:51 +1000)
committerSam <sam.saffron@gmail.com>
Thu, 28 Aug 2014 00:51:22 +0000 (10:51 +1000)
templates/web.template.yml

index eeae3bc37bfe159182c44128ba87fb52922d05bf..4521bfe9c2b77b54f57285da2e01dff5a9c7c0f3 100644 (file)
@@ -169,3 +169,14 @@ run:
                 sv 1 unicorn
                 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
+  - exec:
+     cmd:
+       - rm -fr /var/lib/logrotate
+       - mkdir -p /shared/state/logrotate
+       - ln -s /shared/state/logrotate /var/lib/logrotate
+       - rm -fr /var/spool/anacron
+       - mkdir -p /shared/state/anacron-spool
+       - ln -s /shared/state/anacron-spool /var/spool/anacron