added systemd files, not tested!

This commit is contained in:
u203395 2014-11-26 10:59:47 +01:00
parent 797706b731
commit 01c2770e38
4 changed files with 86 additions and 15 deletions

View file

@ -0,0 +1,30 @@
# cat /etc/systemd/system/gitlab-sidekiq.service - for personal use
# cat /var/lib/systemd/system/gitlab-sidekiq.service - for package devs
#####################################################
#
# GitLab version : 5.x - 7.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=GitLab Sidekiq Worker
Requires=redis.service
Wants=mysqld.service postgresql.service
After=redis.service mysqld.service postgresql.service
[Service]
Type=forking
User=git
WorkingDirectory=/opt/gitlab-6
Environment=RAILS_ENV=production
SyslogIdentifier=gitlab-sidekiq
PIDFile=/run/gitlab/sidekiq.pid
ExecStart=/usr/bin/bundle exec "sidekiq -d -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e production -P /run/gitlab/sidekiq.pid -d -L /var/log/gitlab/sidekiq.log >> /var/log/gitlab/sidekiq.log 2>&1"
ExecStop=/usr/bin/bundle exec "sidekiqctl stop /run/gitlab/sidekiq.pid >> /var/log/gitlab/sidekiq.log 2>&1"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,28 @@
# cat /etc/systemd/system/gitlab-unicorn.service - for personal use
# cat /var/lib/systemd/system/gitlab-unicorn.service - for package devs
#####################################################
#
# GitLab version : 5.x - 7.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=GitLab Unicorn Server
Requires=redis.service
Wants=mysqld.service postgresql.service
After=redis.service mysqld.service postgresql.service
[Service]
User=git
WorkingDirectory=/opt/gitlab-6
Environment=RAILS_ENV=production
SyslogIdentifier=gitlab-unicorn
PIDFile=/run/gitlab/unicorn.pid
ExecStart=/usr/bin/bundle exec "unicorn_rails -D -c /opt/gitlab-6/config/unicorn.rb -E production"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,4 @@
# cat /etc/tmpfiles.d/gitlab.conf - for personal use
# cat /usr/lib/tmpfiles.d/gitlab.conf - for package devs
d /run/gitlab 0755 git git

View file

@ -14,7 +14,7 @@ EAPI="5"
USE_RUBY="ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user
inherit eutils python ruby-ng user systemd
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
@ -26,7 +26,7 @@ RESTRICT="mirror"
LICENSE="MIT"
SLOT="6"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres +unicorn"
IUSE="mysql +postgres +unicorn systemd"
## Gems dependencies:
# charlock_holmes dev-libs/icu
@ -53,7 +53,8 @@ DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
@ -201,20 +202,28 @@ all_ruby_install() {
## RC script ##
local rcscript=gitlab-sidekiq.init
use unicorn && rcscript=gitlab-unicorn-6.init
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
local svcfile=gitlab-sidekiq.service
use unicorn && svcfile=gitlab-unicorn.service
systemd_dounit "${FILESDIR}/${svcfile}"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq.init
use unicorn && rcscript=gitlab-unicorn-6.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@GITLAB_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@GITLAB_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}"
newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}"
fi
}
pkg_postinst() {