correct default
[discourse_docker.git] / templates / web.template.yml
CommitLineData
9fb5f2d3 1env:
9fb5f2d3 2 # You can have redis on a different box
9fb5f2d3
SS
3 RAILS_ENV: 'production'
4 UNICORN_WORKERS: 3
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
9
9be8f5b9 10 DISCOURSE_DB_SOCKET: /var/run/postgresql
38000fc6
SS
11
12
9fb5f2d3
SS
13params:
14 # SSH key is required for remote access into the container
15 version: HEAD
16
17 home: /var/www/discourse
18
9fb5f2d3
SS
19run:
20
21 - file:
22 path: /etc/service/unicorn/run
23 chmod: "+x"
24 contents: |
25 #!/bin/bash
26 exec 2>&1
9fb5f2d3
SS
27 # redis
28 # postgres
29 cd $home
30 exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb
31
32 - file:
33 path: /etc/service/sidekiq/run
34 chmod: "+x"
35 contents: |
36 #!/bin/bash
37 exec 2>&1
9fb5f2d3
SS
38 # redis
39 # postgres
40 cd $home
41 exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq
42
43 - file:
44 path: /etc/service/nginx/run
45 chmod: "+x"
46 contents: |
47 #!/bin/sh
48 exec 2>&1
49 exec /usr/sbin/nginx
50
51 - exec:
52 cd: $home
53 hook: code
54 cmd:
55 - git reset --hard
56 - git clean -f
57 - git pull
58 - git checkout $version
9fb5f2d3
SS
59 - mkdir -p tmp/pids
60 - mkdir -p tmp/sockets
61 - touch tmp/.gitkeep
62 - mkdir -p /shared/log/rails
63 - rm -r log
64 - ln -s /shared/log/rails $home/log
65 - mkdir -p /shared/uploads
66 - ln -s /shared/uploads $home/public/uploads
58c7d3ba
SS
67 - chown -R discourse:www-data /shared/uploads
68 - chown -R discourse:www-data /shared/log/rails
9fb5f2d3
SS
69 - exec:
70 cmd:
71 - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf"
72 - "rm /etc/nginx/sites-enabled/default"
73
74 - replace:
75 filename: /etc/nginx/nginx.conf
76 from: pid /run/nginx.pid;
77 to: daemon off;
78
79 - replace:
80 filename: "/etc/nginx/conf.d/discourse.conf"
81 from: /upstream[^\}]+\}/m
82 to: "upstream discourse {
83 server 127.0.0.1:3000;
84 }"
85
86 - replace:
87 filename: "/etc/nginx/conf.d/discourse.conf"
88 from: /server_name.+$/
89 to: server_name _ ;
90
9e8e16a8
SS
91 - exec:
92 cmd: echo "done configuring web"
93 hook: web_config
94
9fb5f2d3
SS
95 - exec:
96 cd: $home
97 cmd:
98 - chown -R discourse $home
99 - sudo -E -u discourse bundle install --deployment --verbose --without test --without development
100 - sudo -E -u discourse bundle exec rake db:migrate
101 - sudo -E -u discourse bundle exec rake assets:precompile
102