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