Commit | Line | Data |
---|---|---|
9fb5f2d3 SS |
1 | env: |
2 | # Comma delimited list of emails, required if you want admin access for first account | |
3 | DEVELOPER_EMAILS: 'YOUR_EMAIL@EMAIL.COM1' | |
4 | # You can have redis on a different box | |
5 | # REDIS_PROVIDER_URL: 'redis://l.discourse:6379' | |
6 | RAILS_ENV: 'production' | |
7 | UNICORN_WORKERS: 3 | |
8 | # slightly less aggressive than "recommendation" but works fine with oobgc | |
9 | RUBY_GC_MALLOC_LIMIT: 40000000 | |
10 | # this ensures we have enough heap space to handle a big pile of small reqs | |
11 | RUBY_HEAP_MIN_SLOTS: 800000 | |
12 | ||
13 | params: | |
14 | # SSH key is required for remote access into the container | |
15 | version: HEAD | |
16 | ||
17 | home: /var/www/discourse | |
18 | ||
19 | # You can connect to any DB you wish to | |
20 | database_yml: | |
21 | production: | |
22 | database: discourse | |
23 | username: discourse | |
24 | socket: /var/run/postgresql | |
8f993af4 SS |
25 | # TODO allow param here? |
26 | # password: | |
27 | # host: | |
28 | # host_names: | |
29 | # - YOUR_HOSTNAME_HERE | |
9fb5f2d3 SS |
30 | |
31 | run: | |
32 | ||
33 | - file: | |
34 | path: /etc/service/unicorn/run | |
35 | chmod: "+x" | |
36 | contents: | | |
37 | #!/bin/bash | |
38 | exec 2>&1 | |
9fb5f2d3 SS |
39 | # redis |
40 | # postgres | |
41 | cd $home | |
42 | exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb | |
43 | ||
44 | - file: | |
45 | path: /etc/service/sidekiq/run | |
46 | chmod: "+x" | |
47 | contents: | | |
48 | #!/bin/bash | |
49 | exec 2>&1 | |
9fb5f2d3 SS |
50 | # redis |
51 | # postgres | |
52 | cd $home | |
53 | exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq | |
54 | ||
55 | - file: | |
56 | path: /etc/service/nginx/run | |
57 | chmod: "+x" | |
58 | contents: | | |
59 | #!/bin/sh | |
60 | exec 2>&1 | |
61 | exec /usr/sbin/nginx | |
62 | ||
63 | - exec: | |
64 | cd: $home | |
65 | hook: code | |
66 | cmd: | |
67 | - git reset --hard | |
68 | - git clean -f | |
69 | - git pull | |
70 | - git checkout $version | |
71 | - cp config/database.yml.production-sample config/database.yml | |
72 | - cp config/redis.yml.sample config/redis.yml | |
73 | - cp config/environments/production.rb.sample config/environments/production.rb | |
74 | - mkdir -p tmp/pids | |
75 | - mkdir -p tmp/sockets | |
76 | - touch tmp/.gitkeep | |
77 | - mkdir -p /shared/log/rails | |
78 | - rm -r log | |
79 | - ln -s /shared/log/rails $home/log | |
80 | - mkdir -p /shared/uploads | |
81 | - ln -s /shared/uploads $home/public/uploads | |
58c7d3ba SS |
82 | - chown -R discourse:www-data /shared/uploads |
83 | - chown -R discourse:www-data /shared/log/rails | |
9fb5f2d3 SS |
84 | - exec: |
85 | cmd: | |
86 | - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf" | |
87 | - "rm /etc/nginx/sites-enabled/default" | |
88 | ||
89 | - replace: | |
90 | filename: /etc/nginx/nginx.conf | |
91 | from: pid /run/nginx.pid; | |
92 | to: daemon off; | |
93 | ||
94 | - replace: | |
95 | filename: "/etc/nginx/conf.d/discourse.conf" | |
96 | from: /upstream[^\}]+\}/m | |
97 | to: "upstream discourse { | |
98 | server 127.0.0.1:3000; | |
99 | }" | |
100 | ||
101 | - replace: | |
102 | filename: "/etc/nginx/conf.d/discourse.conf" | |
103 | from: /server_name.+$/ | |
104 | to: server_name _ ; | |
105 | ||
106 | - merge: $home/config/database.yml $database_yml | |
107 | ||
108 | - exec: | |
109 | cd: $home | |
110 | cmd: | |
111 | - chown -R discourse $home | |
112 | - sudo -E -u discourse bundle install --deployment --verbose --without test --without development | |
113 | - sudo -E -u discourse bundle exec rake db:migrate | |
114 | - sudo -E -u discourse bundle exec rake assets:precompile | |
115 |