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