added ebuild for gitlabhq-7.10.3

This commit is contained in:
Manuel Friedli 2015-05-10 13:18:47 +02:00
parent 724130d849
commit 622e6396f9
3 changed files with 402 additions and 0 deletions

View file

@ -42,6 +42,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.10.3-fix-project-name-regex.patch 672 SHA256 cbf6cc10c38e06f081ca855fe81e82940472a90dacfc617ea2a76c3dfabcebd9 SHA512 6db76b5e366478839e3ca2257ae745849d5d95743752917c065cfbb40150924ef2dfc30dafbff87cd482b6fbe0dc044cb837afb2c4c9a382cd12b3f5343aa223 WHIRLPOOL 4d4212074bbbdeb9bd541bfe7670eda0d2b2a304c54c88902c935407f64a5995084f8344c1da6babf721a05f96279bf2e99b6a2864852fe692713e1d90bd27bc
AUX gitlabhq-7.6.2-fix-gemfile.patch 2402 SHA256 9abfdff94da0fe5b6db4d740688af179b93cf56c1ecb915c12bc0a5440295c4b SHA512 ce948a768a0803794e102b062fcdfc7569879f3ac649a1cc86f222053810dc758dbecc41834d06a1f6a3e5e03cf36dcb368e24a47401dfac7f6b8c5197706359 WHIRLPOOL ac7696de8bd143dec22cf3e31807249bd1bb58424edeb8de7745afffa8007ecefd577ce11dfe5de2080d87ab19eb7198ddd2d89f06eb96b5e4c70e2476594f27
AUX gitlabhq-7.7.1-fix-gemfile.patch 2322 SHA256 0ae2e911fdd2b8c4902222b19efb73d12178c40a9e17a8c98b272ae7378782ab SHA512 d1c4f79325bfe4ec71befe209264339baa61c3028e884318d718a4115eaa866d594e88b5f6b222beb0746cf7e07e92012b3097bb287da01df025d1ed7fad5987 WHIRLPOOL 253e496a91453f90ab640ccb03bc02f2e1ee9a439a3278a6d21feb36d87518d7b834c7f2a012ad14c2bbc42b36817f7d8a093940f91a2d913bf7913191193a7a
AUX gitlabhq-7.7.1-fix-project-name-regex.patch 715 SHA256 b026094b1f910226ddef2365d55d555ba6ebb99c17abc1eceb3906a101bf9f1b SHA512 041eb436089508266a572ec97d5c2d934747f1937fedb81bc18b9a85ace663cd0628d409e037e78d7381c8e968b9913121e09ca152fa35a7b372642b93643cdf WHIRLPOOL d548d403201be0068027dc73b63870845c6c109ee820af4495ed9969165a0fa39a837c0343fe2686a297f845dcc7306fa71fd98ff4941ccf584842d1046748b9
@ -54,6 +55,7 @@ DIST gitlabhq-6.8.2.tar.gz 10558471 SHA256 db9400d5ffadd3564bbee6e388c90d7f4c8f8
DIST gitlabhq-6.9.2.tar.gz 10566288 SHA256 2c01b223c3e889c7a45d3815f352c0546a337286d395e4d49df5ecedc1a57dc0 SHA512 b51b4e261666c14f782ce7edbbda24b6d32bb080c5444249f5c38e5233398b30f50a17cc8cbee18d75e57ba11ec3deeab4ffd1a6d6257c1858f8fe63e5138e54 WHIRLPOOL a3b9a8149fab69443b769aa145eb2c9a99bfc9f4a080edf0a6bd46c4771247b6f1c729bf5185e63bf63a02d654145362b7c8e9fefef6f0cdf1f4f30a32cf9dcb
DIST gitlabhq-7.0.0.tar.gz 10678947 SHA256 72f0585cb54c70d1da6ca8e705e19cb3715cf79908c807015146ac628ef9e1ba SHA512 4eec41624e24060c904d4f07685bb213b4f7eb28e10820faf42bc9aabbbd6c74262663a91e1b9f2c09f008228d6b602e77a34245a9c6dedb1e9f813f13fa3193 WHIRLPOOL fb955ade8df35efbb4a1cbec1ef883f711be355d7558b737a5a598e6c1bd099e2379258d6e7f2db32e77b6cb1778e31d0b9e5bf5950845eda764afaae309901f
DIST gitlabhq-7.1.1.tar.gz 11977881 SHA256 3a0268dfa8747f64acbd1121fd2b927aa7c52e5013ca1c27621a3a28bdc7773c SHA512 8469e7ca93a171f752db6586e66150bacd2cffadb25077fe321164af9d9ecb2d7bd30c29e632d585fa20ae729fea7b522ee70cce91c5a378c098f5f0f4b521f7 WHIRLPOOL 13bba5996e0c4b5c89b5e4954c08a5a41482575a88105489ba7f614dea5437e9cfaaad0087e461c1abfb331142d834cf9941d54fda2aef8d1dc12320cf2febb7
DIST gitlabhq-7.10.3.tar.gz 5690032 SHA256 e0d442b3c2bc4ae19bc0f146bc9ee0c07275616323f3aa9ae68a6021cd9e0e42 SHA512 46c59389aa9d699747cbea4790ef89f38b2d7c9a7b7452369be6eba47a3136c1ea8fa12c8a74a40e6700d83a238fc6aee78c7a22468878417e1f201e4f4e077b WHIRLPOOL 37ade7b0c5e33eb1ca018b461e12bbd83d15d89b0201e17e2857d595fca8f3fa783098fc7e090789a00786a83d7299f3597e664a2cf1fe9ea66690c4c8a325d2
DIST gitlabhq-7.2.0.tar.gz 2694271 SHA256 5333b5da7d54a3b714a6d2e438414c1a7c3435ac6b1f42d18e55db60d975e183 SHA512 95ce8db984e77f66fc344add6735c44683cb48963d403056cb74a771e33133184a83a7ec6005262d50c0a2ee11610c3815c2a9675a2969ca6ff55c4098b3440c WHIRLPOOL 7a2705b44805453a866fd3ad6c02b5176a48d574259768ef2682367b835aaa059951a7df1bc1ad0e97d9513c58a56d91b6947e85a4873168b481482f16bb7f65
DIST gitlabhq-7.2.1.tar.gz 2694643 SHA256 4ef07e8d9db33b95a9016f6b66b4c90a3a5f84c607812255564a41c8fb4beb44 SHA512 f3c6ff968225b3dc3a35cd0d5e81262d2e1b4b195913e146e60aea6006be0928ca4b39b0f4148a4cdf20f5ff0daebdfe4a2c66c027019da002e26dfbff412542 WHIRLPOOL 53286bfb5c2f9ef5525bb3e781c29894286c794dc93dde29ad86de429860f814dd7be12e6ea71d209a60f55bf51241113e113ad9397d40b3ba5d5d5b5f1a4085
DIST gitlabhq-7.3.0.tar.gz 2719960 SHA256 799791397b86f447e81aebedab1b98ef5161807fbd1b03b88776bd479e5a59c9 SHA512 b08dcf572793622796e7f9cbdec5a37071eb950424923e365d224392fd2614539249f672b1e62ed546e076eafdd64bbe7da3b785d1b43d3a3d982064b7021342 WHIRLPOOL d72b918ada104a92781613e0d90c93f1692ee60eaf7ce7b7bfb6f17865b67d57330d154192b0113835e4ed713f08c29954ffa70637f9f002f08eb4aa9b87d2b0
@ -76,6 +78,7 @@ EBUILD gitlabhq-6.8.2.ebuild 10595 SHA256 24317d99bb9d0e220c11a37709b1b701b9cd7b
EBUILD gitlabhq-6.9.2.ebuild 10616 SHA256 4221acadb5ac65ca3d662a2a560ff6343e04e0ca14dbd1b5bdd8f6a07812f7be SHA512 161c587d219c0dfd54b92805f7378aa7b1750bb25e632a16b67e3d24b28fab95f8f4272d685dfc70f1d7bfb15449a208fbb8b343dd8f902d8855034ed7f855d1 WHIRLPOOL effe560de13a29de88bf42aa927ddc2781373722a0e9a83ebef8942b0128208e35658a6b43d1bdc2d6e2b80c43b836dc8cc431f5d38912c201c789f70076e245
EBUILD gitlabhq-7.0.0.ebuild 10489 SHA256 dc516d152236488ce8f054a6beed86fe57383d5ca9ecc8d851f22124153a5665 SHA512 e8d50428e0ab88e68a6e8d8978edf0670c29e1acf0202829f50e3a8240859f5a2e7a761b0b0073742145d45e1cabf9f450250fd3bd89ecbcc995f41b0ba183f1 WHIRLPOOL 162364a3b5f9b0095f1f8923527119d109cb62c04047a398e45b411a23737c6aec15c54ab1680dafd8a59ab63f24b81eea5fbbbcb99e5f75383073c74d235d8c
EBUILD gitlabhq-7.1.1.ebuild 10496 SHA256 932f9fd44585eead0138bfff19f151d8d7a1ca7b2502833ba7c4c08a34727a40 SHA512 6a97d71a28c078a0020afbb238e73859a26d02c532ed588af9a1b266abf5a3117e838a335f58a71671a6b460e34159b6db534434416a49f83421054b45da0adf WHIRLPOOL 64baeddf75c071bc1e9b8a4e572f8eed7d607f862defc1b6c3432fa6ad7a38986d55170c72d195f7fdf48b68eb3adc734e192df6a1a28f19a50f28c53dc7aea3
EBUILD gitlabhq-7.10.3.ebuild 11280 SHA256 b68816f36f41d7c2771448db041b56c9c12d82b6326856e37c26b0d763463e2a SHA512 f7ad09d20d0c5a9167f5e9118ca56a6ce9b441e5c80d3d83dc5ed43d8809026cb285941747283c0813651a89fc3a0e25d0a1c11ab9efdf282dfeb8349214ae7b WHIRLPOOL 0b34c86392af8607a4a30c3b51dd4ec0816d4af0183e50cbe750105a644c0b6bcfc34454bd78cbdb6a5d358954cf390593778e3f5aa6ad453604f6e4a4722e05
EBUILD gitlabhq-7.2.0-r1.ebuild 10595 SHA256 373abd70eb2fdf0fed9be0f3977d1df8a5f94b9ea1e2afacf0746d42ce56cb6a SHA512 fa621dc17428785e06be60012469cc5711017ea2b403ae6cce06d6099d6258dbadba13f1ba7d32193bfc1b1bce9f58774dc61cc9061091cc105df3b6b87a91f7 WHIRLPOOL dfef55ddc4dd17e4814f290852b8183b173627d4d50fff84d8f293efb358e9f27f4dda892b734fdb89b17496b2a87743146cbcb3f5140f6fb3e0f7576fc01ddf
EBUILD gitlabhq-7.2.0.ebuild 10557 SHA256 c392f2569835fd1908f2765ed6974cdb4415ca4630a73e52d41625a4eb306452 SHA512 d2aff74fa6ec12760a1c83028f613dd769bad1b410f7d52c365581e6ff11b313392bf83208e641d5257ae77501457871fefacfd4f241793317779b7090d0b2d8 WHIRLPOOL 95df94eadbaee34bc0f8a49dded23bb24bdec5791affcf7c3283803deafa809b39f0295269ae57e16ccde40701a3389e73deb775a82261369a38ec32cb264ef8
EBUILD gitlabhq-7.2.1.ebuild 10595 SHA256 373abd70eb2fdf0fed9be0f3977d1df8a5f94b9ea1e2afacf0746d42ce56cb6a SHA512 fa621dc17428785e06be60012469cc5711017ea2b403ae6cce06d6099d6258dbadba13f1ba7d32193bfc1b1bce9f58774dc61cc9061091cc105df3b6b87a91f7 WHIRLPOOL dfef55ddc4dd17e4814f290852b8183b173627d4d50fff84d8f293efb358e9f27f4dda892b734fdb89b17496b2a87743146cbcb3f5140f6fb3e0f7576fc01ddf

View file

@ -0,0 +1,25 @@
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 9aeed5e..7d909f6 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -1,3 +1,5 @@
+encoding: utf-8
+
module Gitlab
module Regex
extend self
@@ -24,12 +26,12 @@ module Gitlab
def project_name_regex
- @project_name_regex ||= /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\. ]*\z/.freeze
+ @project_name_regex ||= /\A[\p{Word}_.][\p{Word}_\-\. ]*\z/.freeze
end
def project_name_regex_message
"can contain only letters, digits, '_', '-', '.' and space. " \
- "It must start with letter, digit or '_'."
+ "It must start with letter, digit, '.' or '_'."
end

View file

@ -0,0 +1,374 @@
# 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="0"
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
# 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 )
mysql? ( virtual/mysql )
virtual/krb5
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.2
dev-vcs/git
!app-crypt/heimdal"
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=(
"${PN}-7.9.3-fix-gemfile.patch"
"${P}-fix-project-name-regex.patch"
"${PN}-6.0.2-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,mailer,system_hook,project_web_hook,gitlab_shell,common,default"
all_ruby_prepare() {
ewarn "Please note: This version of the Gitlab ebuild is unslotted, unlike older"
ewarn "versions (<7.8.4). Therefore, some directories have changed. Please update"
ewarn "your configuration accordingly. The changed directories as as follows:"
ewarn "- /etc/gitlab-6 -> /etc/gitlab"
ewarn "- /opt/gitlab-6 -> /opt/gitlab"
ewarn "If you feel uncomfortable with this change, please abort the build now."
sleep 5
# 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_newunit "${FILESDIR}/gitlab-sidekiq-7.service" "gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-noslot.init
use unicorn && rcscript=gitlab-unicorn.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
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 $@"
}