From 573617ea753f14c60b32c07d9d8620bfefe847ac Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 7 Jul 2016 11:08:20 +1000 Subject: [PATCH] more permission fixes for anacron, keep in base image as well --- image/base/Dockerfile | 3 ++- image/base/cron.d_anacron | 6 ++++++ image/base/runit-1.d-00-fix-var-logs | 7 +++++++ templates/web.template.yml | 9 +++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 image/base/cron.d_anacron create mode 100755 image/base/runit-1.d-00-fix-var-logs diff --git a/image/base/Dockerfile b/image/base/Dockerfile index f01dfb8..16e0fbe 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -108,15 +108,16 @@ RUN rm -fr /usr/share/man &&\ # this can probably be done, but I worry that people changing PG locales will have issues # cd /usr/share/locale && rm -fr `ls -d */ | grep -v en` - RUN mkdir -p /etc/runit/3.d ADD runit-1 /etc/runit/1 ADD runit-1.d-cleanup-pids /etc/runit/1.d/cleanup-pids ADD runit-1.d-anacron /etc/runit/1.d/anacron +ADD runit-1.d-00-fix-var-logs /etc/runit/1.d/00-fix-var-logs ADD runit-2 /etc/runit/2 ADD runit-3 /etc/runit/3 ADD boot /sbin/boot ADD cron /etc/service/cron/run ADD rsyslog /etc/service/rsyslog/run +ADD cron.d-anacron /etc/cron.d/anacron diff --git a/image/base/cron.d_anacron b/image/base/cron.d_anacron new file mode 100644 index 0000000..0f784a9 --- /dev/null +++ b/image/base/cron.d_anacron @@ -0,0 +1,6 @@ +# this avoids using invoke-rc.d which is bust in image + +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +30 7 * * * root /usr/sbin/anacron -s >/dev/null diff --git a/image/base/runit-1.d-00-fix-var-logs b/image/base/runit-1.d-00-fix-var-logs new file mode 100755 index 0000000..fda0252 --- /dev/null +++ b/image/base/runit-1.d-00-fix-var-logs @@ -0,0 +1,7 @@ +#!/bin/bash +mkdir -p /var/log/nginx +chown -R www-data:www-data /var/log/nginx +chown www-data:www-data /var/log/nginx +chown -f syslog:adm /var/log/syslog* +chown -f syslog:adm /var/log/auth.log* +chown -f syslog:adm /var/log/kern.log* diff --git a/templates/web.template.yml b/templates/web.template.yml index 27136da..aec8839 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -39,6 +39,15 @@ run: - exec: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end' - exec: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end' - exec: chown -R discourse /home/discourse + # TODO: move to base image (anacron can not be fired up using rc.d) + - exec: rm -f /etc/cron.d/anacron + - file: + path: /etc/cron.d/anacron + contents: | + SHELL=/bin/sh + PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + + 30 7 * * * root /usr/sbin/anacron -s >/dev/null - file: path: /etc/runit/1.d/copy-env chmod: "+x" -- 2.25.1