Merge branch 'feature/gitlab-8.5.5' into 'master'

added ebuild for gitlab-ce-8.5.5



See merge request !51
This commit is contained in:
Manuel Friedli 2016-03-14 14:13:56 +01:00
commit 20d961bb73
2 changed files with 383 additions and 0 deletions

View file

@ -26,6 +26,7 @@ DIST gitlab-ce-8.4.4.tar.gz 12186833 SHA256 f8c403d4cecd82aa2021ed5a6d5d7b4ac852
DIST gitlab-ce-8.5.0.tar.gz 14276001 SHA256 a43dd64cfb1e34bf273d31984b52ada09c5a48d5d077f5bd1f21a79960bb1039 SHA512 499d93767df9d3c9c4b68ac663846d49335bd989ee8e93a8d610cb6106900886913912443f908cd316424312df67658df5d6027fda9a5abd787572d4e23e14d1 WHIRLPOOL 225c40c9a1769dbd13ea736f6bdce2a9a3cd5bfca8b27ce9270f55beebd36f5b233858c0dee5f0d80cdf40c5ccc1af651d152743f5ede1f98a8a8496ba36b6d1 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.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 DIST gitlab-ce-8.5.4.tar.gz 15178874 SHA256 5c6d6e3fc0ffed85ab6850b6cd87bc62797410bfa59af06c3450bb435a5400f9 SHA512 826ee6e3101d230337cc69d19096e092594530f918e42289eba497081b5cae646f94a0b3c95cd3aa1f2c874c7037f3d06800723fed7c340e879ad746b34b8456 WHIRLPOOL 7f745bc2a6591b7959a06fb8d14f8f2ed2a25995f7bdd5fe263aad520563e9c4a3b425bea5da5f2647d3919e10c39543a6d7b2d18a8b37955d0c85019c4a14c7
DIST gitlab-ce-8.5.5.tar.gz 15179973 SHA256 859ec6142095d459b1587616df6c83063e87a8c7417ab8606100588525d03e2d SHA512 48f69092a68e2b6a748c35f5cea151f08856a7d19ab58a7f0a90d5b37c5276edf640ba42501aa6aec38008463fce21763b6ee650ad2e6e2b89e815d7f3f07b0a WHIRLPOOL 8db633ed71cb514df6fdb4515a74a4732efe5013d36ea140a3195aac82ec069863eb09e6d241f9416d6fe93fdec8c68e894cbeec3e0b6eba24c24c6d3b23849d
EBUILD gitlab-ce-7.14.3.ebuild 10996 SHA256 a632476e8fe87ec1a478d2229f9e27cbe9e7cc86351e411d9f15105178a4c69f SHA512 a8646de0798d7dae299e500e0a42e6b093e229cb666614b895b979decb1d4b6b398ec2b2f1d19e07cc115f2acb16536426d1769b65412bc51349ac1b262b3053 WHIRLPOOL 2ba4e53846507899b3e6ebb38063e11ee92904262b8a6e00817ab50d6634ed0f0b1013f4a0d8a1cbb26e18c4008e5ab457d3cbd0fdc5f92e5c6214cb45c692f5 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.0.5.ebuild 11185 SHA256 1240818953ae8f61b6c88c91c3c1dd32fb7d03c8a62964f5d3ad2e98ff5dad11 SHA512 fd411dd3cd8a4dd1ee0040438fe5da01f81ccf4f97b7b7b3157fcbb35bfacbfd0eda8754fb01e0061e6b0c5bd0e752b0eaff4d663d11b764623e7baafb4f56da WHIRLPOOL 9514cd8f83c7fbaba82b49352cb9b8e62d1a5317a09bfea85ce945abd1402e634a88f6eb033494729519ac6fc1282c18bfc8224b9bbe6f41ac89a1286b1d5d0a
EBUILD gitlab-ce-8.1.4.ebuild 11177 SHA256 6b920132ff2c4926f2ed3edb3fff7cdf3e88c0314f8a0a9c077cdaae9fad4a0e SHA512 617656f6fd52d0c4751e0726983fc7d2c1532e8bc44761dbbe5bfb7f489e18ef66a68769bb0f7736c9d49d536e8103a5486e92869a9bba4d1aa92c4068eedf6e WHIRLPOOL 1c8a0968a1fa7b95ceb47f66610a72585666cc5b2f7f3157d1f5c04f98a2c89d79ac1875a28c57b3116105d2e0af17dabcecaa00159af42166565ae7fa88647e EBUILD gitlab-ce-8.1.4.ebuild 11177 SHA256 6b920132ff2c4926f2ed3edb3fff7cdf3e88c0314f8a0a9c077cdaae9fad4a0e SHA512 617656f6fd52d0c4751e0726983fc7d2c1532e8bc44761dbbe5bfb7f489e18ef66a68769bb0f7736c9d49d536e8103a5486e92869a9bba4d1aa92c4068eedf6e WHIRLPOOL 1c8a0968a1fa7b95ceb47f66610a72585666cc5b2f7f3157d1f5c04f98a2c89d79ac1875a28c57b3116105d2e0af17dabcecaa00159af42166565ae7fa88647e
@ -38,5 +39,6 @@ EBUILD gitlab-ce-8.4.4.ebuild 11158 SHA256 134fedd2c467d11174a22055e58c822b953f9
EBUILD gitlab-ce-8.5.0-r1.ebuild 11726 SHA256 4ff8cf27d461028f82b3c463bb59e0161979018f00c97815245ed962b2470d8d SHA512 66c13b9330c71de051c9ef8a78b25661a2e01fbe787747ce78175e202fbac02dfea42b7cc53b45b6d335d88602491f9e8266d4097c3271f12ed7f2f22ab68dc4 WHIRLPOOL 9abfd5c6839a9f542c96a7987b597ad6cd9c02f326fee18f113823775ffe7b9a6d8f23f5bcaf37e769e6eaf849d5756f945701407e9a90f2316889404e0e7b2f 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.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-8.5.4.ebuild 11726 SHA256 228266c21fffb950f63be36d17ae104c55c263bb92bad34c2b01a1af0a18779a SHA512 b1ce2591a7c77a8ea87c963ddca613014846052f1e1b4d5a81dd53749f013560e86663fc0bc9489f390738b05cbf19dada888d28ac50c33c49e44305e588f12a WHIRLPOOL 5e2737ebbfb75cf99d4d3eac3cafb2ced0eb7fc8829b145550792d119b8c8ee42250d7f8c672da31be86824f9d0f88e9a8fef1a859989f0368cbbe6a2f8cade0
EBUILD gitlab-ce-8.5.5.ebuild 11726 SHA256 228266c21fffb950f63be36d17ae104c55c263bb92bad34c2b01a1af0a18779a SHA512 b1ce2591a7c77a8ea87c963ddca613014846052f1e1b4d5a81dd53749f013560e86663fc0bc9489f390738b05cbf19dada888d28ac50c33c49e44305e588f12a WHIRLPOOL 5e2737ebbfb75cf99d4d3eac3cafb2ced0eb7fc8829b145550792d119b8c8ee42250d7f8c672da31be86824f9d0f88e9a8fef1a859989f0368cbbe6a2f8cade0
EBUILD gitlab-ce-9999.ebuild 11742 SHA256 1cf7eb55e970f6530edeaa5d86e7aa9235f4b5774579f63e8e484232e4a57b0c SHA512 f68fccacbcc0aafb379adb74e0c64fe9122a04bffabf5e000dd546a344fc677c90e16cd9f2db199fe61e8660933754cd08ee8c75dc9cd657c7cf2b4f61410b2f WHIRLPOOL cbb8fb6595a5f4bf649b09425181e06e73997934512e58f63ad8be6b164422a244e27c626783185a2f223379aeddff1f83f845c0735c03d301e2703446b22fc6 EBUILD gitlab-ce-9999.ebuild 11742 SHA256 1cf7eb55e970f6530edeaa5d86e7aa9235f4b5774579f63e8e484232e4a57b0c SHA512 f68fccacbcc0aafb379adb74e0c64fe9122a04bffabf5e000dd546a344fc677c90e16cd9f2db199fe61e8660933754cd08ee8c75dc9cd657c7cf2b4f61410b2f WHIRLPOOL cbb8fb6595a5f4bf649b09425181e06e73997934512e58f63ad8be6b164422a244e27c626783185a2f223379aeddff1f83f845c0735c03d301e2703446b22fc6
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1 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 $@"
}