From 87f8d0b32c616d823bad0c18df2b368d78153fc7 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 2 Jan 2014 16:30:41 -0800 Subject: [PATCH] when a container starts copy the discourse ENV over to discourse.conf --- templates/sshd.template.yml | 6 ------ templates/web.template.yml | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/templates/sshd.template.yml b/templates/sshd.template.yml index 0e662f6..79831f5 100644 --- a/templates/sshd.template.yml +++ b/templates/sshd.template.yml @@ -15,12 +15,6 @@ run: contents: | #!/bin/bash exec 2>&1 - echo export DOCKER_HOST_IP=$DOCKER_HOST_IP > /etc/profile.d/docker.sh - for x in `env | /usr/bin/awk -F= '{if($1 ~ /DISCOURSE_/) print $1}'` - do - echo export "$x"=${!x} >> /etc/profile.d/docker.sh - done - chmod +x /etc/profile.d/docker.sh exec /usr/sbin/sshd -D -e - exec: diff --git a/templates/web.template.yml b/templates/web.template.yml index 65a6064..48c7669 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -19,6 +19,22 @@ params: home: /var/www/discourse run: + - file: + path: /etc/service/copy_env/run + chmod: "+x" + contents: | + #!/bin/bash + conf=/var/www/discourse/config/discourse.conf + sudo -u discourse echo > $conf + + for x in `env | /usr/bin/awk -F= '{if($1 ~ /DISCOURSE_/) print $1}'` + do + c=${x,,} + c=${c:10} + echo "$c"=${!x} >> $conf + done + # I dunno there may be a cleaner way to handle this + exec sleep 2147483647 - file: path: /etc/service/unicorn/run @@ -28,6 +44,7 @@ run: exec 2>&1 # redis # postgres + sv start copy_env || exit 1 cd $home exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb @@ -39,6 +56,7 @@ run: exec 2>&1 # redis # postgres + sv start copy_env || exit 1 cd $home exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq -- 2.25.1