iwm-overlay/www-apps/gitlabhq/files/gitlab-unicorn.init
Torsten Kurbad 4ff17bc6cb Added gitlabhq ebuilds
git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@31818 cbe59ace-07ea-0310-918e-868702b5370d
2014-11-20 09:36:46 +00:00

65 lines
1.7 KiB
Plaintext

#!/sbin/runscript
name="GitLab"
description="GitLab @SLOT@ on Unicorns"
: ${gitlab_user:=@GIT_USER@}
: ${gitlab_group:=@GIT_GROUP@}
: ${gitlab_home:="@DEST_DIR@"}
: ${server_pidfile:="@DEST_DIR@/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="@DEST_DIR@/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="@LOG_DIR@/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec rake sidekiq:start RAILS_ENV=${rails_env}"
sidekiq_stop_command_args="exec rake sidekiq:stop RAILS_ENV=${rails_env}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab @SLOT@ Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab @SLOT@ Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab @SLOT@ Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab @SLOT@ Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}