Move the creation of the SystemD service files outside of the application
This prevents a crash on the initial Chef run due to the service files not being there yet before the services gets notified to restart
This commit is contained in:
parent
973c65631d
commit
1bc589ffc6
@ -50,6 +50,46 @@ end
|
|||||||
|
|
||||||
ruby_version = "2.5.3"
|
ruby_version = "2.5.3"
|
||||||
|
|
||||||
|
execute "systemctl daemon-reload" do
|
||||||
|
command "systemctl daemon-reload"
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
# mastodon-web service
|
||||||
|
#
|
||||||
|
template "/lib/systemd/system/mastodon-web.service" do
|
||||||
|
source "mastodon-web.systemd.service.erb"
|
||||||
|
variables user: user,
|
||||||
|
app_dir: mastodon_path,
|
||||||
|
port: node["kosmos-mastodon"]["puma_port"],
|
||||||
|
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle"
|
||||||
|
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
||||||
|
notifies :restart, "service[mastodon-web]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
|
# mastodon-sidekiq service
|
||||||
|
#
|
||||||
|
template "/lib/systemd/system/mastodon-sidekiq.service" do
|
||||||
|
source "mastodon-sidekiq.systemd.service.erb"
|
||||||
|
variables user: user,
|
||||||
|
app_dir: mastodon_path,
|
||||||
|
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
|
||||||
|
sidekiq_threads: node["kosmos-mastodon"]["sidekiq_threads"]
|
||||||
|
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
||||||
|
notifies :restart, "service[mastodon-sidekiq]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
|
# mastodon-streaming service
|
||||||
|
#
|
||||||
|
template "/lib/systemd/system/mastodon-streaming.service" do
|
||||||
|
source "mastodon-streaming.systemd.service.erb"
|
||||||
|
variables user: user,
|
||||||
|
app_dir: mastodon_path,
|
||||||
|
port: node["kosmos-mastodon"]["streaming_port"]
|
||||||
|
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
||||||
|
notifies :restart, "service[mastodon-streaming]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
application mastodon_path do
|
application mastodon_path do
|
||||||
owner "mastodon"
|
owner "mastodon"
|
||||||
group "mastodon"
|
group "mastodon"
|
||||||
@ -127,54 +167,14 @@ application mastodon_path do
|
|||||||
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" /opt/ruby_build/builds/#{ruby_version}/bin/bundle exec rake assets:precompile"
|
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" /opt/ruby_build/builds/#{ruby_version}/bin/bundle exec rake assets:precompile"
|
||||||
end
|
end
|
||||||
|
|
||||||
execute "systemctl daemon-reload" do
|
|
||||||
command "systemctl daemon-reload"
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
# mastodon-web service
|
|
||||||
#
|
|
||||||
template "/lib/systemd/system/mastodon-web.service" do
|
|
||||||
source "mastodon-web.systemd.service.erb"
|
|
||||||
variables user: user,
|
|
||||||
app_dir: mastodon_path,
|
|
||||||
port: node["kosmos-mastodon"]["puma_port"],
|
|
||||||
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle"
|
|
||||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
|
||||||
notifies :restart, "service[mastodon-web]", :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service "mastodon-web" do
|
service "mastodon-web" do
|
||||||
action [:enable, :start]
|
action [:enable, :start]
|
||||||
end
|
end
|
||||||
|
|
||||||
# mastodon-sidekiq service
|
|
||||||
#
|
|
||||||
template "/lib/systemd/system/mastodon-sidekiq.service" do
|
|
||||||
source "mastodon-sidekiq.systemd.service.erb"
|
|
||||||
variables user: user,
|
|
||||||
app_dir: mastodon_path,
|
|
||||||
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
|
|
||||||
sidekiq_threads: node["kosmos-mastodon"]["sidekiq_threads"]
|
|
||||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
|
||||||
notifies :restart, "service[mastodon-sidekiq]", :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service "mastodon-sidekiq" do
|
service "mastodon-sidekiq" do
|
||||||
action [:enable, :start]
|
action [:enable, :start]
|
||||||
end
|
end
|
||||||
|
|
||||||
# mastodon-streaming service
|
|
||||||
#
|
|
||||||
template "/lib/systemd/system/mastodon-streaming.service" do
|
|
||||||
source "mastodon-streaming.systemd.service.erb"
|
|
||||||
variables user: user,
|
|
||||||
app_dir: mastodon_path,
|
|
||||||
port: node["kosmos-mastodon"]["streaming_port"]
|
|
||||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
|
||||||
notifies :restart, "service[mastodon-streaming]", :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service "mastodon-streaming" do
|
service "mastodon-streaming" do
|
||||||
action [:enable, :start]
|
action [:enable, :start]
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user