]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/community/recipes/default.rb
community: Use asynchronous bootstap for web_only container
[chef.git] / cookbooks / community / recipes / default.rb
index 5178f1617505d08483b91ef916eef4d7c65a0e34..69b1406c5a9ed604085afbe013701d3eed5cf351 100644 (file)
@@ -45,7 +45,7 @@ git "/srv/community.openstreetmap.org/docker" do
   user "root"
   group "root"
   notifies :run, "execute[discourse_container_data_rebuild]"
-  notifies :run, "execute[discourse_container_web_only_rebuild]"
+  notifies :run, "execute[discourse_container_web_only_bootstrap]"
   notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
 end
 
@@ -64,7 +64,7 @@ template "/srv/community.openstreetmap.org/docker/containers/web_only.yml" do
   group "root"
   mode "644"
   variables :license_keys => license_keys, :passwords => passwords
-  notifies :run, "execute[discourse_container_web_only_rebuild]"
+  notifies :run, "execute[discourse_container_web_only_bootstrap]"
 end
 
 template "/srv/community.openstreetmap.org/docker/containers/mail-receiver.yml" do
@@ -76,6 +76,7 @@ template "/srv/community.openstreetmap.org/docker/containers/mail-receiver.yml"
   notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
 end
 
+# Destroy Bootstap Start
 execute "discourse_container_data_rebuild" do
   action :nothing
   command "./launcher rebuild data"
@@ -85,18 +86,46 @@ execute "discourse_container_data_rebuild" do
 end
 
 ssl_certificate "community.openstreetmap.org" do
-  domains ["community.openstreetmap.org", "community.osm.org"]
-  notifies :run, "execute[discourse_container_web_only_rebuild]"
+  domains ["community.openstreetmap.org", "community.osm.org", "communities.openstreetmap.org", "communities.osm.org"]
+  notifies :run, "execute[discourse_container_web_only_bootstrap]"
 end
 
-execute "discourse_container_web_only_rebuild" do
+execute "discourse_container_data_start" do
+  action :run
+  command "./launcher rebuild start"
+  cwd "/srv/community.openstreetmap.org/docker/"
+  user "root"
+  group "root"
+end
+
+execute "discourse_container_web_only_bootstrap" do
+  action :nothing
+  command "./launcher bootstrap web_only"
+  cwd "/srv/community.openstreetmap.org/docker/"
+  user "root"
+  group "root"
+  notifies :run, "execute[discourse_container_web_only_destroy]", :immediately
+end
+
+execute "discourse_container_web_only_destroy" do
   action :nothing
-  command "./launcher rebuild web_only"
+  command "./launcher destroy web_only"
   cwd "/srv/community.openstreetmap.org/docker/"
   user "root"
   group "root"
+  notifies :run, "execute[discourse_container_web_only_start]", :immediately
 end
 
+execute "discourse_container_web_only_start" do
+  action :nothing
+  command "./launcher start web_only"
+  cwd "/srv/community.openstreetmap.org/docker/"
+  user "root"
+  group "root"
+  notifies :run, "execute[discourse_container_data_start]", :before
+end
+
+# Destroy Bootstap Start
 execute "discourse_container_mail_receiver_rebuild" do
   action :nothing
   command "./launcher rebuild mail-receiver"
@@ -105,10 +134,15 @@ execute "discourse_container_mail_receiver_rebuild" do
   group "root"
 end
 
-## FIXME https://github.com/discourse/discourse_docker/pull/611
 template "/etc/cron.daily/community-backup" do
   source "backup.cron.erb"
   owner "root"
   group "root"
   mode "750"
 end
+
+node.default[:prometheus][:exporters][443] = {
+  :name => "community",
+  :address => "#{node[:prometheus][:address]}:443",
+  :sni => "community.openstreetmap.org"
+}