]> git.openstreetmap.org Git - chef.git/blob - cookbooks/community/templates/default/web_only.yml.erb
0b7d0ecf6b9fb9bafa82948ce7f7909d17b25493
[chef.git] / cookbooks / community / templates / default / web_only.yml.erb
1 templates:
2   - "templates/web.template.yml"
3   - "templates/web.ssl.template.yml"
4
5 ## which TCP/IP ports should this container expose?
6 ## If you want Discourse to share a port with another webserver like Apache or nginx,
7 ## see https://meta.discourse.org/t/17247 for details
8 expose:
9   - "80:80"   # http
10   - "443:443" # https
11
12 # Use 'links' key to link containers together, aka use Docker --link flag.
13 links:
14   - link:
15       name: data
16       alias: data
17
18 # any extra arguments for Docker?
19 # docker_args:
20
21 # Latest Version v3.0.2
22 params:
23   version: stable
24
25 env:
26   LC_ALL: en_US.UTF-8
27   LANG: en_US.UTF-8
28   LANGUAGE: en_US.UTF-8
29   DISCOURSE_FORCE_HTTPS: true
30
31   ## How many concurrent web requests are supported? Depends on memory and CPU cores.
32   ## will be set automatically by bootstrap based on detected CPUs, or you can override
33   UNICORN_WORKERS: <%= node.cpu_cores %>
34
35   ## TODO: The domain name this Discourse instance will respond to
36   DISCOURSE_HOSTNAME: community.openstreetmap.org
37   DISCOURSE_CDN_URL: https://community-cdn.openstreetmap.org
38
39   ## Uncomment if you want the container to be started with the same
40   ## hostname (-h option) as specified above (default "$hostname-$config")
41   #DOCKER_USE_HOSTNAME: true
42
43   ## TODO: List of comma delimited emails that will be made admin and developer
44   ## on initial signup example 'user1@example.com,user2@example.com'
45   DISCOURSE_DEVELOPER_EMAILS: 'operations@openstreetmap.org'
46
47   DISCOURSE_SMTP_ADDRESS: <%= node[:exim][:smarthost_via].split(":", 2)[0] %>
48   DISCOURSE_SMTP_PORT: <%= node[:exim][:smarthost_via].split(":", 2)[1] || "25" %>
49   DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
50   DISCOURSE_SMTP_USER_NAME:
51   DISCOURSE_SMTP_PASSWORD:
52   DISCOURSE_SMTP_DOMAIN: community.openstreetmap.org
53   DISCOURSE_NOTIFICATION_EMAIL: community@noreply.openstreetmap.org
54
55   ## TODO: configure connectivity to the databases
56   DISCOURSE_DB_SOCKET: ''
57   #DISCOURSE_DB_USERNAME: discourse
58   DISCOURSE_DB_PASSWORD: '<%= @passwords["database"] %>'
59   DISCOURSE_DB_HOST: data
60   DISCOURSE_REDIS_HOST: data
61
62   ## The maxmind geolocation IP address key for IP address lookup
63   ## see https://meta.discourse.org/t/-/137387/23 for details
64 <% if @license_keys -%>
65   DISCOURSE_MAXMIND_LICENSE_KEY: '<%= @license_keys[node[:geoipupdate][:account]] %>'
66 <% end -%>
67
68   # Allow list for prometheus metric collection
69   DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX: '^<%= @prometheus_servers.map { |a| Regexp.escape(a) }.join("|") %>$'
70
71   # Increase base SIDEKIQ memory limit to 1GB
72   UNICORN_SIDEKIQ_MAX_RSS: 1000
73
74 volumes:
75   - volume:
76       host: /srv/community.openstreetmap.org/shared/web-only
77       guest: /shared
78   - volume:
79       host: /srv/community.openstreetmap.org/shared/web-only/log/var-log
80       guest: /var/log
81   - volume:
82       host: /etc/ssl/certs/community.openstreetmap.org.pem
83       guest: /shared/ssl/ssl.crt
84   - volume:
85       host: /etc/ssl/private/community.openstreetmap.org.key
86       guest: /shared/ssl/ssl.key
87   - volume:
88       host: /etc/ssl/certs/dhparam.pem
89       guest: /shared/ssl/dhparam.pem
90   - volume:
91       host: /srv/community.openstreetmap.org/files/update-feeds.atom
92       guest: /shared/feeds/update-feeds.atom
93
94 ## Plugins go here
95 ## see https://meta.discourse.org/t/19157 for details
96 hooks:
97   after_code:
98     - exec:
99         cd: $home/plugins
100         cmd:
101           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-oauth2-basic.git
102           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-solved.git
103           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-canned-replies.git
104           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-reactions.git
105           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-prometheus.git
106           # FIXME revert to upstream once PR has been merged: https://github.com/discourse/discourse-translator/pull/103
107           - sudo -H -E -u discourse git clone --depth 1 --branch serbian-digraphic-fix https://github.com/Firefishy/discourse-translator.git
108           - sudo -H -E -u discourse git clone --depth 1 https://github.com/discourse/discourse-saved-searches.git
109     - exec:
110         # Needs to be copied in else builtin git cleanup fails
111         cd: $home
112         cmd:
113           - sudo -H -E -u discourse cp /shared/feeds/update-feeds.atom public/update-feeds.atom
114   after_ssl:
115     - replace:
116         filename: "/etc/nginx/conf.d/discourse.conf"
117         from: /listen 80;/
118         to: |
119           listen 80;
120           listen [::]:80;
121           rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
122
123     - replace:
124         filename: "/etc/nginx/conf.d/discourse.conf"
125         from: /add_header.+/
126         to: |
127           add_header Strict-Transport-Security 'max-age=31536000; preload';
128           ssl_stapling on;
129           resolver <%= node[:networking][:nameservers].join(" ") %>;
130           resolver_timeout 5s;
131           ssl_dhparam /shared/ssl/dhparam.pem;