From: Michael Brown Date: Thu, 31 Jul 2014 04:40:39 +0000 (-0400) Subject: Handle copy_env nicely, simplify X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;h=1cb802adb0ce2029d728ff2a546dfbb9fb8c7dc4;p=discourse_docker.git Handle copy_env nicely, simplify --- diff --git a/samples/standalone.yml b/samples/standalone.yml index 93fb504..cc9736c 100644 --- a/samples/standalone.yml +++ b/samples/standalone.yml @@ -41,7 +41,7 @@ env: #DISCOURSE_SMTP_USER_NAME: user@example.com # (optional) #DISCOURSE_SMTP_PASSWORD: pa$$word # (optional) ## - ## the origin pull CDN address for this Discourse instance + ## The CDN address for this Discourse instance (configured to pull) #DISCOURSE_CDN_URL: //discourse-cdn.example.com ## These containers are stateless, all data is stored in /shared diff --git a/templates/web.template.yml b/templates/web.template.yml index 84a699e..5fad8d1 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -28,16 +28,12 @@ run: #!/bin/bash env > ~/boot_env 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 + # find DISCOURSE_ env vars, strip the leader, lowercase the key + env | /usr/bin/awk -F= -vOFS== '$1 ~ /^DISCOURSE_/ {print substr(tolower($1),11),$2}' > $conf + + # tell runsv to not restart this when it exits + sv once copy_env - file: path: /etc/service/unicorn/run @@ -47,7 +43,7 @@ run: exec 2>&1 # redis # postgres - sv start copy_env || exit 1 + sv check copy_env || exit 1 cd $home chown -R discourse:www-data /shared/log/rails exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb