env: # Comma delimited list of emails, required if you want admin access for first account DEVELOPER_EMAILS: 'YOUR_EMAIL@EMAIL.COM1' # You can have redis on a different box # REDIS_PROVIDER_URL: 'redis://l.discourse:6379' RAILS_ENV: 'production' UNICORN_WORKERS: 3 # slightly less aggressive than "recommendation" but works fine with oobgc RUBY_GC_MALLOC_LIMIT: 40000000 # this ensures we have enough heap space to handle a big pile of small reqs RUBY_HEAP_MIN_SLOTS: 800000 params: # SSH key is required for remote access into the container version: HEAD home: /var/www/discourse # You can connect to any DB you wish to database_yml: production: database: discourse username: discourse socket: /var/run/postgresql # TODO allow param here? # password: # host: # host_names: # - YOUR_HOSTNAME_HERE run: - file: path: /etc/service/unicorn/run chmod: "+x" contents: | #!/bin/bash exec 2>&1 # redis # postgres 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 - file: path: /etc/service/sidekiq/run chmod: "+x" contents: | #!/bin/bash exec 2>&1 # redis # postgres cd $home exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq - file: path: /etc/service/nginx/run chmod: "+x" contents: | #!/bin/sh exec 2>&1 exec /usr/sbin/nginx - exec: cd: $home hook: code cmd: - git reset --hard - git clean -f - git pull - git checkout $version - 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 - touch tmp/.gitkeep - mkdir -p /shared/log/rails - rm -r log - ln -s /shared/log/rails $home/log - mkdir -p /shared/uploads - ln -s /shared/uploads $home/public/uploads - chown -R discourse:www-data /shared/uploads - chown -R discourse:www-data /shared/log/rails - 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 _ ; - merge: $home/config/database.yml $database_yml - exec: cmd: echo "done configuring web" hook: web_config - exec: cd: $home cmd: - chown -R discourse $home - sudo -E -u discourse bundle install --deployment --verbose --without test --without development - sudo -E -u discourse bundle exec rake db:migrate - sudo -E -u discourse bundle exec rake assets:precompile