split up templates
[discourse_docker.git] / templates / web.template.yml
CommitLineData
9fb5f2d3
SS
1env:
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
13params:
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
25 password:
26 host:
27 host_names:
28 - YOUR_HOSTNAME_HERE
29
30run:
31
32 - file:
33 path: /etc/service/unicorn/run
34 chmod: "+x"
35 contents: |
36 #!/bin/bash
37 exec 2>&1
38 $env
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
50 $env
51 # redis
52 # postgres
53 cd $home
54 exec sudo -E -u discourse LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec sidekiq
55
56 - file:
57 path: /etc/service/nginx/run
58 chmod: "+x"
59 contents: |
60 #!/bin/sh
61 exec 2>&1
62 exec /usr/sbin/nginx
63
64 - exec:
65 cd: $home
66 hook: code
67 cmd:
68 - git reset --hard
69 - git clean -f
70 - git pull
71 - git checkout $version
72 - cp config/database.yml.production-sample config/database.yml
73 - cp config/redis.yml.sample config/redis.yml
74 - cp config/environments/production.rb.sample config/environments/production.rb
75 - mkdir -p tmp/pids
76 - mkdir -p tmp/sockets
77 - touch tmp/.gitkeep
78 - mkdir -p /shared/log/rails
79 - rm -r log
80 - ln -s /shared/log/rails $home/log
81 - mkdir -p /shared/uploads
82 - ln -s /shared/uploads $home/public/uploads
83 - chown -R discourse /shared/uploads
84 - chown -R discourse /shared/log/rails
85 - exec:
86 cmd:
87 - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf"
88 - "rm /etc/nginx/sites-enabled/default"
89
90 - replace:
91 filename: /etc/nginx/nginx.conf
92 from: pid /run/nginx.pid;
93 to: daemon off;
94
95 - replace:
96 filename: "/etc/nginx/conf.d/discourse.conf"
97 from: /upstream[^\}]+\}/m
98 to: "upstream discourse {
99 server 127.0.0.1:3000;
100 }"
101
102 - replace:
103 filename: "/etc/nginx/conf.d/discourse.conf"
104 from: /server_name.+$/
105 to: server_name _ ;
106
107 - merge: $home/config/database.yml $database_yml
108
109 - exec:
110 cd: $home
111 cmd:
112 - chown -R discourse $home
113 - sudo -E -u discourse bundle install --deployment --verbose --without test --without development
114 - sudo -E -u discourse bundle exec rake db:migrate
115 - sudo -E -u discourse bundle exec rake assets:precompile
116