FEATURE: change login directory to discourse home when enter a container
[discourse_docker.git] / templates / web.template.yml
index 2ff14832587da2f9d4d71cfb6934faec260cafbd..bfd06ce637d0fc6fd6d6dd28aebbc37c8ff7302d 100644 (file)
@@ -22,6 +22,7 @@ params:
 
 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'
   - file:
      path: /etc/runit/1.d/copy-env
      chmod: "+x"
@@ -34,12 +35,14 @@ run:
         /usr/local/bin/ruby -e 'ENV.each{|k,v| puts "#{$1.downcase} = #{v}" if k =~ /^DISCOURSE_(.*)/}' > $conf
 
   - file:
-      path: /etc/runit/1.d/ensure-web-nginx-read
-      chmod: "+x"
-      contents: |
+     path: /etc/runit/1.d/ensure-web-nginx-read
+     chmod: "+x"
+     contents: |
         #!/bin/bash
+        mkdir -p /var/log/nginx
         chgrp -R www-data /var/log/nginx
         chgrp www-data /var/log/nginx
+
   - file:
      path: /etc/service/unicorn/run
      chmod: "+x"
@@ -58,7 +61,6 @@ run:
      contents: |
         #!/bin/sh
         exec 2>&1
-        mkdir -p /var/log/nginx
         exec /usr/sbin/nginx
 
   - file:
@@ -245,3 +247,10 @@ run:
           mkdir -p /shared/backups
           chown -R discourse:www-data /shared/backups
         fi
+
+  # change login directory to Discourse home
+  - file:
+     path: /root/.bash_profile
+     chmod: 644
+     contents: |
+        cd $home