added ebuild for gitlabhq-7.6.1 and a patch to fix the gemfile to use a newer version of the krb5-auth gem

This commit is contained in:
Manuel Friedli 2014-12-26 01:44:08 +01:00
parent ffb117a684
commit a11a55bbd4
3 changed files with 485 additions and 0 deletions

View file

@ -40,6 +40,7 @@ AUX gitlabhq-7.0.0-fix-gemfile.patch 2185 SHA256 48070f5cd7e16ce27abad8e2cf80493
AUX gitlabhq-7.0.0-ldap-custom-mapping.patch 2708 SHA256 8592744ba8b373b2e89c76d7ceb6c755bd46e2c2de6143b3f1d9967e4b6e5fb3 SHA512 a172444da26ddc9dfebe0c0ead4a2eb73a77ac44dfd9b3dbcf2b3faa679d963db080d2979d707e337b99f8e6384ccfd323f5d6e70921d193e99db75a4ba45b38 WHIRLPOOL d25e1f78342c781d26b84c09bd7eba08b46375c2f353b358f838602253dc2fe57807a437fc0c2891a6bc2893eba0bb278bd605ab8b6c837101a783c84536095b
AUX gitlabhq-7.1.1-fix-gemfile.patch 2184 SHA256 9ba304baa5a17f1b0637fe243f551ddcc22cf32c3e82b7dc5b1a5cc0c5fc5876 SHA512 db8757874f136fc6a1d138feadbad6f8dfc773446f969b76a4715901dac02c04c978133ef3e9218b9c4a3d0173f53c0d14608ae123ee300a803529cbf232a1d1 WHIRLPOOL 27adf9392f3f1cbc6288afc1aabc174850a689f47f015c9d638b62769607e6e4f5ebe8bcb3811ee189ceeddef7c5bca384b322d15c0008b8867887f26d6188e2
AUX gitlabhq-7.1.1-fix-project-name-regex.patch 638 SHA256 9f3dfcdc4365422037ecc8854b10e2cf96f4fb9508a6d5214b16c3545ca1353b SHA512 4606eade95b75e31eb791d793e3571c4e998c2d451e1f92ce70fba06e3a29c74a17f2fedba24ded4dbdc6db3da87960890552869fd8790caed26ff6fbb201717 WHIRLPOOL 6470de727d060556cc1413ac23f3c3198035f3cd7b05a291f7dedfcd9071a5afecca57c15f7387a84d9c1830118e47fae4fc72ba2f2e67c346bf18c4dae09865
AUX gitlabhq-7.6.1-fix-gemfile.patch 3007 SHA256 ebf9089d3821c25e0720b307b6607e1fedb025e4cc5e4aa3a6c60f38ccf98bc8 SHA512 a4a408e82c42a3933cb43469e15ba36b8ddcc677487f1337d20ca1a3007afbb5312ec2d187a12a5bae5a6956b218d419b71117dc992030bb6399b8816df4afc8 WHIRLPOOL cb2038a34770a7ee57d303d0c32d093c34878eeee8855be663065c6b35c176cb66c8978a2d41a987f212760151bead9998f198d6c924073b3e95e4b9323f2833
DIST gitlabhq-6.7.5.tar.gz 10229484 SHA256 547ed2807cccf08c11450a9df035dad8db66ab9f9d693db29e3aa1ee65edbae0 SHA512 a90c0cd3954bf20ece9e98626216a42afcb0cc07e0cb23874ab2065757805ac38a8dcf4e93d804a33caeecaf2c6e94d8566f5700cd4161ef9a0aaac089b9ded8 WHIRLPOOL 4d8f5ff3a1245c5e13fc3ff8f819160017dd4dba9f6a48c0f851272da5c97f45162d3e53f327002f1ecde7f31dd5f392bed8503b1b306d913bf63827777cdbcd
DIST gitlabhq-6.8.2.tar.gz 10558471 SHA256 db9400d5ffadd3564bbee6e388c90d7f4c8f88450e67213aad11df2d137534ec SHA512 0f57c6bb3b9e89a5bbf7ae4c774e54480518f185f2e50270a7dd921eb2a2322f3e6866ca70741582fad4f99b372ba025fbab15108c291d53ebf04cfaec2f9b75 WHIRLPOOL 73ebd0fb0faef7afd48398ec4e73c8f4175f3dc2a9450ae391b4d3a66b54e0d77f901f518738eb98cc267691559094d4ebecd4c0a7c18fa671c3a1aee4dfe4d2
DIST gitlabhq-6.9.2.tar.gz 10566288 SHA256 2c01b223c3e889c7a45d3815f352c0546a337286d395e4d49df5ecedc1a57dc0 SHA512 b51b4e261666c14f782ce7edbbda24b6d32bb080c5444249f5c38e5233398b30f50a17cc8cbee18d75e57ba11ec3deeab4ffd1a6d6257c1858f8fe63e5138e54 WHIRLPOOL a3b9a8149fab69443b769aa145eb2c9a99bfc9f4a080edf0a6bd46c4771247b6f1c729bf5185e63bf63a02d654145362b7c8e9fefef6f0cdf1f4f30a32cf9dcb
@ -54,6 +55,7 @@ DIST gitlabhq-7.4.2.tar.gz 4189724 SHA256 b116c49b032e5cd3529698aed3174b6f02748c
DIST gitlabhq-7.4.3.tar.gz 4189957 SHA256 e03092298526bafb65336a14944570083f96e960f9bdabf8e4e52a403e42a5f8 SHA512 24228e31c7422215309838b1c8c9f24d8b2c77691b480365548ade36be53368bd9cc04e8065386e83b501f8f3f97f365634297a1af2c93c285cddad2f8150af8 WHIRLPOOL 785b6ba8c2c94456c005b7fbca265a762990e24c5164d742d8cb34a0f370c604aec23490ceb034007444ffe65223e163a58364aa01c1d617404a3278ac77f0d7
DIST gitlabhq-7.5.1.tar.gz 4221894 SHA256 cbaef29b55c35b1428fb4678be76500e7f0c292aa72314fa457d94c61fb5e00d SHA512 fc99100aab666819c06df96fc7979cb108a42249d811482c64473a51ec38e89d325346a4e069666a9130cff9eab21a470e68724cbe53d135bf4dc3b52a6b8930 WHIRLPOOL d86887f196cdc8d2690ff0a788c70994b7192d39b89d47c63a8b0baad8102c22efac3b3dc6556eefba7bb5cb12aaad347e5adb7d9a5a591fd8ca1d7de3a5b493
DIST gitlabhq-7.5.3.tar.gz 4222058 SHA256 533afcf5b9a0683d2f920a436e552af8d8e953c78d03f150cfb8dcfa0da3112d SHA512 18e9d5ee9d39c8e11101d370228b8edd38ccbfc1b7d768977f3cdd575604d7f72f897484749f9d74988b91f8195c0b9452a47a6f83acb6a7890d4aac9dd9f1a7 WHIRLPOOL 0bf347b12c2d2b5d4bf4bbcd0ff790bccfa100d0ff818a77e0843e3ff1ce87a627cd541bd7e5d8160f0954477809c8539ac1c309c3bcbc0e0b517ad3f30193de
DIST gitlabhq-7.6.1.tar.gz 4239328 SHA256 96746351fdf05fc39f473930dcef4b25a02d9056c211004fbc14ad796b938cb0 SHA512 fbf807e6d9f5b9c0a6f86c086b6d69f0fd9ff268400432b023093053adf8d8b2e93e32675e0703df5cd00449af308f1fa6f649214d25bb00cd73c62437b60559 WHIRLPOOL 5f252240bf5e6722d7c064c52ce1e79548b2ab908487427aa4fee0dcf74652cd822325f1abb85aff14b83f19417626087fda489180bbbf6c10bdf8035d3ebc01
EBUILD gitlabhq-6.7.5.ebuild 10983 SHA256 79fe5e03f1f03625a27d5ef398bb4d40e991c71490eda27913529bcdebf03b5d SHA512 73d035742868747f4d1dbbdce0d2892e29bbea3fd2938a66d16c9c72e3ec6075c9faa855b8a46b7970a8879e9633a25b65d70f3cc9eb77a2656bcbcca64f6008 WHIRLPOOL b8a9531f544799a141b7c6ddfaea6cce5d2643832c38326ff13bb3ed37f009b0bb1aeeba3d1d2434d2e59b43747c380ea505fbebb1a082da94a4e2322f20f4bf
EBUILD gitlabhq-6.8.2.ebuild 10605 SHA256 5a7e869aee5481f5c610c81a130ea677de4977d4fc184839b3f7ce16152dacb4 SHA512 3f63b20e111e74d183e36acaa9499287801b18e53f4a1f0e0271f2d93625bf9b311e3a1634e2426965cefd7fe9d2a86114b71ba32f91abded11bd0234ebc87f8 WHIRLPOOL 3f77d6e351f6552932efbe40af389069bda3e44933a0ab426663574ff490665e7ae9a8cfc2726e378073816de7423e8c8269e3cee01b0a64299044a1f99d4811
EBUILD gitlabhq-6.9.2.ebuild 10626 SHA256 24d0e4410d93bce5bf9675a14b8618cc5590dc78b4b16a2a1b0b055b8d88fc6f SHA512 cb5b956a0b0699100704a66fff30c9d1706194b32f31208284b2622b81b3f612ceab17e9f6873cc97e0556f7eb009d0e9727595e72172b98b6fb91d483b3e5e4 WHIRLPOOL a7013e0dfc2ef18ad95eb060ebe301dc417e50420dad54f078625c699d0a4620ffc883ecb847030f7b2d4e590bfd2d901b72712f4a0af55bbf0ef6a78c139deb
@ -70,3 +72,4 @@ EBUILD gitlabhq-7.4.3.ebuild 10586 SHA256 aee278ec37ac8a5fd8af179a2e26785ba5abd5
EBUILD gitlabhq-7.5.1.ebuild 10914 SHA256 f7e3e82083b03d05ab5122245abde5fba8b62ada55777e70340fbb40615d0967 SHA512 d2aa8cd57d5f67ed02f83e2419c00a44b371b3bbc27cd2b3e9f15b284a3c350e6228af1ad105f03f765276dacc56cc05107c2a21d82c3d4f6b60ef335d9e8bcd WHIRLPOOL a2eabdb95779de550343d691b758f2e6d599e1d0eb21c3056c979cdcdb1989e798fa0662aec49a91550c6fd5ca6d9e65740cbe76fb743c6a2a600453f7543d78
EBUILD gitlabhq-7.5.3-r1.ebuild 10917 SHA256 af2ce5ac4315c3341252f73aaa9b59f04e2bb53160828c19890ead00865cff34 SHA512 2066d1ce213c915e3abbefc4c4bca979642e8d58a297e6c4a4acba0638e6391ee75a197b03b556d7ad5e567aa8e08e3cdb0abf8c05d14b9ed1f0862b9babe211 WHIRLPOOL 37821dcdfd2548bd80693a8ab274b860fb45829711c5dc33cf65a586c8a8d3aa8f4cce21c3a4473d7ae694896f7916381d9dda2de32691e2038ee4fe408b49a7
EBUILD gitlabhq-7.5.3.ebuild 10914 SHA256 f7e3e82083b03d05ab5122245abde5fba8b62ada55777e70340fbb40615d0967 SHA512 d2aa8cd57d5f67ed02f83e2419c00a44b371b3bbc27cd2b3e9f15b284a3c350e6228af1ad105f03f765276dacc56cc05107c2a21d82c3d4f6b60ef335d9e8bcd WHIRLPOOL a2eabdb95779de550343d691b758f2e6d599e1d0eb21c3056c979cdcdb1989e798fa0662aec49a91550c6fd5ca6d9e65740cbe76fb743c6a2a600453f7543d78
EBUILD gitlabhq-7.6.1.ebuild 10907 SHA256 28c08194e75866f2d9d42fe62ef25585a919eea57361460dffa1f95dc0717c04 SHA512 0476e30c7c7d7d0c8f26e06547d19a69ea4b57cc9b7cde80a069abe5b6114d1df7083c585bfde4b603a0bd8dd5795fab2b0882fe70f8f657b505b741f4603789 WHIRLPOOL 529b7365621f8fa5bdfaafa4115330e2da5df7b57dae0871e2234d0d8d9a169e87218cff213602e4613f6339c67c8dfd982c99a0f4fb85dab266ec1ff56f21a9

View file

@ -0,0 +1,115 @@
diff --git a/Gemfile b/Gemfile
index ce9b833..49ddf1a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -28,6 +28,9 @@ gem 'omniauth-google-oauth2'
gem 'omniauth-twitter'
gem 'omniauth-github'
gem 'omniauth-shibboleth'
+# Version 0.8 does not compile, so let's try tag 0.8.1 from github
+# This is a dependency of omniauth-kerberos
+gem "timfel-krb5-auth", '0.8.1.1', :git => "https://github.com/fritteli/krb5-auth.git", :tag => "v0.8.1.1"
gem 'omniauth-kerberos'
# Extracting information from a git repository
@@ -155,6 +158,10 @@ gem "underscore-rails", "~> 1.4.4"
# Sanitize user input
gem "sanitize", '~> 2.0'
+# The newer revision of charlock_holmes that is finally fixed to
+# be compatible with Gentoo
+gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
+
# Protect against bruteforcing
gem "rack-attack"
@@ -170,7 +177,6 @@ gem 'semantic-ui-sass', '~> 0.16.1.0'
gem "sass-rails", '~> 4.0.2'
gem "coffee-rails"
gem "uglifier"
-gem "therubyracer"
gem 'turbolinks'
gem 'jquery-turbolinks'
diff --git a/Gemfile.lock b/Gemfile.lock
index a93935f..66e2c22 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,17 @@
+GIT
+ remote: https://github.com/brianmario/charlock_holmes.git
+ revision: dde194609b3513b0d2369ce8f916ae52566154b4
+ ref: dde194609b3513b0d2369ce8f916ae52566154b4
+ specs:
+ charlock_holmes (0.6.9.4)
+
+GIT
+ remote: https://github.com/fritteli/krb5-auth.git
+ revision: 14e09f7fdd79962b146e0a6513fdb1b8e64c221b
+ tag: v0.8.1.1
+ specs:
+ timfel-krb5-auth (0.8.1.1)
+
GEM
remote: https://rubygems.org/
specs:
@@ -62,7 +76,6 @@ GEM
json (>= 1.7)
celluloid (0.15.2)
timers (~> 1.1.0)
- charlock_holmes (0.6.9.4)
cliver (0.3.2)
code_analyzer (0.4.3)
sexp_processor
@@ -280,7 +293,6 @@ GEM
addressable (~> 2.3)
letter_opener (1.1.2)
launchy (~> 2.2)
- libv8 (3.16.14.7)
listen (2.3.1)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
@@ -426,7 +438,6 @@ GEM
redis-store (~> 1.1.0)
redis-store (1.1.4)
redis (>= 2.2)
- ref (1.0.5)
request_store (1.0.5)
require_all (1.3.2)
rest-client (1.6.7)
@@ -525,9 +536,6 @@ GEM
term-ansicolor (1.2.2)
tins (~> 0.8)
test_after_commit (0.2.2)
- therubyracer (0.12.0)
- libv8 (~> 3.16.14.0)
- ref
thin (1.6.1)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
@@ -536,7 +544,6 @@ GEM
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
- timfel-krb5-auth (0.8)
tinder (1.9.3)
eventmachine (~> 1.0)
faraday (~> 0.8)
@@ -606,6 +613,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.0)
capybara (~> 2.2.1)
carrierwave
+ charlock_holmes!
coffee-rails
colored
coveralls
@@ -704,8 +712,8 @@ DEPENDENCIES
stamp
state_machine
test_after_commit
- therubyracer
thin
+ timfel-krb5-auth (= 0.8.1.1)!
tinder (~> 1.9.2)
turbolinks
uglifier

View file

@ -0,0 +1,367 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
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="ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user systemd
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v${PV}.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.4.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="6"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres +unicorn systemd"
## 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-base
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/cmake
dev-util/ragel
net-libs/nodejs
postgres? ( dev-db/postgresql-base )
mysql? ( virtual/mysql )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.4.0
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-gemfile:
# Remove therubyracer that doesn't compile well on Gentoo (we're using
# nodejs instead that is faster and better). Also replace broken
# charlock_holmes version with fixed one.
#
# fix-project-name-regex:
# Allow project name to contain non-ASCII characters.
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${P}-fix-gemfile.patch"
"${PN}-7.1.1-fix-project-name-regex.patch"
"${PN}-6.0.2-fix-sendmail-config.patch"
"${PN}-7.0.0-email-custom-reply_to.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}-${SLOT}"
CONF_DIR="/etc/${MY_NAME}-${SLOT}"
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,mailer,system_hook,project_web_hook,gitlab_shell,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:).*|/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} ${temp}/repo_satellites
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; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
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
# 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_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}"
newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}"
fi
}
pkg_postinst() {
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 this is an update from previous version, it's HIGHLY recommended"
elog "to backup your database before running the config phase!"
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 $@"
}