# When new LTS ships we can upgrade
# NAME: discourse_base
-# VERSION: 1.0.4
+# VERSION: 1.0.5
FROM ubuntu:14.04
cd / && git clone https://github.com/SamSaffron/pups.git
# clean up for docker squash
-RUN rm -fr /usr/share/man && rm -fr /usr/share/doc
+RUN rm -fr /usr/share/man && rm -fr /usr/share/doc && 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-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
+
+# this is temporary, remove in 2015
+RUN cp /sbin/boot /sbin/runit
--- /dev/null
+#!/bin/bash
+
+# we use this to boot up cause runit will not handle TERM and will not exit when done
+
+/etc/runit/1
+/etc/runit/2&
+RUNSVDIR=$!
+echo "Started runsvdir, PID is $RUNSVDIR"
+trap "echo Shutting Down && /etc/runit/3 && kill -HUP $RUNSVDIR && wait $RUNSVDIR" SIGTERM SIGHUP
+wait $RUNSVDIR
#!/bin/bash
-/usr/bin/runsvdir -P /etc/service
+exec /usr/bin/runsvdir -P /etc/service
--- /dev/null
+#!/bin/bash
+
+/bin/run-parts --verbose /etc/runit/3.d
-# Current version 1.0.4
-FROM samsaffron/discourse_base:1.0.4
+# Current version 1.0.5
+FROM samsaffron/discourse_base:1.0.5
MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
git remote set-branches --add origin tests-passed &&\
chown -R discourse:discourse /var/www/discourse &&\
cd /var/www/discourse &&\
- sudo -u discourse RAILS4=1 bundle install --deployment \
+ sudo -u discourse bundle install --deployment \
--without test --without development &&\
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
cidfile=cids/"$config".cid
cidbootstrap=cids/"$config"_boostrap.cid
local_discourse=local_discourse
-image=samsaffron/discourse:1.0.4
+image=samsaffron/discourse:1.0.5
docker_path=`which docker.io || which docker`
if [ "${SUPERVISED}" = "true" ]; then
fi
$docker_path run $links $attach_on_run $restart_policy "${env[@]}" -h "`hostname`-$config" -e DOCKER_HOST_IP=$docker_ip --name $config -t --cidfile $cidfile $ports \
- $volumes $local_discourse/$config /sbin/runit
+ $volumes $local_discourse/$config /sbin/boot
exit 0
else
#!/bin/sh
exec 2>&1
HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main
+
+ - file:
+ path: /etc/runit/3.d/99-postgres
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ sv stop postgres
+
- file:
path: /root/upgrade_postgres
chmod: "+x"
exec 2>&1
exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
+ - file:
+ path: /etc/runit/3.d/10-redis
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ sv stop redis
+
- replace:
filename: "/etc/redis/redis.conf"
from: "daemonize yes"
exec 2>&1
exec /usr/sbin/sshd -D -e
+ - file:
+ path: /etc/runit/3.d/99-ssh
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ sv stop sshd
+
- exec:
hook: sshd
cmd:
mkdir -p /var/log/nginx
exec /usr/sbin/nginx
+ - file:
+ path: /etc/runit/3.d/01-nginx
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ sv stop nginx
+
+ - file:
+ path: /etc/runit/3.d/02-unicorn
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ sv stop unicorn
+
- exec:
cd: $home
hook: code