2 # You can have redis on a different box
3 RAILS_ENV: 'production'
5 # slightly less aggressive than "recommendation" but works fine with oobgc
6 RUBY_GC_MALLOC_LIMIT: 40000000
7 # this ensures we have enough heap space to handle a big pile of small reqs
8 RUBY_HEAP_MIN_SLOTS: 800000
10 DISCOURSE_DB_SOCKET: /var/run/postgresql
16 # SSH key is required for remote access into the container
19 home: /var/www/discourse
23 path: /etc/service/copy_env/run
27 conf=/var/www/discourse/config/discourse.conf
28 sudo -u discourse echo > $conf
30 for x in `env | /usr/bin/awk -F= '{if($1 ~ /DISCOURSE_/) print $1}'`
34 echo "$c"=${!x} >> $conf
36 # I dunno there may be a cleaner way to handle this
40 path: /etc/service/unicorn/run
47 sv start copy_env || exit 1
49 exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb
52 path: /etc/service/sidekiq/run
59 sv start copy_env || exit 1
61 exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq
64 path: /etc/service/nginx/run
78 - git checkout $version
80 - mkdir -p tmp/sockets
82 - mkdir -p /shared/log/rails
84 - ln -s /shared/log/rails $home/log
85 - mkdir -p /shared/uploads
86 - ln -s /shared/uploads $home/public/uploads
87 - chown -R discourse:www-data /shared/uploads
88 - chown -R discourse:www-data /shared/log/rails
91 - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf"
92 - "rm /etc/nginx/sites-enabled/default"
95 filename: /etc/nginx/nginx.conf
96 from: pid /run/nginx.pid;
100 filename: "/etc/nginx/conf.d/discourse.conf"
101 from: /upstream[^\}]+\}/m
102 to: "upstream discourse {
103 server 127.0.0.1:3000;
107 filename: "/etc/nginx/conf.d/discourse.conf"
108 from: /server_name.+$/
112 cmd: echo "done configuring web"
118 - chown -R discourse $home
119 - sudo -E -u discourse bundle install --deployment --verbose --without test --without development
120 - sudo -E -u discourse bundle exec rake db:migrate
121 - sudo -E -u discourse bundle exec rake assets:precompile