commit: 6fa3a823e5233da2243253a93fc1ab9c4ee12f95 Author: Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com> AuthorDate: Sun Oct 8 19:23:51 2017 +0000 Commit: Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com> CommitDate: Sun Oct 8 19:23:51 2017 +0000 URL: https://gitweb.gentoo.org/repo/user/ssnb.git/commit/?id=6fa3a823
add gitlabhq update and gpustat with eclass for pypi dev-python/gpustat/Manifest | 2 + dev-python/gpustat/gpustat-0.3.2.ebuild | 19 + dev-python/gpustat/metadata.xml | 9 + eclass/g-sorcery.eclass | 49 ++ eclass/gs-pypi.eclass | 15 + www-apps/gitlabhq/Manifest | 9 + .../files/gitlabhq-10.0-fix-checks-gentoo.patch | 11 + .../files/gitlabhq-10.0-fix-sendmail-param.patch | 17 + .../gitlabhq/files/gitlabhq-10.0-mailroom.service | 28 ++ .../gitlabhq/files/gitlabhq-10.0-sidekiq.service | 28 ++ .../gitlabhq/files/gitlabhq-10.0-tmpfiles.conf | 1 + .../gitlabhq/files/gitlabhq-10.0-unicorn.service | 25 + .../gitlabhq/files/gitlabhq-10.0-workhorse.service | 25 + www-apps/gitlabhq/files/gitlabhq-10.0.init | 115 +++++ www-apps/gitlabhq/gitlabhq-10.0.3.ebuild | 556 +++++++++++++++++++++ 15 files changed, 909 insertions(+) diff --git a/dev-python/gpustat/Manifest b/dev-python/gpustat/Manifest new file mode 100644 index 0000000..205c587 --- /dev/null +++ b/dev-python/gpustat/Manifest @@ -0,0 +1,2 @@ +EBUILD gpustat-0.3.2.ebuild 418 SHA256 50cf979d793a542f673c7f23720d2b0e3abe6eeb970f7b512bdc95f2645e8f0e SHA512 36b3f5e4a5476af2a16db3d71ed9aef9b79b2f6ba356751498591cb89196cc3c103a08c998c7b37a849c93ae385c0928d048c462e99da089282fb40a99cad01f WHIRLPOOL 93752b27c693a9b9a6187689d201df51f92222e17a322c76541904887dfa9f3c3ccccbdc284c5865be075bd2960c8c27328d898684ffc1bcbc98288caa194e6e +MISC metadata.xml 375 SHA256 7f39d26cca0cfca2d0ed0d07e216c86ca45accbcc3e4ed692b60bd8340ed1bb4 SHA512 5d438dc2357434f7517738218ebba0ea582e8515921e496cb23ae3ea635c358e4bb40bdbbd5fbb292bb7a203eac58ccc9f832cc57462aa7fbc85b049f16d9b8c WHIRLPOOL 9630fc52ed7634fd93dce66f0b0998b34f51b427d03934b55949ad10c279401d10e4acbe7b15b598548484cb079087ae95f26b3298f170a2df8b2394663f8750 diff --git a/dev-python/gpustat/gpustat-0.3.2.ebuild b/dev-python/gpustat/gpustat-0.3.2.ebuild new file mode 100644 index 0000000..99b58e6 --- /dev/null +++ b/dev-python/gpustat/gpustat-0.3.2.ebuild @@ -0,0 +1,19 @@ +# automatically generated by g-sorcery +# please do not edit this file + +EAPI=6 + +REPO_URI="https://pypi.python.org/packages/cb/dd/5e58cf3c1413d2e316827e719ccf97a9d1fb738f57e73d647c7d7f130655/" +SOURCEFILE="${P}.tar.gz" +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) + +inherit gs-pypi + +DESCRIPTION="GPU-based statistical functions" + +HOMEPAGE="https://github.com/wookayin/gpustat" +LICENSE="MIT" + +SLOT="0" +KEYWORDS="~amd64 ~x86" + diff --git a/dev-python/gpustat/metadata.xml b/dev-python/gpustat/metadata.xml new file mode 100644 index 0000000..a53cfd8 --- /dev/null +++ b/dev-python/gpustat/metadata.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>samuelbernardo.m...@gmail.com</email> + <name>Samuel Bernardo</name> + </maintainer> + <longdescription>A simple command-line script (wrapper for nvidia-smi) for querying and monitoring GPU status</longdescription> +</pkgmetadata> diff --git a/eclass/g-sorcery.eclass b/eclass/g-sorcery.eclass new file mode 100644 index 0000000..338dc83 --- /dev/null +++ b/eclass/g-sorcery.eclass @@ -0,0 +1,49 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ +# automatically generated by g-sorcery +# please do not edit this file +# +# Original Author: Jauhien Piatlicki <piatli...@gmail.com> +# Purpose: base routines for g-sorcery backends' eclasses +# +# Bugs to piatli...@gmail.com +# +# @ECLASS: g-sorcery.eclass +# +# @ECLASS-VARIABLE: REPO_URI +# @DESCRIPTION: address of a repository with sources +# +# @ECLASS-VARIABLE: DIGEST_SOURCES +# @DESCRIPTION: whether manifest for sources exists +# +# @ECLASS-VARIABLE: SOURCEFILE +# @DESCRIPTION: source file name +# +# @ECLASS-VARIABLE: GSORCERY_STORE_DIR +# @DESCRIPTION: store location for downloaded sources +GSORCERY_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" +# +# @ECLASS-VARIABLE: GSORCERY_FETCH_CMD +# @DESCRIPTION: fetch command +GSORCERY_FETCH_CMD="wget" + +EXPORT_FUNCTIONS src_unpack + +g-sorcery_fetch() { + addwrite "${GSORCERY_STORE_DIR}" + pushd "${GSORCERY_STORE_DIR}" >/dev/null || die "can't chdir to ${GSORCERY_STORE_DIR}" + if [[ ! -f "${SOURCEFILE}" ]]; then + $GSORCERY_FETCH_CMD ${REPO_URI}${SOURCEFILE} || die + fi + popd >/dev/null || die +} + +g-sorcery_src_unpack() { + if [[ x${DIGEST_SOURCES} = x ]]; then + g-sorcery_fetch + fi + + cp ${GSORCERY_STORE_DIR}/${SOURCEFILE} . || die + unpack ./${SOURCEFILE} +} \ No newline at end of file diff --git a/eclass/gs-pypi.eclass b/eclass/gs-pypi.eclass new file mode 100644 index 0000000..ddccd7c --- /dev/null +++ b/eclass/gs-pypi.eclass @@ -0,0 +1,15 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ +# automatically generated by gs-pypi +# please do not edit this file +# +# Original Author: Jauhien Piatlicki <jauh...@gentoo.org> +# Purpose: support installation of python packages from PyPI repo +# +# Bugs to jauh...@gentoo.org +# +# @ECLASS: gs-pypi.eclass +# + +inherit distutils-r1 g-sorcery \ No newline at end of file diff --git a/www-apps/gitlabhq/Manifest b/www-apps/gitlabhq/Manifest index 16f0762..f7707cc 100644 --- a/www-apps/gitlabhq/Manifest +++ b/www-apps/gitlabhq/Manifest @@ -1,5 +1,13 @@ AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214 AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee +AUX gitlabhq-10.0-fix-checks-gentoo.patch 576 SHA256 c391db8dc1edd4724c4014c370a5578ff39347ef0a2e95b91b25123d977158b0 SHA512 47a11c350e297c831540de36c84b350b142e48dd05451642b5261eb2059cd12e8288b2e9e27fc2050e9b5d65beaeafa903f8e1457a41131ca602687d3f95ce94 WHIRLPOOL 58dd6867684e037750af3b7cd016933c82e04c04f34ee3a82c505254159687205a71f6d6c205215c2db3fe74fd2f9dcffc00cb20b67970778e04c234cb05e6ef +AUX gitlabhq-10.0-fix-sendmail-param.patch 617 SHA256 c0b6db990f5b0fd0c588f2e35eb3aac54ce54d9b41b350e7bcd54336cdc19462 SHA512 4234563b2d8eb5814fd8d9910a50fb867e444052639feebb192bb105471eae9038a076a5288b14e3fbb997311824853bea9d9c4833b4854b7f0252b826f22358 WHIRLPOOL 06f19a23028a6b83dd6ff2f9ec406af5e5f5e2c0a5879ab66585ce7b3d070170e29407c2ab9915c4afb75a23038e178295213db99ac514d865f4c1db57b22774 +AUX gitlabhq-10.0-mailroom.service 823 SHA256 352c7f98ff6d0f8f221083d69cce1f64c4abf4a037eeccc1e4078970231966fa SHA512 7beb1a7c55610c671b709f56d9f4df8cebbd7fc81dc8a7af18666d46a0f2d4cc3c0b24a6fc5e8b41f0e2de86fb22a28b1a3702243e26aae4426ffa588f7f5a0b WHIRLPOOL 92bd3bf102bc4c657b605b45e2564920d229a2819ad2069b4f4a67d1cbf20647dbccf9026dc15d1e4d052a48167422fd969c0b2c003f6d4557a20b34a5507140 +AUX gitlabhq-10.0-sidekiq.service 1056 SHA256 4c90ac82a415b437fbe30116b0c709fdff1d7589b3e5364f4e6c6c10dca67b3f SHA512 b41a0ab0517426b2433c8bb085983617bc71bc00d405eab040ceb469f0cb448c2ca5fcc7efe545e769b5a3ad73d0d4173187699e3a17045f3fcca772633f0d20 WHIRLPOOL 4bb7a3b0f1bb83f5364b00bca62c53015611f5ee397a1d2cb3259c48c2316bcba2d3fda348fdb5dd9e8bbc6611e13c0de99aa2eccdd3b171333bad2fa9fd1e85 +AUX gitlabhq-10.0-tmpfiles.conf 43 SHA256 eabee99b2408717c7e246162f531e2d9e6422a06a0751626a9eb3983d41d234b SHA512 e1a4baff93a648166574b34750e889840ffddf56bcc8d2aaa4e11f1a94ae0618ee54716fcbabcfad27c8a539fdf8fb2681e9a6dbe749ba16d9207c4045e73796 WHIRLPOOL 239693111215cb685980bf1bbbf8473c84965f736d60bc022fc24692075c5e5ecf49f7cd4f395f703bc1de59cb84454fa1c98017e4c50cf83c3f67ab01015691 +AUX gitlabhq-10.0-unicorn.service 817 SHA256 de014afb92dfafb58e00c507a5ac9597160569ea8408540b38eb603a192391e8 SHA512 57b1f5ec8224edcf3cbb0038fc62df3a3b6a1cf9d5436e5632bd998318c6f615722b012408d0db3013e34c4f44dc866a3d471af88666d55caa18e0e4bd056512 WHIRLPOOL 857e48495f1b80e409146eab07cff35414222c0a9bffab10ad1da85b838af5ee8d16501e5b9a5e4f5f493b4b3bf69d0c084d7b7cc45eb00c7434da77b9edbcb9 +AUX gitlabhq-10.0-workhorse.service 1104 SHA256 991f990390715c895fe4c12df6def03ab2a03120b9a2cc6f89e0e70560cbbd7d SHA512 e4dd8e39001ae07857a8d87e82eca105a0cfbf87f7dc341227e19dd80b6bdddf308f5bba79d5d5bc87f935d86b5435af94c1f6d8c829d45d17f31b776fa5b057 WHIRLPOOL 263e5a710519a611772c6d4f036e8794c474eb27b5009bda8a38fe3932a13fa1f0a29fb72a9aebe85d3b9ec6f9347501f4bcffac80d206f25b8224e50024c9b0 +AUX gitlabhq-10.0.init 3989 SHA256 544ed91c18c3fe658defd47eb82dab5ce52eb968b7bc6e8ae800ccada6eb5c8f SHA512 451d3a8c3f4cd8bea624066fd8ff3655bb343531bc297ac7b1df2ebcc21bc36bd29c084797e2f14788c701a2fc7178098fadbb4730ce9fdc9e9bbfcaef839029 WHIRLPOOL 92cfe0cdd161db5d36240706234561b8336feaba5202cd12fc7e07ff0a433e1a35651e78a9520792dc49ea1c8aa39474a54176cab95bc5a26718d45ce97925b6 AUX gitlabhq-8.14-fix-checks-gentoo.patch 390 SHA256 60324945dfff6d236faf7959a75089a782018b048ba1cb846b91e14109673236 SHA512 0ac979616639fdd9b9534c9e7c0ad3263f39fa10e6858a6c8cf401a3234d5ef20201fd97e2a5a39071dcf98fb7ca7a48b41d18db7689103e996baf65ae9f00ea WHIRLPOOL 98c46a4b4bafeb870425f437506b202c0c836b4df8763a3716d2cf21da73b04ffd0c31a6222317cf22e550a7676b463771038b595c1b2f9d491955dd0a82885a AUX gitlabhq-8.14-fix-sendmail-param.patch 617 SHA256 685ad4c2307477b6f389db9b37048beb63af5a556669859d48d137c7b8b3687a SHA512 092aedb88d892d086128d76a0442ba81dc1b2e573322c7f33fad00a1b56dd035f596de82568463043fcfd02e4e30a81b6d42f83a2052144d133c5edffaa8edd1 WHIRLPOOL 61aaa2c1d8b8476f24f34257d29ac482dc38e503560a71de5511c62f1c86aa1ca3cec67272c2db42df36c6cc80688b6f1b60f0de7bb23e71f7daabf9746f70a7 AUX gitlabhq-8.14.init 2987 SHA256 37d01155d681a17cb669ffbd8e32d127a79f0fbc3864f941e5444efcd2114859 SHA512 e5395f6ff8e3e65ee8a856d93cdfa6a3c063f0cc160c2e86ced93d6d62430ee9b841ee20e902b8c49843d3c737b2f690b0478ff190bbf107692a4bb12cb090f5 WHIRLPOOL 1bee9675ca1856efd5b1587b64b5ba3a26df340ad9044a4b3d239bec00e24d931e48083c7a4dee60bd5082c9b580ecd5d251ff1f1987e094e4cb2bc15af8a237 @@ -9,3 +17,4 @@ AUX gitlabhq-8.15.init 2987 SHA256 f72b2d23034a29c958d661feb9f608e138ab65e70a629 AUX gitlabhq-8.16-fix-checks-gentoo.patch 390 SHA256 60324945dfff6d236faf7959a75089a782018b048ba1cb846b91e14109673236 SHA512 0ac979616639fdd9b9534c9e7c0ad3263f39fa10e6858a6c8cf401a3234d5ef20201fd97e2a5a39071dcf98fb7ca7a48b41d18db7689103e996baf65ae9f00ea WHIRLPOOL 98c46a4b4bafeb870425f437506b202c0c836b4df8763a3716d2cf21da73b04ffd0c31a6222317cf22e550a7676b463771038b595c1b2f9d491955dd0a82885a AUX gitlabhq-8.16-fix-sendmail-param.patch 617 SHA256 c0b6db990f5b0fd0c588f2e35eb3aac54ce54d9b41b350e7bcd54336cdc19462 SHA512 4234563b2d8eb5814fd8d9910a50fb867e444052639feebb192bb105471eae9038a076a5288b14e3fbb997311824853bea9d9c4833b4854b7f0252b826f22358 WHIRLPOOL 06f19a23028a6b83dd6ff2f9ec406af5e5f5e2c0a5879ab66585ce7b3d070170e29407c2ab9915c4afb75a23038e178295213db99ac514d865f4c1db57b22774 AUX gitlabhq-8.16.init 2987 SHA256 d8788979fec8a05c241fc692d586537e4715c7894b5d70fd471a701913f19166 SHA512 16922aa485c99c4e30def0fed80ce883ac2786b9714070f84b09c019314deb513b8bfba8906ff67548738c0a039996e000a730bc6ad682fac5b979ebf0132c31 WHIRLPOOL dae5bfa2c77df41afe8b60634f91661dcd48ea7bbcce81fce361d7b4e8117011008f995393a8c6401ba9601c18ba94bd0a60fe5d5ad5a7d5d45b317ca8bf5ab3 +EBUILD gitlabhq-10.0.3.ebuild 19226 SHA256 78e9e0c9d23685e78c42a27c118322e28ea462b0fa13f494c4dd599eff7921ec SHA512 661f95a3e57cf49276b1241c98f164ba224f1d97e574a3ff390a919e5b560f9f8175758e3b4ac993f7bf54cc01c1c38cc2e7bd8171c841051a38482f870369ff WHIRLPOOL aee47a5504f23d17becd243ea3232bd8aae6ef077c6a6fa9dcf187ae2bfc86c28090732db27443e02b4a5f87b4dd3c52aab9166d006734331c62f9b1957b68f5 diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-fix-checks-gentoo.patch b/www-apps/gitlabhq/files/gitlabhq-10.0-fix-checks-gentoo.patch new file mode 100644 index 0000000..61e5979 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-fix-checks-gentoo.patch @@ -0,0 +1,11 @@ +--- lib/tasks/gitlab/check.rake.orig 2017-07-03 11:26:11.483241898 +0200 ++++ lib/tasks/gitlab/check.rake 2017-07-03 11:26:30.189242167 +0200 +@@ -27,8 +27,6 @@ + SystemCheck::App::UploadsDirectoryExistsCheck, + SystemCheck::App::UploadsPathPermissionCheck, + SystemCheck::App::UploadsPathTmpPermissionCheck, +- SystemCheck::App::InitScriptExistsCheck, +- SystemCheck::App::InitScriptUpToDateCheck, + SystemCheck::App::ProjectsHaveNamespaceCheck, + SystemCheck::App::RedisVersionCheck, + SystemCheck::App::RubyVersionCheck, diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-fix-sendmail-param.patch b/www-apps/gitlabhq/files/gitlabhq-10.0-fix-sendmail-param.patch new file mode 100644 index 0000000..d905fe9 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-fix-sendmail-param.patch @@ -0,0 +1,17 @@ +--- gitlabhq-8.7.5/config/environments/production.rb.orig 2016-05-20 17:01:56.043486847 +0200 ++++ gitlabhq-8.7.5/config/environments/production.rb 2016-05-20 17:02:35.8.1696032 +0200 +@@ -70,10 +70,10 @@ + + config.action_mailer.delivery_method = :sendmail + # Defaults to: +- # # config.action_mailer.sendmail_settings = { +- # # location: '/usr/sbin/sendmail', +- # # arguments: '-i -t' +- # # } ++ config.action_mailer.sendmail_settings = { ++ location: '/usr/sbin/sendmail', ++ arguments: '-i' ++ } + config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = true + diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-mailroom.service b/www-apps/gitlabhq/files/gitlabhq-10.0-mailroom.service new file mode 100644 index 0000000..226c6fb --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-mailroom.service @@ -0,0 +1,28 @@ +##################################################### +# +# GitLab version : 8.x - 8.x +# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp), firelizzard +# Originally from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd +# +#################################################### + +[Unit] +Description=Gitlab mailroom Worker +Requires=gitlab-unicorn.service +Wants=gitlab-unicorn.service +After=gitlab-unicorn.service + +[Service] +User=git +Environment=RAILS_ENV=production +WorkingDirectory=/opt/gitlabhq-10.0 +SyslogIdentifier=gitlab-mailroom +PIDFile=/opt/gitlabhq-10.0/tmp/pids/gitlab-mailroom.pid +Type=oneshot +RemainAfterExit=yes + +ExecStart=/opt/gitlabhq-10.0/bin/mail_room start +ExecStop=/opt/gitlabhq-10.0/bin/mail_room stop + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-sidekiq.service b/www-apps/gitlabhq/files/gitlabhq-10.0-sidekiq.service new file mode 100644 index 0000000..efc7a9d --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-sidekiq.service @@ -0,0 +1,28 @@ +##################################################### +# +# GitLab version : 5.x - 7.x +# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp), firelizzard +# Originally from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd +# +#################################################### + +[Unit] +Description=GitLab Sidekiq Worker +Requires=redis.service gitlab-tmpdir.service +Wants=postgresql-10.0.service +After=redis.service postgresql-10.0.service + +[Service] +Type=forking +User=git +WorkingDirectory=/opt/gitlabhq-10.0 +Environment=RAILS_ENV=production +SyslogIdentifier=gitlab-sidekiq +PIDFile=/opt/gitlabhq-10.0/tmp/pids/sidekiq.pid +RuntimeDirectory=/var/tmp/gitlabhq-10.0 + +ExecStart=/usr/bin/bundle exec "sidekiq -C config/sidekiq_queues.yml -c 5 -e production -P tmp/pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1" +ExecStop=/usr/bin/bundle exec "sidekiqctl stop /opt/gitlabhq-10.0/tmp/pids/sidekiq.pid >> /opt/gitlabhq-10.0/log/sidekiq.log 2>&1" + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-tmpfiles.conf b/www-apps/gitlabhq/files/gitlabhq-10.0-tmpfiles.conf new file mode 100644 index 0000000..babdc80 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-tmpfiles.conf @@ -0,0 +1 @@ +d /var/tmp/gitlabhq-10.0/pids 0755 git git diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-unicorn.service b/www-apps/gitlabhq/files/gitlabhq-10.0-unicorn.service new file mode 100644 index 0000000..be930f7 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-unicorn.service @@ -0,0 +1,25 @@ +##################################################### +# +# GitLab version : 5.x - 7.x +# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp), firelizzard +# Originally from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd +# +#################################################### + +[Unit] +Description=GitLab Unicorn Server +Requires=redis.service gitlab-tmpdir.service +Wants=postgresql-10.0.service +After=redis.service postgresql-10.0.service + +[Service] +User=git +WorkingDirectory=/opt/gitlabhq-10.0 +Environment=RAILS_ENV=production +SyslogIdentifier=gitlab-unicorn +PIDFile=/opt/gitlabhq-10.0/tmp/pids/unicorn.pid + +ExecStart=/usr/bin/bundle exec "unicorn_rails -D -c /opt/gitlabhq-10.0/config/unicorn.rb -E production" + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0-workhorse.service b/www-apps/gitlabhq/files/gitlabhq-10.0-workhorse.service new file mode 100644 index 0000000..2e6346e --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0-workhorse.service @@ -0,0 +1,25 @@ +##################################################### +# +# GitLab version : 8.2 - 8.x +# Contributors : bjorn-oivind +# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd +# +#################################################### + +[Unit] +Description=Gitlab Workhorse handles slow HTTP requests for Gitlab. +Requires=gitlab-unicorn.service +Wants=gitlab-unicorn.service +After=gitlab-unicorn.service + +[Service] +Type=forking +User=git +WorkingDirectory=/opt/gitlabhq-10.0 +SyslogIdentifier=gitlab-workhorse +PIDFile=/opt/gitlabhq-10.0/tmp/pids/gitlab-workhorse.pid + +ExecStart=/opt/gitlabhq-10.0/bin/daemon_with_pidfile /opt/gitlabhq-10.0/tmp/pids/gitlab-workhorse.pid /usr/bin/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /opt/gitlabhq-10.0/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket /opt/gitlabhq-10.0/tmp/sockets/gitlab.socket -secretPath /opt/gitlabhq-10.0/.gitlab_workhorse_secret -documentRoot /opt/gitlabhq-10.0/public >> /opt/gitlabhq-10.0/log/gitlab-workhorse.log 2>&1 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/www-apps/gitlabhq/files/gitlabhq-10.0.init b/www-apps/gitlabhq/files/gitlabhq-10.0.init new file mode 100644 index 0000000..53bea87 --- /dev/null +++ b/www-apps/gitlabhq/files/gitlabhq-10.0.init @@ -0,0 +1,115 @@ +#!/sbin/openrc-run + +name="GitLab" +description="GitLab 10.0 on Unicorns" + +: ${rails_env:=production} + +: ${gitlab_user:=git} +: ${gitlab_group:=git} +: ${gitlab_home:="/opt/gitlabhq-10.0"} +: ${gitlab_log:="/var/log/gitlabhq-10.0"} + +: ${unicorn_pidfile:="${gitlab_home}/tmp/pids/unicorn.pid"} +: ${unicorn_log:="${gitlab_log}/unicorn.log"} +: ${unicorn_socket:="${gitlab_home}/tmp/sockets/gitlab.socket"} +: ${unicorn_command:="/usr/bin/bundle"} +: ${unicorn_command_args:="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"} + +: ${sidekiq_pidfile:="${gitlab_home}/tmp/pids/sidekiq.pid"} +: ${sidekiq_log:="${gitlab_log}/sidekiq.log"} +: ${sidekiq_config:="${gitlab_home}/config/sidekiq_queues.yml"} +: ${sidekiq_command:="/usr/bin/bundle"} +: ${sidekiq_start_command_args:="exec sidekiq -C ${sidekiq_config} -e ${rails_env} -d -P ${sidekiq_pidfile} -L ${sidekiq_log} $@ >> ${sidekiq_log} 2>&1"} +: ${sidekiq_stop_command_args:="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"} + +: ${workhorse_pidfile:="${gitlab_home}/tmp/pids/workhorse.pid"} +: ${workhorse_log:="${gitlab_log}/workhorse.log"} +: ${workhorse_socket:="${gitlab_home}/tmp/sockets/gitlab-workhorse.socket"} +: ${workhorse_command:="/usr/bin/gitlab-workhorse"} +: ${workhorse_command_args="-listenUmask 0 -listenNetwork unix -listenAddr ${workhorse_socket} -authBackend http://127.0.0.1:8080 -documentRoot ${gitlab_home}/public -authSocket ${unicorn_socket}"} + +: ${gitaly_command:=/usr/bin/gitlab-gitaly} +: ${gitaly_command_args:="/etc/gitaly/config.toml"} +: ${gitaly_pidfile:="${gitlab_home}/tmp/pids/gitaly.pid"} +: ${gitaly_log:="${gitlab_log}/gitaly.log"} +: ${gitaly_socket:="${gitlab_home}/tmp/sockets/gitaly.socket"} + + +if [ ${rails_env} = development ]; then + sidekiq_command_args+=" VVERBOSE=1" +fi + +depend() { + provide gitlab + need redis + use net mysql postgresql +} + +start() { + + checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${unicorn_pidfile}")" + checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")" + + ebegin "Starting GitLab 10.0 Unicorn servers" + start-stop-daemon --start \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${unicorn_pidfile}" \ + --exec ${unicorn_command} -- ${unicorn_command_args} + eend $? + + ebegin "Starting GitLab 10.0 Sidekiq" + cd "${gitlab_home}" + sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args} + eend $? + + ebegin "Starting GitLab 10.0 Workhorse" + start-stop-daemon --start \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${workhorse_pidfile}" \ + --make-pidfile \ + --background -1 "${workhorse_log}" -2 "${workhorse_log}" \ + --exec ${workhorse_command} -- ${workhorse_command_args} + eend $? + + ebegin "Starting GitLab 10.0 Gitaly" + start-stop-daemon --start \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${gitaly_pidfile}" \ + --make-pidfile \ + --env GITALY_SOCKET_PATH=${gitaly_socket} \ + --background -1 "${gitaly_log}" -2 "${gitaly_log}" \ + --exec ${gitaly_command} -- ${gitaly_command_args} + eend $? +} + +stop() { + ebegin "Stopping GitLab 10.0 Gitaly" + start-stop-daemon --stop \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${gitaly_pidfile}" + eend $? + + ebegin "Stopping GitLab 10.0 Workhorse" + start-stop-daemon --stop \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${workhorse_pidfile}" + eend $? + + ebegin "Stopping GitLab 10.0 Sidekiq" + cd "${gitlab_home}" + sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args} + eend $? + + ebegin "Stopping GitLab 10.0 Unicorn servers" + start-stop-daemon --stop \ + --chdir "${gitlab_home}" \ + --user="${gitlab_user}:${gitlab_group}" \ + --pidfile="${unicorn_pidfile}" + eend $? +} diff --git a/www-apps/gitlabhq/gitlabhq-10.0.3.ebuild b/www-apps/gitlabhq/gitlabhq-10.0.3.ebuild new file mode 100644 index 0000000..8570363 --- /dev/null +++ b/www-apps/gitlabhq/gitlabhq-10.0.3.ebuild @@ -0,0 +1,556 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="5" + +# Mainteiner notes: +# - This ebuild uses Bundler to download and install all gems in deployment mode +# (i.e. into isolated directory inside application). That's not Gentoo way how +# it should be done, but GitLab has too many dependencies that it will be too +# difficult to maintain them via ebuilds. + +USE_RUBY="ruby23" +PYTHON_COMPAT=( python2_7 ) + +EGIT_REPO_URI="https://gitlab.com/gitlab-org/gitlab-ce.git" +EGIT_COMMIT="v${PV}" + +inherit eutils git-2 python-r1 ruby-ng versionator user linux-info systemd + +DESCRIPTION="GitLab is a free project and repository management application" +HOMEPAGE="https://about.gitlab.com/gitlab-ci/" + +LICENSE="MIT" +RESTRICT="splitdebug" +SLOT=$(get_version_component_range 1-2) +KEYWORDS="~amd64 ~x86" +IUSE="memcached mysql +postgres +unicorn" + +## Gems dependencies: +# charlock_holmes dev-libs/icu +# grape, capybara dev-libs/libxml2, dev-libs/libxslt +# json dev-util/ragel +# yajl-ruby dev-libs/yajl +# pygments.rb python 2.5+ +# execjs net-libs/nodejs, or any other JS runtime +# pg dev-db/postgresql-base +# mysql virtual/mysql +# rugged net-libs/http-parser dev-libs/libgit2 +# +GEMS_DEPEND=" + dev-libs/icu + dev-libs/libxml2 + dev-libs/libxslt + dev-util/ragel + dev-libs/yajl + net-libs/nodejs + postgres? ( dev-db/postgresql ) + mysql? ( virtual/mysql ) + memcached? ( net-misc/memcached ) + net-libs/http-parser" +DEPEND="${GEMS_DEPEND} + >=dev-lang/ruby-2.3[readline,ssl] + >dev-vcs/git-2.2.1 + >=dev-vcs/gitlab-shell-5.9.0 + >=dev-vcs/gitlab-gitaly-0.38.0 + >=www-servers/gitlab-workhorse-3.0.0 + app-eselect/eselect-gitlabhq + net-misc/curl + virtual/ssh + >=sys-apps/yarn-0.27.5 + >=net-libs/nodejs-7.0.0 + dev-libs/re2" +RDEPEND="${DEPEND} + >=dev-db/redis-2.8.0 + virtual/mta + virtual/krb5" +ruby_add_bdepend " + virtual/rubygems + >=dev-ruby/bundler-1.0" + +RUBY_PATCHES=( + "${PN}-${SLOT}-fix-checks-gentoo.patch" + "${PN}-${SLOT}-fix-sendmail-param.patch" +) + +GIT_USER="git" +GIT_GROUP="git" +GIT_HOME="/var/lib/git" +DEST_DIR="/opt/${PN}-${SLOT}" +CONF_DIR="/etc/${PN}-${SLOT}" + +GIT_REPOS="${GIT_HOME}/repositories" +GIT_SATELLITES="${GIT_HOME}/gitlab-satellites" +GITLAB_SHELL="/var/lib/gitlab-shell" +GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks" + +RAILS_ENV=${RAILS_ENV:-production} +RUBY=${RUBY:-ruby23} +BUNDLE="${RUBY} /usr/bin/bundle" + +pkg_setup() { + enewgroup ${GIT_GROUP} + enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "${GIT_GROUP}" +} + +all_ruby_unpack() { + git-2_src_unpack +} + +each_ruby_prepare() { + + # fix path to repo and gitlab-shell hooks + test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"? + + sed -i \ + -e "s|\(\s*path:\s\)/.*/gitlab-shell/|\1 ${GITLAB_SHELL}/|" \ + -e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \ + -e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \ + -e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \ + -e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \ + -e "s|# socket_path: tmp/sockets/private/gitaly\.socket|socket_path: tmp/sockets/gitaly.socket|" \ + config/gitlab.yml.example || die "failed to filter gitlab.yml.example" + + # modify database settings + sed -i \ + -e 's|\(username:\) postgres.*|\1 gitlab|' \ + -e 's|\(password:\).*|\1 gitlab|' \ + -e 's|\(socket:\).*|/run/postgresql/.s.PGSQL.5432|' \ + config/database.yml.postgresql \ + || die "failed to filter database.yml.postgresql" + + # replace "secret" token with random one + local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128) + sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \ + config/initializers/secret_token.rb \ + || die "failed to filter secret_token.rb" + + # remove needless files + rm .foreman .gitignore Procfile + use unicorn || rm config/unicorn.rb.example + use postgres || rm config/database.yml.postgresql + use mysql || rm config/database.yml.mysql + + # change cache_store + if use memcached; then + sed -i \ + -e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \ + config/environments/production.rb \ + || die "failed to modify production.rb" + fi + + # Update pathes for unicorn + if use unicorn; then + sed -i \ + -e "s#/home/git/gitlab#${DEST_DIR}#" \ + config/unicorn.rb.example \ + || die "failed to modify unicorn.rb.example" + fi +} + +src_install() { + # DO NOT REMOVE - without this, the package won't install + ruby-ng_src_install + + elog "Installing systemd unit files" + systemd_dounit "${FILESDIR}/${PN}-${SLOT}-mailroom.service" + systemd_dounit "${FILESDIR}/${PN}-${SLOT}-sidekiq.service" + systemd_dounit "${FILESDIR}/${PN}-${SLOT}-unicorn.service" + systemd_dounit "${FILESDIR}/${PN}-${SLOT}-workhorse.service" + systemd_dotmpfilesd "${FILESDIR}/${PN}-${SLOT}-tmpfiles.conf" +} + +each_ruby_install() { + local dest="${DEST_DIR}" + local conf="/etc/${PN}-${SLOT}" + local temp="/var/tmp/${PN}-${SLOT}" + local logs="/var/log/${PN}-${SLOT}" + local uploads="${DEST_DIR}/public/uploads" + + ## Prepare directories ## + + diropts -m750 + keepdir "${logs}" + dodir "${temp}" + + diropts -m755 + dodir "${dest}" + dodir "${uploads}" + + dosym "${temp}" "${dest}/tmp" + dosym "${logs}" "${dest}/log" + + ## Link gitlab-shell into git home + dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell" + + ## Install configs ## + + # Note that we cannot install the config to /etc and symlink + # it to ${dest} since require_relative in config/application.rb + # seems to get confused by symlinks. So let's install the config + # to ${dest} and create a smylink to /etc/gitlabhq-<VERSION> + dosym "${dest}/config" "${conf}" + + insinto "${dest}/.ssh" + newins "${FILESDIR}/config.ssh" config + + echo "export RAILS_ENV=production" > "${D}/${dest}/.profile" + + ## Install all others ## + + # remove needless dirs + rm -Rf tmp log + + insinto "${dest}" + doins -r ./ + + ## Install logrotate config ## + + dodir /etc/logrotate.d + sed -e "s|@LOG_DIR@|${logs}|" \ + "${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \ + || die "failed to filter gitlab.logrotate" + + ## Install gems via bundler ## + + cd "${D}/${dest}" + + local without="development test thin" + local flag; for flag in memcached mysql postgres unicorn; do + without+="$(use $flag || echo ' '$flag)" + done + local bundle_args="--deployment ${without:+--without ${without}}" + + # Use systemlibs for nokogiri as suggested + ${BUNDLE} config build.nokogiri --use-system-libraries + + # Fix invalid ldflags for charlock_holmes, + # see https://github.com/brianmario/charlock_holmes/issues/32 + ${BUNDLE} config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc' + + einfo "Running bundle install ${bundle_args} ..." + ${BUNDLE} install ${bundle_args} || die "bundler failed" + + ## Clean ## + + local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version') + + # remove gems cache + rm -Rf ${gemsdir}/cache + + # fix permissions + fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}" + fperms o+Xr "${temp}" # Let nginx access the unicorn socket + + ## RC scripts ## + local rcscript=${PN}-${SLOT}.init + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@GIT_USER@|${GIT_USER}|" \ + -e "s|@GIT_GROUP@|${GIT_USER}|" \ + -e "s|@SLOT@|${SLOT}|" \ + -e "s|@DEST_DIR@|${dest}|" \ + -e "s|@LOG_DIR@|${logs}|" \ + -e "s|@RESQUE_QUEUE@|${resque_queue}|" \ + "${T}/${rcscript}" \ + || die "failed to filter ${rcscript}" + + if use memcached; then + sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \ + "${T}/${rcscript}" || die "failed to filter ${rcscript}" + fi + + newinitd "${T}/${rcscript}" "${PN}-${SLOT}" +} + +pkg_preinst() { + diropts -m "0750" -o "${GIT_USER}" -g "${GIT_GROUP}" + dodir "${GIT_SATELLITES}" +} + +pkg_postinst() { + if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then + einfo "Generating SSH key for git user" + su -l ${GIT_USER} -s /bin/sh -c " + ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \ + || die "failed to generate SSH key" + fi + if [ ! -e "${GIT_HOME}/.gitconfig" ]; then + einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to " + einfo "modify this file according to your needs!" + su -l ${GIT_USER} -s /bin/sh -c " + git config --global core.autocrlf 'input'; + git config --global gc.auto 0; + git config --global user.email 'gitlab@localhost'; + git config --global user.name 'GitLab' + git config --global repack.writeBitmaps true" \ + || die "failed to setup git configuration" + fi + + elog "If this is a new installation, proceed with the following steps:" + elog + elog " 1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml" + elog " and edit this file in order to configure your GitLab settings." + elog + elog " 2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml" + elog " and edit this file in order to configure your database settings" + elog " for \"production\" environment." + elog + elog " 3. Copy ${CONF_DIR}/initializers/rack_attack.rb.example" + elog " to ${CONF_DIR}/initializers/rack_attack.rb" + elog + elog " 4. Copy ${CONF_DIR}/resque.yml.example to ${CONF_DIR}/resque.yml" + elog " and edit this file in order to configure your Redis settings" + elog " for \"production\" environment." + elog + + if use unicorn; then + elog " 4a. Copy ${CONF_DIR}/unicorn.rb.example to ${CONF_DIR}/unicorn.rb" + elog + fi + + elog " 5. If this is a new installation, create a database for your GitLab instance." + if use postgres; then + elog " If you have local PostgreSQL running, just copy&run:" + elog " su postgres" + elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\" + elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" + elog " createdb -E UTF-8 -O gitlab gitlab_production" + elog " Note: You should change your password to something more random..." + elog + elog " GitLab uses polymorphic associations which are not SQL-standard friendly." + elog " To get it work you must use this ugly workaround:" + elog " psql -U postgres -d gitlab" + elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;" + elog + fi + elog " 6. Execute the following command to finalize your setup:" + elog " emerge --config \"=${CATEGORY}/${PF}\"" + elog " Note: Do not forget to start Redis server." + elog + elog "To update an existing instance, run the following command and choose upgrading when prompted:" + elog " emerge --config \"=${CATEGORY}/${PF}\"" + elog + elog "Important: Do not remove the earlier version prior migration!" + + if linux_config_exists; then + if linux_chkconfig_present PAX ; then + elog "" + ewarn "Warning: PaX support is enabled, you must disable mprotect for ruby. Otherwise " + ewarn "FFI will trigger mprotect errors that are hard to trace. Please run: " + ewarn " paxctl -m $RUBY" + fi + else + elog "" + einfo "Important: Cannot find a linux kernel configuration, so cannot check for PaX support." + einfo " If CONFIG_PAX is set, you should disable mprotect for ruby since FFI may trigger" + einfo " mprotect errors." + fi +} + +pkg_config() { + # Ask user whether this is the first installation + einfon "Do you want to upgrade an existing installation? [Y|n] " + do_upgrade="" + while true + do + read -r do_upgrade + if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break + elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break + else eerror "Please type either \"Y\" or \"N\" ... " ; fi + done + + if [[ $do_upgrade ]] ; then + + LATEST_DEST=$(test -n "${LATEST_DEST}" && echo ${LATEST_DEST} || \ + find /opt -maxdepth 1 -iname 'gitlabhq-*' -and -type d -and -not -iname "gitlabhq-${SLOT}" | \ + sort -rV | head -n1) + + if [[ -z "${LATEST_DEST}" || ! -d "${LATEST_DEST}" ]] ; then + einfon "Please enter the path to your latest Gitlab instance:" + while true + do + read -r LATEST_DEST + test -d ${LATEST_DEST} && break ||\ + eerror "Please specify a valid path to your Gitlab instance!" + done + else + einfo "Found your latest Gitlab instance at \"${LATEST_DEST}\"." + fi + + einfo "Please make sure that you've created a backup and stopped your running Gitlab instance: " + elog "\$ cd \"${LATEST_DEST}\" && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:backup:create RAILS_ENV=production" + elog "\$ /etc/init.d/${LATEST_DEST#*/opt/} stop" + elog "" + + einfon "Proceeed? [Y|n] " + read -r proceed + if [[ $proceed != "y" && $proceed != "Y" && $proceed != "" ]] + then + einfo "Aborting migration" + return + fi + + if [[ ${LATEST_DEST} != ${DEST_DIR} ]] ; + then + einfo "Found major update, migrate data from \"$LATEST_DEST\":" + + einfo "Migrating uploads ..." + einfon "This will move your uploads from \"$LATEST_DEST\" to \"${DEST_DIR}\", (C)ontinue or (s)kip? " + migrate_uploads="" + while true + do + read -r migrate_uploads + if [[ $migrate_uploads == "s" || $migrate_uploads == "S" ]] ; then migrate_uploads="" && break + elif [[ $migrate_uploads == "c" || $migrate_uploads == "C" || $migrate_uploads == "" ]] ; then migrate_uploads=1 && break + else eerror "Please type either \"c\" to continue or \"n\" to skip ... " ; fi + done + if [[ $migrate_uploads ]] ; then + su -l ${GIT_USER} -s /bin/sh -c " + rm -rf ${DEST_DIR}/public/uploads && \ + mv ${LATEST_DEST}/public/uploads ${DEST_DIR}/public/uploads" \ + || die "failed to migrate uploads." + + # Fix permissions + find "${DEST_DIR}/public/uploads/" -type d -exec chmod 0700 {} \; + fi + + einfo "Migrating shared data ..." + einfon "This will move your shared data from \"$LATEST_DEST\" to \"${DEST_DIR}\", (C)ontinue or (s)kip? " + migrate_shared="" + while true + do + read -r migrate_shared + if [[ $migrate_shared == "s" || $migrate_shared == "S" ]] ; then migrate_shared="" && break + elif [[ $migrate_shared == "c" || $migrate_shared == "C" || $migrate_shared == "" ]] ; then migrate_shared=1 && break + else eerror "Please type either \"c\" to continue or \"n\" to skip ... " ; fi + done + if [[ $migrate_shared ]] ; then + su -l ${GIT_USER} -s /bin/sh -c " + rm -rf ${DEST_DIR}/shared && \ + mv ${LATEST_DEST}/shared ${DEST_DIR}/shared" \ + || die "failed to migrate shared data." + + # Fix permissions + find "${DEST_DIR}/shared/" -type d -exec chmod 0700 {} \; + fi + + einfon "Migrate configuration, (C)ontinue or (s)kip? " + while true + do + read -r migrate_config + if [[ $migrate_config == "s" || $migrate_config == "S" ]] ; then migrate_config="" && break + elif [[ $migrate_config == "c" || $migrate_config == "C" || $migrate_config == "" ]] ; then migrate_config=1 && break + else eerror "Please type either \"c\" to continue or \"s\" to skip ... " ; fi + done + if [[ $migrate_config ]] + then + for conf in database.yml gitlab.yml resque.yml unicorn.rb secrets.yml ; do + einfo "Migration config file \"$conf\" ..." + cp -p "${LATEST_DEST}/config/${conf}" "${DEST_DIR}/config/" + sed -s "s#$(basename $LATEST_DEST)#${PN}-${SLOT}#g" -i "${DEST_DIR}/config/$conf" + + example="${DEST_DIR}/config/${conf}.example" + test -f "${example}" && cp -p "${example}" "${DEST_DIR}/config/._cfg0000_${conf}" + done + + # if the user's console is not 80x24, it is better to manually run dispatch-conf + einfon "Merge config with dispatch-conf, (C)ontinue or (q)uit? " + while true + do + read -r merge_config + if [[ $merge_config == "q" || $merge_config == "Q" ]] ; then merge_config="" && break + elif [[ $merge_config == "c" || $merge_config == "C" || $merge_config == "" ]] ; then merge_config=1 && break + else eerror "Please type either \"c\" to continue or \"q\" to quit ... " ; fi + done + if [[ $merge_config ]] ; then + CONFIG_PROTECT="${DEST_DIR}" dispatch-conf || die "failed to automatically migrate config, run \"CONFIG_PROTECT=${DEST_DIR} dispatch-conf\" by hand, re-run this routine and skip config migration to proceed." + else + echo "Manually run \"CONFIG_PROTECT=${DEST_DIR} dispatch-conf\" and re-run this routine and skip config migration to proceed." + return + fi + fi + fi + + einfo "Clean up old gems ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + ${BUNDLE} clean" \ + || die "failed to clean up old gems ..." + + einfo "Migrating database ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + ${BUNDLE} exec rake db:migrate RAILS_ENV=production" \ + || die "failed to migrate database." + + einfo "Clear redis cache ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + ${BUNDLE} exec rake cache:clear RAILS_ENV=production" \ + || die "failed to run cache:clear" + + einfo "Clean up assets ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + ${BUNDLE} exec rake gitlab:assets:clean RAILS_ENV=production NODE_ENV=production" \ + || die "failed to run gitlab:assets:clean" + + einfo "Configure Git to generate packfile bitmaps ..." + su -l ${GIT_USER} -s /bin/sh -c " + git config --global repack.writeBitmaps true" \ + || die "failed to configure Git" + + else + + ## Check config files existence ## + einfo "Checking configuration files ..." + + if [ ! -r "${CONF_DIR}/database.yml" ] ; then + eerror "Copy \"${CONF_DIR}/database.yml.*\" to \"${CONF_DIR}/database.yml\"" + eerror "and edit this file in order to configure your database settings for" + eerror "\"production\" environment." + die + fi + if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then + eerror "Copy \"${CONF_DIR}/gitlab.yml.example\" to \"${CONF_DIR}/gitlab.yml\"" + eerror "and edit this file in order to configure your GitLab settings" + eerror "for \"production\" environment." + die + fi + + einfo "Initializing database ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + ${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \ + || die "failed to run rake gitlab:setup" + fi + + einfo "Compile assets ..." + su -l ${GIT_USER} -s /bin/sh -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 + cd ${DEST_DIR} + yarn add mime-db + yarn install --production --pure-lockfile --no-progress + ${BUNDLE} exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production" \ + || die "failed to run yarn install and gitlab:assets:compile" + + ## (Re-)Link gitlab-shell-secret into gitlab-shell + if test -L "${GITLAB_SHELL}/.gitlab_shell_secret" + then + rm "${GITLAB_SHELL}/.gitlab_shell_secret" + ln -s "${DEST_DIR}/.gitlab_shell_secret" "${GITLAB_SHELL}/.gitlab_shell_secret" + fi + + einfo "You might want to run the following in order to check your application status:" + einfo "# cd ${DEST_DIR} && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:check RAILS_ENV=production" + einfo "" + einfo "GitLab is prepared, now you should configure your web server." +}