long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
version "1.0.0"
depends "apache"
+depends "systemd"
group "gpstile"
end
-template "/etc/init.d/gps-update" do
- source "update.init.erb"
- owner "root"
- group "root"
- mode 0o755
+systemd_service "gps-update" do
+ description "GPS tile update daemon"
+ after ["network.target", "memcached.service"]
+ wants ["memcached.service"]
+ user "gpstile"
+ working_directory "/srv/gps-tile.openstreetmap.org"
+ exec_start "/srv/gps-tile.openstreetmap.org/updater/update"
+ private_tmp true
+ private_devices true
+ protect_system "full"
+ protect_home true
+ no_new_privileges true
+ restart "on-failure"
end
service "gps-update" do
action [:enable, :start]
- supports :restart => true, :status => true
subscribes :restart, "git[/srv/gps-tile.openstreetmap.org/updater]"
+ subscribes :restart, "systemd_service[gps-update]"
end
remote_directory "/srv/gps-tile.openstreetmap.org/html" do
+++ /dev/null
-#!/bin/bash
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-start() {
- start-stop-daemon --start --chuid gpstile --chdir /srv/gps-tile.openstreetmap.org --background --make-pidfile --pidfile /var/run/gps-update.pid --exec /srv/gps-tile.openstreetmap.org/updater/update
-}
-
-stop() {
- start-stop-daemon --stop --retry 300 --pidfile /var/run/gps-update.pid
-}
-
-status() {
- start-stop-daemon --status --pidfile /var/run/gps-update.pid
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop || exit $?
- start
- ;;
- status)
- status
- exit $?
- ;;
-esac
property :environment_file, [String, Hash]
property :user, String
property :group, String
+property :working_directory, String
property :exec_start_pre, String
property :exec_start, String, :required => true
property :exec_start_post, String
property :private_network, [TrueClass, FalseClass]
property :protect_system, [TrueClass, FalseClass, String]
property :protect_home, [TrueClass, FalseClass, String]
+property :no_new_privileges, [TrueClass, FalseClass]
property :timeout_sec, Integer
property :pid_file, String
<% if @group -%>
Group=<%= @group %>
<% end -%>
+<% if @working_directory -%>
+WorkingDirectory=<%= @working_directory %>
+<% end -%>
<% if @exec_start_pre -%>
ExecStartPre=<%= @exec_start_pre %>
<% end -%>
<% if @protect_home -%>
ProtectHome=<%= @protect_home %>
<% end -%>
+<% if @no_new_privileges -%>
+NoNewPrivileges=<%= @no_new_privileges %>
+<% end -%>
<% if @restart -%>
Restart=<%= @restart %>
<% end -%>