2016-08-26 15:23:05 +02:00
|
|
|
#!/sbin/openrc-run
|
2015-11-23 10:28:07 +01:00
|
|
|
|
|
|
|
name="GitLab Sidekiq"
|
|
|
|
description="Sidekiq for GitLab"
|
|
|
|
|
|
|
|
: ${gitlab_user:=@USER@}
|
|
|
|
: ${gitlab_base:="@GITLAB_BASE@"}
|
|
|
|
: ${rails_env:=production}
|
|
|
|
|
|
|
|
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
|
|
|
|
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
|
|
|
|
: ${sidekiq_queues:="@QUEUES@"}
|
|
|
|
|
|
|
|
sidekiq_command="/usr/bin/bundle"
|
|
|
|
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
|
|
|
|
|
|
|
|
depend() {
|
2015-12-01 12:33:39 +01:00
|
|
|
need redis gitlab-workhorse
|
|
|
|
use net
|
2015-11-23 10:28:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
|
|
|
|
|
|
|
|
ebegin "Starting ${name} - Sidekiq"
|
|
|
|
|
|
|
|
start-stop-daemon --start \
|
|
|
|
--background --quiet \
|
|
|
|
--chdir "${gitlab_base}" \
|
|
|
|
--user=${gitlab_user} \
|
|
|
|
--pidfile="${sidekiq_pidfile}" \
|
|
|
|
--env RAILS_ENV=${rails_env} \
|
|
|
|
--exec ${sidekiq_command} -- ${sidekiq_command_args}
|
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
ebegin "Stopping ${name} - Sidekiq"
|
|
|
|
start-stop-daemon --stop \
|
|
|
|
--pidfile=${sidekiq_pidfile} \
|
|
|
|
--exec ${sidekiq_command}
|
|
|
|
eend $?
|
|
|
|
}
|