Merge branch 'dont_start_if_path_is_nonexistent' into 'master'

Dont start if path is nonexistent

This should handle #272 .

Even when /opt is mounted as a separate filesystem, systemd will attempt starting GitLab and if for some reason all filesystems are not mounted this will make GitLab start fail.

Fix contains a move of the service file to [the installed packages unit location](http://www.freedesktop.org/software/systemd/man/systemd.unit.html) of `/usr/lib/systemd/system` and also adds a condition to start GitLab only after all system services are loaded.

See merge request !403
This commit is contained in:
Marin Jankovski 2015-07-07 15:56:42 +00:00
commit 2fc8482daf
2 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,10 @@
[Unit]
Description=GitLab Runit supervision process
After=basic.target
[Service]
ExecStart=/opt/gitlab/embedded/bin/runsvdir-start
Restart=always
[Install]
WantedBy=basic.target

View File

@ -17,21 +17,27 @@
# limitations under the License.
#
directory "/etc/systemd/system/default.target.wants" do
recursive true
not_if { ::File.directory?("/etc/systemd/system/default.target.wants") }
cookbook_file "/usr/lib/systemd/system/gitlab-runsvdir.service" do
mode "0644"
source "gitlab-runsvdir.service"
notifies :run, 'execute[systemctl daemon-reload]', :immediately
notifies :run, 'execute[systemctl enable gitlab-runsvdir]', :immediately
notifies :run, 'execute[systemctl start gitlab-runsvdir]', :immediately
end
link "/etc/systemd/system/default.target.wants/gitlab-runsvdir.service" do
to "/opt/gitlab/embedded/cookbooks/runit/files/default/gitlab-runsvdir.service"
notifies :run, 'execute[systemctl daemon-reload]', :immediately
notifies :run, 'execute[systemctl start gitlab-runsvdir]', :immediately
# Remove old symlink
file "/etc/systemd/system/default.target.wants/gitlab-runsvdir.service" do
action :delete
end
execute "systemctl daemon-reload" do
action :nothing
end
execute "systemctl enable gitlab-runsvdir" do
action :nothing
end
execute "systemctl start gitlab-runsvdir" do
action :nothing
end