added latest version for gitlab-ce and gitlab-ci-multi-runner

This commit is contained in:
Manuel Friedli 2016-02-23 13:37:09 +01:00
parent 59845bb553
commit 4477f8a938
4 changed files with 476 additions and 0 deletions

View file

@ -24,6 +24,9 @@ DIST gitlab-ci-multi-runner-1.0.1-x86 29549472 SHA256 11224f7ff4bd8ee3e8031505b0
DIST gitlab-ci-multi-runner-1.0.2-amd64 31998376 SHA256 59c65be59c34d94f8b82e19013450f46fd800d89d1edf60be1fd6ac421dea0d4 SHA512 13409b232d2190604e1b752a322293eb39ba08bff37624d21c1900789a4782a54c6f9aad9a70c3ca66a136b2f4c7ba3900aab1312d9effe0c93e2d9be454d8cc WHIRLPOOL d03b0267172dad13d09b1df2436c8e040f188c80e5afb23476800b4f1db5b77e4d5a20c5458dad39943a89520668bf516eda7017625603f34e30458e890ed472
DIST gitlab-ci-multi-runner-1.0.2-arm 29449768 SHA256 057e3e0271f61b39d10ebf478428d608fae4b4902a6dd13fcad6b1e1fb793a38 SHA512 522b7378866830e849117ab5acf2e98892665f75c28614d4921d4c2aa06f2e6b944649eb6cf302be99e900ab46bedf37405c4564b4915d2d7b8e12d3dce68c30 WHIRLPOOL afa8880642fbba0b722ce0c2bddfd68e4f4e02ec3604eee5bbec52a4501155ae6b7eca3dcd7b02cd640cffa63235791e090d06c209f3c3316339f17d48354df3
DIST gitlab-ci-multi-runner-1.0.2-x86 29553888 SHA256 8937eae87d0fbad318e7867b94730bfc75e155ebd5a5f6b0783c84cf8418f84d SHA512 998dc0499d6918599f66c2a1ee3356c7bada8b819ef3d1a05449a397bab84f4294a0e875ac1a9d3fc074237d60c39b27cf26a468ccfc1ac3aaf27ffcfeab21a1 WHIRLPOOL 26f5150a7156c9000ac2c5832f948ca98d346cca25c8c6561d2be8472f31cbe19f9c6879a4d05862b95356f0fddb4ba706984b405008f6e2e96364efbb0ceac3
DIST gitlab-ci-multi-runner-1.0.4-amd64 31999976 SHA256 c73c22e54c1416ede6580d359af0089d9d8c8e461574543d93af2a84c91b6d38 SHA512 d96497fe6ae646d696ede7ede97a2137bb05a43c5b4c6622cb4dd612ae9d24b091ad7287d22121d7418515880f564a8af99f1d8c58ec7ea6e31a54dcb4e9274c WHIRLPOOL af78d6fdb8356062e1a3fe1e66dc3d69e0755f8ac3758884f1069cfd53b9e133f628bf244778eeefe04d227ed56fb96288e954b20d5e95f641d666534ed31926
DIST gitlab-ci-multi-runner-1.0.4-arm 29455296 SHA256 09e17c5f188d99d16acbe06cb01fc39c6856c6f4f8524fa4fd43291ba471beb3 SHA512 f3af90b9884d36853cc5b49b5086bbe5ac97c86b77d07bb3f47cf36c492cc024109ee9cb5135d0d671b5d1cbfb94f7473fd988d9858c6819fd031b5a98c72afa WHIRLPOOL 9107f197164cf2647ccccb4047d0397046ca30ae56be02fe4e8d29ccd2b8d5f0315c0e5fa162e38abce22ddd8ca48d6579f05674478c19b76aa47282268bd15c
DIST gitlab-ci-multi-runner-1.0.4-x86 29555368 SHA256 47098bd380f10069829ec4b0082092324b75267e3321a85bafbdc92dc7858382 SHA512 6ae1a5e0c9e8da14f8ee5be24190e78dd5b8af12b07f622435fb15ad1405cc34749247f2b85519ac7381672a0ce7b7d5d9f4e13db189c56feb04351b060a1fa1 WHIRLPOOL a0a4647854c83a4fc24442c36f90399876d8c6d4df8d60760f10fe8d51088cb74b9087564b489c93dbd0038f3550fc0dc5b2da2eb3b08e372b0d71b9b6f8be62
EBUILD gitlab-ci-multi-runner-0.5.5-r1.ebuild 2238 SHA256 e5c5c8172052cce018a8bfe17224a379175fade6bae83a06b8649d987ac6d496 SHA512 dafddb480bf34aa1d17eb57a82b7380c376f303a84bd5a1162030541775935e6352c7d51675465203f898e6caea1ef2802dcbcbbc200d8f4d777082c074380df WHIRLPOOL ea427e8a9259348c5b604cf3cd18993b843bc8312326be745d48ea0b77480101124cd0babfcc21e172cb095bc1dae53010fd2c04f6ddbf177933f4af933393c2
EBUILD gitlab-ci-multi-runner-0.6.0.ebuild 2238 SHA256 e5c5c8172052cce018a8bfe17224a379175fade6bae83a06b8649d987ac6d496 SHA512 dafddb480bf34aa1d17eb57a82b7380c376f303a84bd5a1162030541775935e6352c7d51675465203f898e6caea1ef2802dcbcbbc200d8f4d777082c074380df WHIRLPOOL ea427e8a9259348c5b604cf3cd18993b843bc8312326be745d48ea0b77480101124cd0babfcc21e172cb095bc1dae53010fd2c04f6ddbf177933f4af933393c2
EBUILD gitlab-ci-multi-runner-0.6.2-r1.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7fb79382061fa9296df9b6dc9ca32d4caa5f20702 SHA512 2a7674d506e79d8570fa8527dd10b87e775a75b4daf41458bcca28f5ad9863145571d4ebf9d9e0d9df015e48c89a7bd4a05d1bc7928223fdc2b7fd528d5282d8 WHIRLPOOL 6df8346401d631b58a3a6e1ce9f2c0e3e8b871e99880099463dcb9b5639d08b3725c7c83e7f96dfe7e8cba4e60abe77e2afbeb2c7ae8ec13cf02b05d1723fd9f
@ -33,4 +36,5 @@ EBUILD gitlab-ci-multi-runner-0.7.2.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7f
EBUILD gitlab-ci-multi-runner-1.0.0.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7fb79382061fa9296df9b6dc9ca32d4caa5f20702 SHA512 2a7674d506e79d8570fa8527dd10b87e775a75b4daf41458bcca28f5ad9863145571d4ebf9d9e0d9df015e48c89a7bd4a05d1bc7928223fdc2b7fd528d5282d8 WHIRLPOOL 6df8346401d631b58a3a6e1ce9f2c0e3e8b871e99880099463dcb9b5639d08b3725c7c83e7f96dfe7e8cba4e60abe77e2afbeb2c7ae8ec13cf02b05d1723fd9f
EBUILD gitlab-ci-multi-runner-1.0.1.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7fb79382061fa9296df9b6dc9ca32d4caa5f20702 SHA512 2a7674d506e79d8570fa8527dd10b87e775a75b4daf41458bcca28f5ad9863145571d4ebf9d9e0d9df015e48c89a7bd4a05d1bc7928223fdc2b7fd528d5282d8 WHIRLPOOL 6df8346401d631b58a3a6e1ce9f2c0e3e8b871e99880099463dcb9b5639d08b3725c7c83e7f96dfe7e8cba4e60abe77e2afbeb2c7ae8ec13cf02b05d1723fd9f
EBUILD gitlab-ci-multi-runner-1.0.2.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7fb79382061fa9296df9b6dc9ca32d4caa5f20702 SHA512 2a7674d506e79d8570fa8527dd10b87e775a75b4daf41458bcca28f5ad9863145571d4ebf9d9e0d9df015e48c89a7bd4a05d1bc7928223fdc2b7fd528d5282d8 WHIRLPOOL 6df8346401d631b58a3a6e1ce9f2c0e3e8b871e99880099463dcb9b5639d08b3725c7c83e7f96dfe7e8cba4e60abe77e2afbeb2c7ae8ec13cf02b05d1723fd9f
EBUILD gitlab-ci-multi-runner-1.0.4.ebuild 2349 SHA256 6432c48b3a7a36c0b28ccab7fb79382061fa9296df9b6dc9ca32d4caa5f20702 SHA512 2a7674d506e79d8570fa8527dd10b87e775a75b4daf41458bcca28f5ad9863145571d4ebf9d9e0d9df015e48c89a7bd4a05d1bc7928223fdc2b7fd528d5282d8 WHIRLPOOL 6df8346401d631b58a3a6e1ce9f2c0e3e8b871e99880099463dcb9b5639d08b3725c7c83e7f96dfe7e8cba4e60abe77e2afbeb2c7ae8ec13cf02b05d1723fd9f
MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431

View file

@ -0,0 +1,100 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
inherit eutils user
DESCRIPTION="GitLab CI Multi Runner is the new build processor needed for GitLab CI >= 7.12"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-multi-runner"
SRC_URI="x86? ( https://${PN}-downloads.s3.amazonaws.com/v${PV}/binaries/${PN}-linux-386 -> ${P}-x86 )
amd64? ( https://${PN}-downloads.s3.amazonaws.com/v${PV}/binaries/${PN}-linux-amd64 -> ${P}-amd64 )
arm? ( https://${PN}-downloads.s3.amazonaws.com/v${PV}/binaries/${PN}-linux-arm -> ${P}-arm )"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~arm"
DEPEND="dev-vcs/git"
RDEPEND="${DEPEND}
net-libs/nodejs
virtual/mta"
MY_NAME="${PN}"
MY_USER="gitlab_ci_multi_runner"
DEST_DIR="/opt/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
pkg_setup() {
enewgroup ${MY_USER}
enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER}
}
src_unpack() {
local a="$(usev amd64)$(usev arm)$(usev x86)"
mkdir -p "${S}"
cp "${DISTDIR}/${P}-${a}" "${S}/${PN}"
}
src_prepare() {
chmod +x "${S}/${PN}"
}
src_compile() {
# nothing to compile, binary all-in-one goodness! (?)
:
}
src_install() {
local dest=${DEST_DIR}
local conf="/etc/gitlab-runner"
diropts -m755
dodir ${dest}
exeinto ${dest}
doexe "${S}/${PN}"
disopts -m750
dodir ${conf}
dosym ${conf} ${dest}/.gitlab-runner
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${conf}
## RC script ##
local rcscript="${MY_NAME}.init"
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
newconfd "${FILESDIR}/${MY_NAME}.conf" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "If this is a fresh install of GitLab CI Multi Runner, please configure it"
elog "with the following command:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
}
pkg_config() {
einfo "You need to register the runner with your GitLab CI instance. Please"
einfo "Follow the instructions on"
einfo
einfo "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-manually.md"
einfo
einfo "Perhaps I'll improve the ebuild later ... kthxbye."
}

View file

@ -23,6 +23,7 @@ DIST gitlab-ce-8.3.4.tar.gz 10255543 SHA256 15cc1644c05798deafb81be5ae4c313d2d1d
DIST gitlab-ce-8.4.0.tar.gz 12182652 SHA256 1c3cc61e5cfb9a86d62d62457636de1e277134769037ea2986295e4a7f230d6c SHA512 7314481d985613c6e49f975b75d63fb3815c5150cda5f4e29df282fe28de79eaba9316838a98efb21a7607d260fc29707aaf889354781dab66e55f71410e53ba WHIRLPOOL 358632ac19d4a8581c2d0618c92b744c4e667a57ceeadec811749d2dd9a01e20fc05c45068e96611cc0f946b2979b5e9c8d8d5ddc69ec0d2e4075f12d1cd45d9
DIST gitlab-ce-8.4.3.tar.gz 12187867 SHA256 bc11494885c6ad41f2b6a057d7fbec2fd4df10908f591c84c210f4881aa3c23d SHA512 84018eca604ba1639e19cc45b6ef21ad298cf60a66724bc247bf7a7c94ff1131010317d851855f5676687e8c8148602ad199e35f1029ebab24ccbbafd7b866e1 WHIRLPOOL 418afc8ddb262aa7af22bd79cb9febf1a15625f753208fe4f47cbbc3d79df0566e506febe2917bd2176508312d4a5da7245e36233ec2e50c024b811c1d306b00
DIST gitlab-ce-8.4.4.tar.gz 12186833 SHA256 f8c403d4cecd82aa2021ed5a6d5d7b4ac8526c7ee7a9bb1c7391f8653bf5a01c SHA512 fe8bd002ea164b384e25303e06ab6a6a97c89180a1898bc8a6d6bb07fcfda6be03a057ad7f92e4c192e0c10aa686b897fe18e864b36c314dcd7fee62dd6758bb WHIRLPOOL 8c79ba70f9b56408f70a4b48554114bcad5a4ac2806dfd8fe63ad060b9887bb6cf3d4f5c2d6e7db20aa65a83e2c33879fd32b9cce7277cd6fdd65acbdb399f40
DIST gitlab-ce-8.5.0.tar.gz 14276001 SHA256 a43dd64cfb1e34bf273d31984b52ada09c5a48d5d077f5bd1f21a79960bb1039 SHA512 499d93767df9d3c9c4b68ac663846d49335bd989ee8e93a8d610cb6106900886913912443f908cd316424312df67658df5d6027fda9a5abd787572d4e23e14d1 WHIRLPOOL 225c40c9a1769dbd13ea736f6bdce2a9a3cd5bfca8b27ce9270f55beebd36f5b233858c0dee5f0d80cdf40c5ccc1af651d152743f5ede1f98a8a8496ba36b6d1
EBUILD gitlab-ce-7.14.3.ebuild 10996 SHA256 a632476e8fe87ec1a478d2229f9e27cbe9e7cc86351e411d9f15105178a4c69f SHA512 a8646de0798d7dae299e500e0a42e6b093e229cb666614b895b979decb1d4b6b398ec2b2f1d19e07cc115f2acb16536426d1769b65412bc51349ac1b262b3053 WHIRLPOOL 2ba4e53846507899b3e6ebb38063e11ee92904262b8a6e00817ab50d6634ed0f0b1013f4a0d8a1cbb26e18c4008e5ab457d3cbd0fdc5f92e5c6214cb45c692f5
EBUILD gitlab-ce-8.0.5.ebuild 11185 SHA256 1240818953ae8f61b6c88c91c3c1dd32fb7d03c8a62964f5d3ad2e98ff5dad11 SHA512 fd411dd3cd8a4dd1ee0040438fe5da01f81ccf4f97b7b7b3157fcbb35bfacbfd0eda8754fb01e0061e6b0c5bd0e752b0eaff4d663d11b764623e7baafb4f56da WHIRLPOOL 9514cd8f83c7fbaba82b49352cb9b8e62d1a5317a09bfea85ce945abd1402e634a88f6eb033494729519ac6fc1282c18bfc8224b9bbe6f41ac89a1286b1d5d0a
EBUILD gitlab-ce-8.1.4.ebuild 11177 SHA256 6b920132ff2c4926f2ed3edb3fff7cdf3e88c0314f8a0a9c077cdaae9fad4a0e SHA512 617656f6fd52d0c4751e0726983fc7d2c1532e8bc44761dbbe5bfb7f489e18ef66a68769bb0f7736c9d49d536e8103a5486e92869a9bba4d1aa92c4068eedf6e WHIRLPOOL 1c8a0968a1fa7b95ceb47f66610a72585666cc5b2f7f3157d1f5c04f98a2c89d79ac1875a28c57b3116105d2e0af17dabcecaa00159af42166565ae7fa88647e
@ -32,5 +33,6 @@ EBUILD gitlab-ce-8.3.4.ebuild 11156 SHA256 6a9d5dffb4228ef4ad3eda9429d9429ab7cc9
EBUILD gitlab-ce-8.4.0.ebuild 11157 SHA256 d79254791765a17fa4885ab35e0f6f2c0423ecf9227cfa71f9f6c8bf6bd6a8f7 SHA512 63d6bc7a29c0e2fe5714ed69c3966a878e60d348aec42bf0db2032873a295c81f0d27a5b5e73001b1dfc238cd635ee873d6ec6e513ace99c88a4494412337aba WHIRLPOOL 4e916bde073bd223a4c0feec794dd6f717433b4c041ace203f263731bb201b14794529d752669e9b5faca07856d1bf62466956cb0532473bb3ae4d171b8655b6
EBUILD gitlab-ce-8.4.3.ebuild 11158 SHA256 134fedd2c467d11174a22055e58c822b953f9bdb9902aa0bdf0822c66344d364 SHA512 818c37d814074cb063c91adcfde0f1164fa89cba5a855c442470b5f0e47256f2078326f998b5502c996bf4a2c874cdc068685ad037d1dcf962c2c0bbe683e689 WHIRLPOOL a251afe289ab12dbef9114ebfcb00cf84080766e4d0c1737fa1ece1965210d4544a319af27823b4794c0bddc0cfbf6d3cb896bbe48fa02c623e0b4847b6302d2
EBUILD gitlab-ce-8.4.4.ebuild 11158 SHA256 134fedd2c467d11174a22055e58c822b953f9bdb9902aa0bdf0822c66344d364 SHA512 818c37d814074cb063c91adcfde0f1164fa89cba5a855c442470b5f0e47256f2078326f998b5502c996bf4a2c874cdc068685ad037d1dcf962c2c0bbe683e689 WHIRLPOOL a251afe289ab12dbef9114ebfcb00cf84080766e4d0c1737fa1ece1965210d4544a319af27823b4794c0bddc0cfbf6d3cb896bbe48fa02c623e0b4847b6302d2
EBUILD gitlab-ce-8.5.0.ebuild 11158 SHA256 30429c027251860479e423fe586a5a077e34b41618eea87e6efe8475e1c4e59f SHA512 816a6724fe564cd167bb083d688baaf9ef6482090f6f9d6703eb4225576406b799d7cf3644b0e3a5b825d7a9df54bcbbb94abe5caf611a7169b47ae09f3423e8 WHIRLPOOL 141605345be096b6b2be6d26015a78d3bbf2ce1dce9b5a7ba144ff0503b0f9d41ceb68cee1a68996f3022757a0b82748db7f9cba033ec5f4227a5af545daf3ad
EBUILD gitlab-ce-9999.ebuild 11174 SHA256 f74adae83defdce35c392341aaea5b49095e1ff59515d77b5968b460c46bc058 SHA512 0051b5c07cb2fce5170ec47f6e061747fe775383d633c6ceee8522bb168f487ea5273ce9f96714d1dbcd16f6cbff019e4ba3e5faa327ea169af276a65264abe4 WHIRLPOOL 553ffe2d3edd64c2cb9897f99266535352fc55d05a8194dcab9ff47f0fe3c84cda34e9a317d474c31abc509e56201dac4a901c8754b8a8b34e87fe6b2bbbbbf7
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View file

@ -0,0 +1,370 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
# Maintainer 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="ruby21"
inherit eutils ruby-ng user systemd
MY_PKGNAME="gitlabhq"
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://about.gitlab.com/"
SRC_URI="https://github.com/${MY_PKGNAME}/${MY_PKGNAME}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RUBY_S="${MY_PKGNAME}-${PV}"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# rugged dev-util/cmake, virtual/pkgconfig
# json dev-util/ragel
# pygments.rb python 2.7+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
net-libs/nodejs
postgres? ( >=dev-db/postgresql-9.1:* )
mysql? ( virtual/mysql )
kerberos? ( virtual/krb5 )"
CDEPEND="
dev-util/cmake
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.10
dev-vcs/git
>=dev-vcs/gitlab-workhorse-0.6.4
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/23 )"
RDEPEND="${DEPEND}
>=dev-db/redis-2.8
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ce/blob/v${PV}/bin/background_jobs
SIDEKIQ_QUEUES="post_receive,mailers,archive_repo,system_hook,project_web_hook,gitlab_shell,incoming_email,runner,common,default"
all_ruby_prepare() {
# fix paths
local satellites_path="${TEMP_DIR}/repo_satellites"
local repos_path=/var/lib/git/repositories
local shell_path=/usr/share/gitlab-shell
sed -i -E \
-e "/satellites:$/,/\w:$/ s|(\s*path:\s).*|\1${satellites_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*path:\s).*|\1${shell_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${shell_path}/hooks/|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
local run_path=/run/${MY_NAME}
sed -i -E \
-e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \
-e "s|/home/git/gitlab/log|${LOGS_DIR}|" \
-e "s|/home/git/gitlab|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \
lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
# modify default database settings for PostgreSQL
sed -i -E \
-e 's|(username:).*|\1 gitlab|' \
-e 's|(password:).*|\1 gitlab|' \
-e 's|(socket:).*|\1 /run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# rename config files
mv config/gitlab.yml.example config/gitlab.yml
mv config/unicorn.rb.example config/unicorn.rb
local dbconf=config/database.yml
if use postgres && ! use mysql; then
mv ${dbconf}.postgresql ${dbconf}
rm ${dbconf}.mysql
elif use mysql && ! use postgres; then
mv ${dbconf}.mysql ${dbconf}
rm ${dbconf}.postgresql
fi
# remove useless files
rm -r lib/support/{deploy,init.d}
use unicorn || rm config/unicorn.rb
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${conf} ${dest}/public/uploads
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
# install configs
insinto ${conf}
doins -r config/*
dosym ${conf} ${dest}/config
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# remove needless dirs
rm -Rf config tmp log
# install the rest files
# using cp 'cause doins is slow
cp -Rl * "${D}/${dest}"/
# install logrotate config
dodir /etc/logrotate.d
cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
${logs}/*.log {
missingok
delaycompress
compress
copytruncate
}
EOF
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test aws"
local flag; for flag in mysql postgres unicorn kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
# clean gems cache
rm -Rf vendor/bundle/ruby/*/cache
rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script ##
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dounit "${FILESDIR}/gitlab-workhorse.service"
systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-8.2.init
use unicorn && rcscript=gitlab-unicorn-8.2.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
fi
}
pkg_postinst() {
elog "If this is an update from a previous version, stop your GitLab"
elog "instance and issue the following command to perform all required"
elog "migrations:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog "PLEASE NOTE: It's HIGHLY recommended to backup your database"
elog "before running the config phase!"
elog
elog "If this was a fresh install, follow these steps:"
elog
elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Then you should create a database for your GitLab instance, if you"
elog "haven't done so already."
elog
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 gitlabhq_production"
elog " Note: You should change your password to something more random..."
elog
fi
elog "4. Finally execute the following command to initlize environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server first!"
elog
elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and"
elog "you can't login after the upgrade, be sure to read the section about the"
elog "verification of the CSRF token in GitLab's trouble-shooting guide at"
elog "http://goo.gl/5XGRGv."
}
pkg_config() {
local shell_conf='/etc/gitlab-shell.yml'
einfo "Checking configuration files"
if [ ! -r "${CONF_DIR}/database.yml" ]; then
eerror "Copy ${CONF_DIR}/database.yml.* to"
eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"
eerror "database settings for \"production\" environment."; die
fi
# check gitlab-shell configuration
if [ -r ${shell_conf} ]; then
local shell_repos_path="$(ryaml ${shell_conf} repos_path)"
local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \
production gitlab_shell repos_path)"
if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then
eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}"
eerror "must points to the same location! Fix the repos_path location and"
eerror "run this again."; die
fi
else
ewarn "GitLab Shell checks skipped, could not find config file at"
ewarn "${shell_conf}. Make sure that you have gitlab-shell properly"
ewarn "installed and that repos_path is the same as in GitLab."
fi
local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)"
local git_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${git_home}/.gitconfig" ]; then
einfo "Setting git user"
su -l ${MY_USER} -c "
git config --global user.email '${email_from}';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
if [ ! -d "${DEST_DIR}/.git" ]; then
# create dummy git repo as workaround for
# https://github.com/bundler/bundler/issues/2039
einfo "Initializing dummy git repository to avoid false errors from bundler"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
git init
git add README.md
git commit -m 'Dummy repository'" >/dev/null
fi
## Initialize app ##
local RAILS_ENV="production"
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
local dbname="$(ryaml ${CONF_DIR}/database.yml production database)"
if [ -f "${DEST_DIR}/.secret" ]; then
local update=true
einfo "Migrating database ..."
exec_rake db:migrate
# https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
einfo "Migrating iids ..."
exec_rake migrate_iids
einfo "Cleaning old precompiled assets ..."
exec_rake assets:clean
einfo "Cleaning cache ..."
exec_rake cache:clear
else
local update=false
einfo "Initializing database ..."
exec_rake gitlab:setup
fi
einfo "Precompiling assests ..."
exec_rake assets:precompile
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
ewarn "for any additional migration tasks specific to your previous GitLab"
ewarn "version."
fi
}
ryaml() {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
}
exec_rake() {
local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}"
echo " ${command}"
su -l ${MY_USER} -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${command}" \
|| die "failed to run rake $@"
}