+ template "/etc/default/rails-#{name}" do
+ source "rails.environment.erb"
+ owner "root"
+ group "root"
+ mode "0600"
+ variables :secret_key_base => secret_key_base
+ end
+
+ service "rails-jobs@#{name}" do
+ action [:enable, :start]
+ supports :restart => true
+ subscribes :restart, "rails_port[#{site_name}]"
+ subscribes :restart, "systemd_service[rails-jobs@]"
+ only_if "fgrep -q delayed_job #{rails_directory}/Gemfile.lock"
+ end
+
+ if details[:cgimap_repository]
+ git cgimap_directory do
+ action :sync
+ repository details[:cgimap_repository]
+ revision details[:cgimap_revision]
+ user "apis"
+ group "apis"
+ end
+
+ directory "#{cgimap_directory}/build" do
+ user "apis"
+ group "apis"
+ mode "0755"
+ end
+
+ execute "#{cgimap_directory}/CMakeLists.txt" do
+ action :nothing
+ command "cmake .."
+ cwd "#{cgimap_directory}/build"
+ user "apis"
+ group "apis"
+ subscribes :run, "git[#{cgimap_directory}]", :immediately
+ end
+
+ execute "#{cgimap_directory}/build/Makefile" do
+ action :nothing
+ command "make -j"
+ cwd "#{cgimap_directory}/build"
+ user "apis"
+ group "apis"
+ subscribes :run, "execute[#{cgimap_directory}/CMakeLists.txt]", :immediately
+ end
+
+ template "/etc/default/cgimap-#{name}" do
+ source "cgimap.environment.erb"
+ owner "root"
+ group "root"
+ mode "640"
+ variables :cgimap_socket => "/run/cgimap-#{name}/socket",
+ :database_port => node[:postgresql][:clusters][:"15/main"][:port],
+ :database_name => database_name,
+ :log_directory => log_directory,
+ :options => details[:cgimap_options]
+ end
+
+ service "cgimap@#{name}" do
+ action [:start, :enable]
+ subscribes :restart, "execute[#{cgimap_directory}/build/Makefile]"
+ subscribes :restart, "template[/etc/default/cgimap-#{name}]"
+ subscribes :restart, "systemd_service[cgimap@]"
+ end
+ end
+