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