From 93149421ff8d1835bd5002e251844e83eb094eb4 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Sun, 3 Nov 2013 19:57:01 -0800 Subject: [PATCH] allow for a heirarchy of input files --- launcher | 15 ++- standalone.sample.yml | 208 ------------------------------------------ 2 files changed, 14 insertions(+), 209 deletions(-) delete mode 100644 standalone.sample.yml diff --git a/launcher b/launcher index 966c4df..848f971 100755 --- a/launcher +++ b/launcher @@ -56,7 +56,20 @@ fi case "$command" in bootstrap) - exec cat $config_file | docker run -cidfile $cidbootstrap -i -a stdin -a stdout -a stderr -v `pwd`/shared:/shared samsaffron/discourse /pups/bin/pups --stdin + + read -r -d '' ruby <&1 - $env - sv start redis || exit 1 - sv start postgres || exit 1 - cd $home - exec sudo -E -u discourse bundle exec unicorn -c config/unicorn.conf.rb - - - file: - path: /etc/service/sidekiq/run - chmod: "+x" - contents: | - #!/bin/bash - exec 2>&1 - $env - sv start redis || exit 1 - sv start postgres || exit 1 - cd $home - exec sudo -E -u discourse bundle exec sidekiq - - - file: - path: /etc/service/sshd/run - chmod: "+x" - contents: | - #!/bin/sh - exec 2>&1 - exec /usr/sbin/sshd -D -e - - - file: - path: /etc/service/redis/run - chmod: "+x" - contents: | - #!/bin/sh - exec 2>&1 - exec sudo -u redis /usr/bin/redis-server /etc/redis/redis.conf - - - file: - path: /etc/service/nginx/run - chmod: "+x" - contents: | - #!/bin/sh - exec 2>&1 - exec /usr/sbin/nginx - - - file: - path: /etc/service/postgres/run - chmod: "+x" - contents: | - #!/bin/sh - exec 2>&1 - exec sudo -u postgres /usr/lib/postgresql/9.2/bin/postmaster -D /etc/postgresql/9.2/main - - - - exec: - cd: $home - cmd: - - git reset --hard - - git clean -f - - git pull - - git checkout $head - - cp config/database.yml.production-sample config/database.yml - - cp config/redis.yml.sample config/redis.yml - - cp config/environments/production.rb.sample config/environments/production.rb - - mkdir -p tmp/pids - - mkdir -p tmp/sockets - - mkdir -p log - - exec: - cmd: - - mkdir -p /var/run/sshd - - mkdir -p /root/.ssh - - echo $ssh_key >> /root/.ssh/authorized_keys - - exec: - cmd: - - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf" - - "rm /etc/nginx/sites-enabled/default" - - - replace: - filename: /etc/nginx/nginx.conf - from: pid /run/nginx.pid; - to: daemon off; - - - replace: - filename: "/etc/nginx/conf.d/discourse.conf" - from: /upstream[^\}]+\}/m - to: "upstream discourse { - server 127.0.0.1:3000; - }" - - - replace: - filename: "/etc/nginx/conf.d/discourse.conf" - from: /server_name.+$/ - to: server_name _ ; - - - replace: - filename: "/etc/redis/redis.conf" - from: "daemonize yes" - to: "" - - replace: - filename: "/etc/redis/redis.conf" - from: /^pidfile.*$/ - to: "" - - - exec: - cmd: - - mkdir -p /shared/redis_data - - chown -R redis /shared/redis_data - - chgrp -R redis /shared/redis_data - - - replace: - filename: "/etc/redis/redis.conf" - from: /^logfile.*$/ - to: "logfile stdout" - - - replace: - filename: "/etc/redis/redis.conf" - from: /^dir .*$/ - to: "dir /shared/redis_data" - - # we can not migrate without redis - - exec: - background: true - cmd: "sudo -u redis /usr/bin/redis-server /etc/redis/redis.conf" - - - merge: $home/config/database.yml $database_yml - - - exec: - cmd: - - chown -R root /var/lib/postgresql/9.2/main - - "[ ! -e /shared/postgres_data ] && cp -r /var/lib/postgresql/9.2/main /shared/postgres_data || exit 0" - - chown -R postgres /shared/postgres_data - - chgrp -R postgres /shared/postgres_data - - - replace: - filename: "/etc/postgresql/9.2/main/postgresql.conf" - from: "data_directory = '/var/lib/postgresql/9.2/main'" - to: "data_directory = '/shared/postgres_data'" - - - exec: - background: true - cmd: "sudo -u postgres /usr/lib/postgresql/9.2/bin/postmaster -D /etc/postgresql/9.2/main" - - # give db a few secs to start up - - exec: "sleep 5" - - - exec: sudo -u postgres createdb discourse || exit 0 - - exec: - stdin: | - create user discourse; - cmd: sudo -u postgres psql discourse - raise_on_fail: false - - - exec: - stdin: | - grant all privileges on database discourse to discourse; - cmd: sudo -u postgres psql discourse - raise_on_fail: false - - - exec: /bin/bash -c 'sudo -u postgres psql discourse <<< "create extension if not exists hstore;"' - - exec: /bin/bash -c 'sudo -u postgres psql discourse <<< "create extension if not exists pg_trgm;"' - - - - exec: - cd: $home - cmd: - - chown -R discourse $home - - sudo -E -u discourse bundle install --deployment - - sudo -E -u discourse bundle exec rake db:migrate - - sudo -E -u discourse bundle exec rake assets:precompile - -- 2.25.1