added ebuild for gitlabhq-7.13.0
This commit is contained in:
parent
180d2ac848
commit
93c97536b4
3 changed files with 422 additions and 0 deletions
|
@ -3,11 +3,14 @@ AUX gitlab-sidekiq.service 1192 SHA256 3d1bdb5e653448a46ff2530321090ac5c8897121f
|
|||
AUX gitlab-unicorn.init 1657 SHA256 5fe794938b27d25488affc174e4761f5a3a1f9b15489a05f3839b13e4fd5b5ef SHA512 5e005ec26151afb4cdc8eb83592fad6814bb2a3ac8e9f642de83e70cd8615bdf969803a2479f8f72a70e0ae5ab5559da205965b55b3b4cdfdc9aa74055eef6fe WHIRLPOOL 6c61db597311ac618822fb22d7f51c830e5c011ce8e4c790338b3203a4483f3dd121bbd9cc33d7e1f92a2b0527e59816742f8ef0fd531c4c28c36d886fc94196
|
||||
AUX gitlab-unicorn.service 917 SHA256 282c1b08ec13b8670018985278a25d013d6336ab23b0ee815cb36b34ba678391 SHA512 6288c7c096fb38976c5b6218e46b7da53dfea73e834d1902876d0b15e1173fc56600c511e5941c2f6f61e2f5ef50a7cca476ee14a19b516599d6eb0594e2b8e7 WHIRLPOOL 33de53ae81af49d02d8e8a4e2e741bbccfa5e657939f433515ee7fe81aa55a706e094062ebcb67b7dbf19d21bd37070f4294e095cd955c2f94dc2c3842a008d5
|
||||
AUX gitlab.conf 137 SHA256 e0cceea29f2c3e1f7c94a9ab37640a31d4966b106cc01f47fc77b5c721aa9489 SHA512 7d41510eb288e47676d1bf60e92cedd04ec07e1af12cfcfcb5b75d4eed5ee320f41d3369831f9a2361c570289b885f4f00cb365e418a0d66bee6a5a78060582d WHIRLPOOL 27ea7e1109ed34367664c0e4d7cc968d300e6e2bdc3a66f0eba87023a1659f14115cf25535f438f7947a19b1c51c1452d3bb23db120442ba3be20b310a87317f
|
||||
AUX gitlabhq-7.13.0-fix-gemfile.patch 1478 SHA256 99050e17841670f03e9430e1f0409cb0194b49ef3235b90c13a4bd66a2648ad6 SHA512 9b0ef71867d4049970295f1ac015e3a4917a24c61edab3452f75f9652e21b94f3dd859247bb28622cd032fe33d4ebcec7b262488841540b48e387f11399c9a8b WHIRLPOOL 9db14e3339e1038dbaff9344f3472c6e23209fa6edbeca35c3108723fd39cb93420361ffdade21fc7019a1e873283524db6e38868ee247ca11a5814832083aa0
|
||||
AUX gitlabhq-fix-gemfile.patch 1456 SHA256 ad7deb355b74a156ef04c031ff45946a4852d273b30c4bae2be5b2cb11d0d683 SHA512 f0535f57338833f734701ab9c64a1a1dc9f7d6e7c634756c18e98bd5c6811876e2cbc7d64bd93297d5717d1d1e4f9213c7982c32770000698dc7a718a7b00155 WHIRLPOOL dfc2083e7c3c7895a01f4e1e588610f542a38a636ce9af1165b5c0fa4301fa91a6b58f24833ab9e754ea3024e48894b6b58ee9e3d2acec6cddcc1ecc515b097b
|
||||
AUX gitlabhq-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
|
||||
DIST gitlabhq-7.11.4.tar.gz 5731377 SHA256 42e3326a44828bde722e344b85bea6b46cefa803feb754b4a0b50582480af5c8 SHA512 5a98a9bd0e102403a5d528d87b8e7aede114e37f32141a1bfe259e1efb4a7c63d57f18b32d290cc3631170619c06602e0e4252ba04045f25cc35e23ec66772ef WHIRLPOOL fbb6ff540bee4eb2d2985ff4dd58cfdb82689d58cde29e3bf233943b2c018ab0c1c4c902fb763c2f72d35bf0a1d0a13365e78995310aa23756f6d909f1ff711a
|
||||
DIST gitlabhq-7.12.1.tar.gz 6095871 SHA256 ed14b4e81c548d0e56b2c872db76f3e9fa5a903a98a1ec80bcb580ba281b6a09 SHA512 6c4766e306c02367f5e03206b2febfd660464d1f55319d2fef9f6d29eae64237ff9d6a0c2891a8a9646bc479dc1704f60bbfbc66634475b88d766402c1c10c19 WHIRLPOOL 5c1e5d42ec2aa91eeafbe75d90b4c1a7b01221321e8b1cf8f08af656800237d3656b373703a7df117763ed639e7d90f659e41b40295f0a43f2ad8fc806b624f7
|
||||
DIST gitlabhq-7.12.2.tar.gz 6096090 SHA256 270f0c5a03a1e7ddb7cf7556f2b13c81c1def54ef90f8919419ffa3fa0c95e05 SHA512 b1996a88e6aadfbfcaef21953db914667cfe59c090be6f6dc1b14c69e1afae2c23baae1e5af06fa2bd8a38ab86b225d7c931d1ae9c18def7e0eafe291c5e96a1 WHIRLPOOL f365922e9532e42d8553e7073ed226b4d177afe3ff9597cbd11b37615028b2e046b25fb41ed80ea0cdc086348accdb633c1f3aedb56908d2ba987b9af27f4b60
|
||||
DIST gitlabhq-7.13.0.tar.gz 6364481 SHA256 3ffe2a8c0080b757b9bec422b2c6c9adb86effd453c92944b7273eaa42001b8b SHA512 9b1220e4c5783579d547455d55768b6f811cdde7243031b8c8d4a79b9cd6d4259fd7be214734a4dcf7e905dba3fe306b5254d2c82e26f1510acfa78a48bff52e WHIRLPOOL 3f7524bcca5b91daf17f4b54c2666fe98dbc2a1e2a192fdb7902e63d5495eb193a114a78f117859381aeda7ee760970b581c5483375fc957d9f48e1f3da74287
|
||||
EBUILD gitlabhq-7.11.4.ebuild 11204 SHA256 628ea499dbe687ff9d086139a3f9df78551926507fa592c255d8b777de5b1a80 SHA512 89eec325b45024c95794ccae2d7498754d894d1d514c064dc41e1b757a96141f6489c7f394c54112604e53c21df5b178246f28eb3afccc15b5fbdc06fb691ca1 WHIRLPOOL 263f97a5f992a21b6dc64182cceb8598339406e8a8ada4954729989716ea80a47618e4596c58c3d34f9f9e86b3ec0de19047f3b249a8f59b29eca1370057a0a5
|
||||
EBUILD gitlabhq-7.12.1.ebuild 10832 SHA256 e0528cb58c30189ccb6de155ea6812ec5166f2361dba25c105681ca111c9d9c5 SHA512 36cdc8aabe4fe25cd68d9138598ec0e3f6cca8a6d6d82981a645419abfa729c1b88afd7377dbbff97eebd1686cd9aac280113227516734b882ccd6fb54d9da7e WHIRLPOOL 7c0446ec2c0f08596d4182e41f895a160ebef3151a39d17d81c68e4cb18ab65b0aba84b972df8f4378f29db4c381151485270ad2c158cd8270154feb08968eda
|
||||
EBUILD gitlabhq-7.12.2.ebuild 10832 SHA256 e0528cb58c30189ccb6de155ea6812ec5166f2361dba25c105681ca111c9d9c5 SHA512 36cdc8aabe4fe25cd68d9138598ec0e3f6cca8a6d6d82981a645419abfa729c1b88afd7377dbbff97eebd1686cd9aac280113227516734b882ccd6fb54d9da7e WHIRLPOOL 7c0446ec2c0f08596d4182e41f895a160ebef3151a39d17d81c68e4cb18ab65b0aba84b972df8f4378f29db4c381151485270ad2c158cd8270154feb08968eda
|
||||
EBUILD gitlabhq-7.13.0.ebuild 10831 SHA256 c6ab27d9a22e3648161b11d722940abd44729ad051eefd59894c01d55aece8a5 SHA512 3b8800099bea40594d048fb99f5ff8bb261814d744497c49af45382eb2e812a1c7c647e97f02ecf61f953245345abb9318f0489a2a1a3be70cbec42c6838ef49 WHIRLPOOL aad3e5547a634ae2da8ef290719f1a3e069f49d3074f72ea291bd341131c7c4fdc5dc96e8c98c266678f291327a199f79ac884b1a3f6171a1684c21e0a4d3011
|
||||
|
|
56
www-apps/gitlabhq/files/gitlabhq-7.13.0-fix-gemfile.patch
Normal file
56
www-apps/gitlabhq/files/gitlabhq-7.13.0-fix-gemfile.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
diff --git a/Gemfile b/Gemfile
|
||||
index 9b7fd18..2bcdb94 100644
|
||||
--- a/Gemfile
|
||||
+++ b/Gemfile
|
||||
@@ -173,6 +173,9 @@ 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", '~> 4.3.0'
|
||||
|
||||
@@ -182,9 +185,6 @@ gem 'ace-rails-ap'
|
||||
# Keyboard shortcuts
|
||||
gem 'mousetrap-rails'
|
||||
|
||||
-# Detect and convert string character encoding
|
||||
-gem 'charlock_holmes'
|
||||
-
|
||||
gem "sass-rails", '~> 4.0.5'
|
||||
gem "coffee-rails"
|
||||
gem "uglifier"
|
||||
diff --git a/Gemfile.lock b/Gemfile.lock
|
||||
index 6e57107..5656ef9 100644
|
||||
--- a/Gemfile.lock
|
||||
+++ b/Gemfile.lock
|
||||
@@ -1,3 +1,10 @@
|
||||
+GIT
|
||||
+ remote: https://github.com/brianmario/charlock_holmes.git
|
||||
+ revision: dde194609b3513b0d2369ce8f916ae52566154b4
|
||||
+ ref: dde194609b3513b0d2369ce8f916ae52566154b4
|
||||
+ specs:
|
||||
+ charlock_holmes (0.6.9.4)
|
||||
+
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
@@ -97,7 +104,6 @@ GEM
|
||||
json (>= 1.7)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
- charlock_holmes (0.6.9.4)
|
||||
cliver (0.3.2)
|
||||
coderay (1.1.0)
|
||||
coercible (1.0.0)
|
||||
@@ -756,7 +762,7 @@ DEPENDENCIES
|
||||
capybara (~> 2.4.0)
|
||||
capybara-screenshot (~> 1.0.0)
|
||||
carrierwave
|
||||
- charlock_holmes
|
||||
+ charlock_holmes!
|
||||
coffee-rails
|
||||
colored
|
||||
coveralls (~> 0.8.2)
|
363
www-apps/gitlabhq/gitlabhq-7.13.0.ebuild
Normal file
363
www-apps/gitlabhq/gitlabhq-7.13.0.ebuild
Normal file
|
@ -0,0 +1,363 @@
|
|||
# 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"
|
||||
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
|
||||
#RUBY_S="${PN}-7.11.0"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="kerberos 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 )
|
||||
kerberos? ( virtual/krb5 )
|
||||
virtual/pkgconfig"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
>=dev-vcs/gitlab-shell-2.6.3
|
||||
dev-vcs/git
|
||||
kerberos? ( !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-sendmail-config:
|
||||
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
|
||||
#
|
||||
RUBY_PATCHES=(
|
||||
"${P}-fix-gemfile.patch"
|
||||
"${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,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:).*|\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} ${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 kerberos; 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.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 $@"
|
||||
}
|
Loading…
Reference in a new issue