diff --git a/www-apps/gitlabhq/files/gitlab-sidekiq.service b/www-apps/gitlabhq/files/gitlab-sidekiq.service new file mode 100644 index 0000000..d62bed0 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlab-sidekiq.service @@ -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 \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlab-unicorn.service b/www-apps/gitlabhq/files/gitlab-unicorn.service new file mode 100644 index 0000000..6dae77a --- /dev/null +++ b/www-apps/gitlabhq/files/gitlab-unicorn.service @@ -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 \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlab.conf b/www-apps/gitlabhq/files/gitlab.conf new file mode 100644 index 0000000..263a0a9 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlab.conf @@ -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 \ No newline at end of file diff --git a/www-apps/gitlabhq/gitlabhq-7.5.1.ebuild b/www-apps/gitlabhq/gitlabhq-7.5.1.ebuild index d184af2..2c78dea 100644 --- a/www-apps/gitlabhq/gitlabhq-7.5.1.ebuild +++ b/www-apps/gitlabhq/gitlabhq-7.5.1.ebuild @@ -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() {