Manuel Friedli
f75090e5da
Add ebuild for gitlab-ce-9.3.5 Package-Manager: Portage-2.3.6, Repoman-2.3.1
64 lines
1.4 KiB
Text
64 lines
1.4 KiB
Text
#!/sbin/openrc-run
|
|
|
|
extra_started_commands="check"
|
|
|
|
name="GitLab Sidekiq"
|
|
description="Sidekiq for GitLab"
|
|
description_check="Runs sanity checks"
|
|
|
|
: ${gitlab_user:=@USER@}
|
|
: ${gitlab_base:="@GITLAB_BASE@"}
|
|
: ${rails_env:=production}
|
|
|
|
: ${sidekiq_pidfile:="/run/gitlab/pids/sidekiq.pid"}
|
|
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
|
|
: ${sidekiq_config:="/etc/gitlab/sidekiq_queues.yml"}
|
|
|
|
sidekiq_command="/usr/bin/bundle"
|
|
sidekiq_command_args="exec sidekiq -C ${sidekiq_config} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
|
|
|
|
check_command="sudo -u ${gitlab_user} -H /usr/bin/bundle"
|
|
check_command_args1="exec rake gitlab:env:info RAILS_ENV=${rails_env}"
|
|
check_command_args2="exec rake gitlab:check RAILS_ENV=${rails_env}"
|
|
|
|
depend() {
|
|
need redis gitlab-workhorse
|
|
use net
|
|
}
|
|
|
|
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 $?
|
|
}
|
|
|
|
check() {
|
|
ebegin "Running sanity checks for ${name}"
|
|
|
|
cd /opt/gitlab
|
|
|
|
${check_command} ${check_command_args1}
|
|
|
|
eend $?
|
|
|
|
${check_command} ${check_command_args2}
|
|
|
|
eend $?
|
|
}
|