5 # Copyright:: 2021, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # https://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 include_recipe "docker"
23 include_recipe "geoipupdate"
25 passwords = data_bag_item("community", "passwords")
26 license_keys = data_bag_item("geoipupdate", "license-keys")
28 directory "/srv/community.openstreetmap.org" do
34 directory "/srv/community.openstreetmap.org/shared" do
40 git "/srv/community.openstreetmap.org/docker" do
42 repository "https://github.com/discourse/discourse_docker.git"
47 notifies :run, "execute[discourse_container_data_rebuild]"
48 notifies :run, "execute[discourse_container_web_only_rebuild]"
49 notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
52 template "/srv/community.openstreetmap.org/docker/containers/data.yml" do
57 variables :passwords => passwords
58 notifies :run, "execute[discourse_container_data_rebuild]"
61 template "/srv/community.openstreetmap.org/docker/containers/web_only.yml" do
62 source "web_only.yml.erb"
66 variables :license_keys => license_keys, :passwords => passwords
67 notifies :run, "execute[discourse_container_web_only_rebuild]"
70 template "/srv/community.openstreetmap.org/docker/containers/mail-receiver.yml" do
71 source "mail-receiver.yml.erb"
75 variables :passwords => passwords
76 notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
79 execute "discourse_container_data_rebuild" do
81 command "./launcher rebuild data"
82 cwd "/srv/community.openstreetmap.org/docker/"
87 ssl_certificate "community.openstreetmap.org" do
88 domains ["community.openstreetmap.org", "community.osm.org"]
89 notifies :run, "execute[discourse_container_web_only_rebuild]"
92 execute "discourse_container_web_only_rebuild" do
94 command "./launcher rebuild web_only"
95 cwd "/srv/community.openstreetmap.org/docker/"
100 execute "discourse_container_mail_receiver_rebuild" do
102 command "./launcher rebuild mail-receiver"
103 cwd "/srv/community.openstreetmap.org/docker/"
108 ## FIXME https://github.com/discourse/discourse_docker/pull/611
109 template "/etc/cron.daily/community-backup" do
110 source "backup.cron.erb"
116 node.default[:prometheus][:exporters][443] = {
117 :name => "community",
118 :address => "#{node[:prometheus][:address]}:443",
119 :sni => "community.openstreetmap.org"