Initial kosmos_discourse cookbook #223

Merged
greg merged 5 commits from feature/222-discourse into master 2020-10-23 10:12:12 +00:00
2 changed files with 18 additions and 36 deletions
Showing only changes of commit 255e43c680 - Show all commits

View File

@@ -35,19 +35,24 @@ git deploy_path do
revision "master"
end
# FIXME: The systemd unit does not work
template "/etc/systemd/system/discourse.service" do
source "discourse.service.erb"
variables deploy_path: deploy_path
notifies :run, "execute[systemctl daemon-reload]", :immediately
end
execute "systemctl daemon-reload" do
action :nothing
end
service "discourse" do
action [:enable]
systemd_unit "discourse.service" do

Also, this should use a service chef resource IMO.

The service merely needs to use the launcher script in /opt/discourse. I.e. ./launcher start|stop|restart app.

Also, this should use a `service` chef resource IMO. The service merely needs to use the launcher script in `/opt/discourse`. I.e. `./launcher start|stop|restart app`.
content({Unit: {
Description: "discourse service with docker compose",
Requires: "docker.service",
After: "docker.service",
},
Service: {
Type: "oneshot",
RemainAfterExit: "true",
WorkingDirectory: deploy_path,
Environment: "SUPERVISED=true",
ExecStart: "#{deploy_path}/launcher start app",
ExecStop: "#{deploy_path}/launcher stop app",
},
Install: {
WantedBy: "multi-user.target"
}})
action [:create, :enable]
end
template "#{node['nginx']['dir']}/sites-available/#{domain}" do

View File

@@ -1,23 +0,0 @@
[Unit]
Description=discourse service with docker compose
Requires=docker.service
After=docker.service
[Service]
Restart=always
WorkingDirectory=<%= @deploy_path %>
Environment="SUPERVISED=true"
ExecStartPre=<%= @deploy_path %>/launcher stop app
# Remove all containers that have stopped for > 24 hours
ExecStartPre=<%= @deploy_path %>/launcher cleanup
ExecStart=<%= @deploy_path %>/launcher start app
ExecStop=<%= @deploy_path %>/launcher stop app
[Install]
WantedBy=multi-user.target