Merge branch 'master' into feature/cleanup-gitlab

This commit is contained in:
Manuel Friedli 2016-03-14 14:04:23 +01:00
commit 745aff1c0d
5 changed files with 436 additions and 0 deletions

View file

@ -1,12 +1,15 @@
AUX fix-Makefile-0.6.2.patch 377 SHA256 f0212d01760418cc669c0727310644b18a3736fac2830d82e38489af6b3a673d SHA512 6d43a4fe8250114bccc9a06cf2d970ec87da3f8fa13024a65cc0af54cce690b52c0a9907d8b219d26a1cc1ae04348e8922f4e5bf35c9b6f2b4e18efaba4b2643 WHIRLPOOL e7e05822830005dd81839510cc38dda599b84204a4eaf90ffa36ae8b96ca9e4f1e54fff34ae7a70bd92ff60d43494b5ee82fcc1b56ac37dfff2bb700a0b4ff40
AUX fix-Makefile-0.6.3.patch 377 SHA256 14051ee1b2fa6c4a458b402c486f0b6800004f93ce46410ab7b94142acdf6ca4 SHA512 b127b962667e5e68bece6beb8a26b86425da3f481c8f29a358043d7284796bb3c7563f9272fa27d7b4521e92bac663d55111759a68a6b3729551dbfee43303ba WHIRLPOOL e21c5f0855130ad2efd8526c4fd96e130fdb18eca81590aa0e4d535e3908a182f1bfed9ebfdacfa07698317b76e1584118f48bcdab6af85daac4a8446432a144
AUX fix-Makefile-0.6.4.patch 377 SHA256 b9711a6ddb3a6bbcdfc69acae43f26a86f148572535d218f910bdce19683b3c5 SHA512 c7776450f64d0037f24965708490abb553524a9ff17dee90d98ed5ecce17e02a8cf3af872c0aef40e8169d39e318d9673e7d2c2f7555a48b7a2ca71b0131691f WHIRLPOOL c9c78a79ddf7c0060039ac1ffeeb10701a9cd1bba91cdd6e74b1759f166d8ed4137bab38d28d3822167ee9d6e2a6e73557b49b1a9dffa34dca224496492dc3d9
AUX fix-Makefile-0.6.5.patch 377 SHA256 e96f13b11f1e05042542dd9bbf507954634b23674e15ea76a97503d484fee7c0 SHA512 13282a291239425aa4de8186dc0db2f8e06c3c1441b71042b3885ff9621ce2f7391e06f08463e671a134022bda74fbe8c836625eb3f8dd38c54b875810afab2f WHIRLPOOL 9d926bef63fc66f08d0b0235116540d6ba8d8a4d071b4305227090e90cf4a5ae58cf720f1c5a93680f391fc8cc818fe72e2c12f19ae004fd7a18df788c64c4ea
AUX gitlab-workhorse.conf 248 SHA256 6d11d63aa869cfd8c6f77c3a875984c226db633be899ad7ce97fafe94236eee7 SHA512 234213c8361702bdfeea40bd306b5899de19f34ce985e090a86e01aa601cf4ed23da4dfb75f74fe5986bbea5535a7a6a745406b4f67f79d352bd1c863777c7f1 WHIRLPOOL 8ac1134cde3aee942466d206e703ebd5330f83537d7e29641447f812d857bcc57b07fbf82eab086c0d622750694f64fabf8ffca2ba26a725f61b40fd1941e963
AUX gitlab-workhorse.init 653 SHA256 f38c37ed818cb8c25fb800bfcb5448f659e876b78ea33ea7a1ba3c80e73ea95e SHA512 2667997def39e6dc17e6a1d9be06d6e855d5d3e956e64d93bb3e74bbad0a1d427dc034f9c139f3b05e2666abab014404b2c8013c5347f4ec25fbf5ef86e7e88e WHIRLPOOL 63cd7ff80d88676b44c2d6ccdadf74907d5f8e4268f03ee11775c423bf95955f9d3aaeedd79fa6e0486b2d225336eb2ffa165dd7b9ac87ed0c2d403dc7e5afb4
DIST gitlab-workhorse-0.6.2.tar.bz2 25745 SHA256 ecaea12915758a226aa0877ca57bff2c1c32009bc5aa95735fac1dfac1e2d217 SHA512 05ed31336588a7158e4c27dbea22cddeadcb84296ef8809d5824ded2f9cf5a13631997f13843a2da3bed1b9184e92c23f71d4e0382dcc45a8d209d43783b6905 WHIRLPOOL dc9ba82ca9515f569919674b8214f553d66cc08ce45674676646b9d527c7d37f9d72eb01e76c195b1981b3d2b6af378ed77fde8853e953457a2e31c0e0bf4f8e
DIST gitlab-workhorse-0.6.3.tar.bz2 26460 SHA256 4b73e28077e0f6d19eb4bed431c90aa029b18519fa6b43ab896400d5a2bd05ee SHA512 0f46da59bc83daa49a2854ce14e449b2a6556efc166a078b20fe95bd573792cf2894a4e67472206c2d56735c1c95dfde615c158d3e430ae701d670316870a29c WHIRLPOOL e09e085cf93817517ad6cdb072c41b9a5a2b6822f2018423ef78fd7e501af3993d0d915ef95c524ae495f12d8c9296f5a460b37bfb0bf1a7d09cfa3d15d92822
DIST gitlab-workhorse-0.6.4.tar.bz2 26511 SHA256 cd71a0de525a3bf4e4d66723c1c47263aff37901e2e48a6ec7e8282f369cace7 SHA512 ecb2fd204a58ddee39ea51c38919bfa37ff745ba686c0aa6b31fcac6c3056f318dfe862871713f964e82cf916ca4a7934db094c720befa4c0a4c66722a59f977 WHIRLPOOL 7417f2adb601c0bd28c7e3758e1f03b7f7dc044e0df6794100015687cfd253d2567b7344cff50b8fef999542032d01233a44f724f9b527203e57e5a8b3b65ca0
DIST gitlab-workhorse-0.6.5.tar.bz2 26694 SHA256 89deb66ea0a0e4ce80d933ef18778eb28a37bc7f427188313db8f50cf5c78172 SHA512 ac7475f7557dce4807bdc74f0d5c873d0bc602ded7df8a88a3a453ef4814ba493b539faddec13e771dabade8919079597c7147f13c3d6b9a3606b52a7b3536ae WHIRLPOOL d059a346f594bb623ec5bd7aa90660326ac2c36d07536ef43939a38d2d19afb0126e10bced5486a44ac652ace4de95880e84963ab45f0603d8049c106664395e
EBUILD gitlab-workhorse-0.6.2.ebuild 866 SHA256 92cde2ed28248dbb4f9ebfeed5bc79999fbbb06a64b979c77d7c27896a4f9c85 SHA512 f4e140aeb09c423fae606e50f596991bdf61b1e1ef6c2e966d0dba00a0331c72c075899e1fcb44f28037f4523d54fbf56775cc4c7d59e55de9e0a7e6a5332768 WHIRLPOOL 9c5ba94be5144a6ea5d78536e3d62faa92772c61ea21c3ec6d25db499982651813c9926be7b8fc1ae52d4428e5ced901f69ced3801f902188aeea4d12ea9b4c6
EBUILD gitlab-workhorse-0.6.3.ebuild 866 SHA256 dc2863afba82390633afb85cc199dced0234d504ce051fbcbb919b99871e6262 SHA512 2e4982d6219139326a19756e1ea35f7c9cda2c45e0d21391234a48cf9cb7615ea66707d3ca054ca5f8329ff2c208b77972e5f3c02fbefa6b4c63a586481895fd WHIRLPOOL bf3c0ce0379550953c790e24fd5251fe8f8fbfb05caf8a4ddfca00e1ea03108517c92509b90523e872611e70300e4787cc4983c191f805ea96808bc71a0dfb48
EBUILD gitlab-workhorse-0.6.4.ebuild 866 SHA256 ca2a291f5d2217676c13d610cb925c649deb64e88cd81bfb26c03a2a4ca1c49d SHA512 8684cf00d8768fc051800ddd099805a3a13995bbafa27a638c71a3cb4fdcfad5b2325ef5c7074d74b951ab2e348b50943dc432858c701b796f1ec323c2e854bb WHIRLPOOL d19614d96eb38249d520459fc4c361812850069f9fc905ffe7590e5d9a54576847ccc35b99b18251426c6e16014ff2e8f7e96dd1d6a6963b11cba7c48395763f
EBUILD gitlab-workhorse-0.6.5.ebuild 866 SHA256 eab67140a2cada7e4807126bd2fe081750434fae6c1351842d747f5b11c108dc SHA512 953be4d044d3bbfa0f170e420b5efcb47e247b415fc47f46c4b898a2fbb109564b3e92a7ec166726660a1ac1c325bbf77ca66135a568b91ef664841bb9e6449b WHIRLPOOL 71e0aed5e55f26e3d0fa58390b8ff7639d659c3e78bb20735a408bc89a4a6e9b91ce3213cc19bb5075f10c8d8b83c273a445c53049f9b5c70a7f82fd5e991350
MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431

View file

@ -0,0 +1,12 @@
diff --git a/Makefile b/Makefile
index c81222f..1a90927 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-PREFIX=/usr/local
-VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
+PREFIX=${DESTDIR}/usr
+VERSION=0.6.5-$(shell date -u +%Y%m%d.%H%M%S)
GOBUILD=go build -ldflags "-X main.Version=${VERSION}"
all: gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse

View file

@ -0,0 +1,38 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
inherit eutils user
DESCRIPTION="This is the new backend for Git-over-HTTP communication needed for GitLab >= 8.4"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-workhorse"
SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.bz2?ref=${PV} -> ${P}.tar.bz2"
S="${WORKDIR}/${P}-8a339b468723d371ab408b528c5882481247f75e"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND=">=dev-lang/go-1.5.1
!dev-vcs/gitlab-git-http-server"
src_prepare() {
epatch "${FILESDIR}/fix-Makefile-${PV}.patch"
}
src_install() {
local dest=/usr/bin
diropts -m755
dodir ${dest}
exeinto ${dest}
doexe "${S}/${PN}"
## RC script ##
newinitd "${FILESDIR}/${PN}.init" "${PN}"
newconfd "${FILESDIR}/${PN}.conf" "${PN}"
}

View file

@ -10,9 +10,11 @@ DIST gitlab-ce-8.4.3.tar.gz 12187867 SHA256 bc11494885c6ad41f2b6a057d7fbec2fd4df
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
DIST gitlab-ce-8.5.1.tar.gz 14277708 SHA256 74eca700809ddcbcd3d386ac2042f3b9b85b8f2685df1ef47c253f265096be25 SHA512 107fdeb139cfa7575a9d9c6d0cb27632dbc74b49a178378fd5ca2f7887c847cd5aee96d114f08d7c69ba3c912aaf4f3fed7c03494150819a02acf3edc07e383d WHIRLPOOL 2649d06a908fcc570792f1fac12a18daeb36de08987ef4501b5b756ea785c07b73e01a4a2d4d4eee640619acf209036a4d997b08e302439f96f3675f06949b4a
DIST gitlab-ce-8.5.4.tar.gz 15178874 SHA256 5c6d6e3fc0ffed85ab6850b6cd87bc62797410bfa59af06c3450bb435a5400f9 SHA512 826ee6e3101d230337cc69d19096e092594530f918e42289eba497081b5cae646f94a0b3c95cd3aa1f2c874c7037f3d06800723fed7c340e879ad746b34b8456 WHIRLPOOL 7f745bc2a6591b7959a06fb8d14f8f2ed2a25995f7bdd5fe263aad520563e9c4a3b425bea5da5f2647d3919e10c39543a6d7b2d18a8b37955d0c85019c4a14c7
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-r1.ebuild 11726 SHA256 4ff8cf27d461028f82b3c463bb59e0161979018f00c97815245ed962b2470d8d SHA512 66c13b9330c71de051c9ef8a78b25661a2e01fbe787747ce78175e202fbac02dfea42b7cc53b45b6d335d88602491f9e8266d4097c3271f12ed7f2f22ab68dc4 WHIRLPOOL 9abfd5c6839a9f542c96a7987b597ad6cd9c02f326fee18f113823775ffe7b9a6d8f23f5bcaf37e769e6eaf849d5756f945701407e9a90f2316889404e0e7b2f
EBUILD gitlab-ce-8.5.1.ebuild 11726 SHA256 4ff8cf27d461028f82b3c463bb59e0161979018f00c97815245ed962b2470d8d SHA512 66c13b9330c71de051c9ef8a78b25661a2e01fbe787747ce78175e202fbac02dfea42b7cc53b45b6d335d88602491f9e8266d4097c3271f12ed7f2f22ab68dc4 WHIRLPOOL 9abfd5c6839a9f542c96a7987b597ad6cd9c02f326fee18f113823775ffe7b9a6d8f23f5bcaf37e769e6eaf849d5756f945701407e9a90f2316889404e0e7b2f
EBUILD gitlab-ce-8.5.4.ebuild 11726 SHA256 228266c21fffb950f63be36d17ae104c55c263bb92bad34c2b01a1af0a18779a SHA512 b1ce2591a7c77a8ea87c963ddca613014846052f1e1b4d5a81dd53749f013560e86663fc0bc9489f390738b05cbf19dada888d28ac50c33c49e44305e588f12a WHIRLPOOL 5e2737ebbfb75cf99d4d3eac3cafb2ced0eb7fc8829b145550792d119b8c8ee42250d7f8c672da31be86824f9d0f88e9a8fef1a859989f0368cbbe6a2f8cade0
EBUILD gitlab-ce-9999.ebuild 11742 SHA256 1cf7eb55e970f6530edeaa5d86e7aa9235f4b5774579f63e8e484232e4a57b0c SHA512 f68fccacbcc0aafb379adb74e0c64fe9122a04bffabf5e000dd546a344fc677c90e16cd9f2db199fe61e8660933754cd08ee8c75dc9cd657c7cf2b4f61410b2f WHIRLPOOL cbb8fb6595a5f4bf649b09425181e06e73997934512e58f63ad8be6b164422a244e27c626783185a2f223379aeddff1f83f845c0735c03d301e2703446b22fc6
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View file

@ -0,0 +1,381 @@
# 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.5
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )"
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. Run these commands (as root):"
elog
elog " cd /opt/gitlab"
elog " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production"
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 initialize the 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
elog
elog "If you want to make sure that the install/upgrade was successful, start"
elog "Gitlab now and then run these commands (as root):"
elog
elog " cd /opt/gitlab"
elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production"
elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production"
elog
}
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 $@"
}