Merge branch 'feature/cleanup' into 'master'
Feature/cleanup See merge request !8
This commit is contained in:
commit
f17987e974
30 changed files with 20 additions and 5230 deletions
|
@ -1,19 +1,7 @@
|
|||
AUX gitlab-ci-unicorn.init 1700 SHA256 ad75c1774db69d2ceae61983ba7227bb840c761d69eb387eaba120553fcd038a SHA512 fc2005db1523777f96867a3983efcb256ee8a3f62146dfc58af5536c0c869d665870b2f6710fe1d2f014fcb921ec3c79066b67b0189a6b525a7aea7f1afff78a WHIRLPOOL c80e72eb0c8f14c56662f91f2f1b51d1bbc83d956dcd3915c354e95ca5c1231c575b1fec91398c345fa71af61efe654e78f85e9d75be3b5624e65021e7102c28
|
||||
DIST gitlab-ci-5.4.2.tar.gz 636802 SHA256 475e9fbb88f5206ad350ab21b9c800a31e90bfd771f18068d21109202961a175 SHA512 cefdeb9f20fec691f935340d4aabb2f9b11720608ec1f1ef037865b64e861aeb3d90a8ae2af16ea57c343b0da0c78973874fcb284a4cdf767831dbc5744826ed WHIRLPOOL ac2e9704b284986b605815f799729f22041a9944cbe8712ef567cfaea19718e69974957fa940d836a054472a30fa037d5c298ef9943272ef316ac24c1e06b80b
|
||||
DIST gitlab-ci-7.10.3.tar.gz 936802 SHA256 07f0ad3806068189b6e2d7ee08538c57dc23002a4c9318d5cc80af591f9dfd06 SHA512 e2b0fdd407bffe8b9d8821ef03c8266d83f0365a3b7024bdb1bc35f1486f2932f21e7369ad9aa8195966b5bd7e550036ce391b61dcb5c4e46d742a4d48651aa6 WHIRLPOOL fa7f9d4acde2b80beb74ee5d846606caf612558bf45aeca7e84c4f530b489cd5a1bc1727bc87d10bea219d90748da1745b537a5c07634acb463125fa61e6ed53
|
||||
DIST gitlab-ci-7.11.1.tar.gz 949770 SHA256 ada13495dfd008dd78fb39eeab5fb5debb75aab0f4f6b07c3dc1509821ea3f93 SHA512 de469361da16d824e4674f262b1be76cbce98816991ca2b8c617a2ed00fb4e067df3f0c3483c8b7981e2945754284953163a4518fa7e7f85bc15acaacd5e21f1 WHIRLPOOL 4c2be0f543b029d4e22a3719aac73c5f4ca1869b21f1f189bd0144bffb46424510330131adb6d947bece7f43302545cf0164737788a4ffc8b8fa2c14b63a7e81
|
||||
DIST gitlab-ci-7.11.4.tar.gz 949764 SHA256 a7217c4a68eced99d8d77333c2c2d2f236fc435cd9b944b14873b99507fc7cb9 SHA512 954cabcf17044851c5bad4a34f9119cea01c6682a69f4512d61e25ba5660c5badb1d47d054cf88a30e67dd2e5b028ddf22dae4ca7ec3ea74734cb2430ba5d9dd WHIRLPOOL f41d617f4626fef4a6b5aeafa703bda090ceaa0270c48ce8ec54a27849025cf188c7945224eed2434f32e768b043fc1d182cf1bdcd42c59174a9935a829d5f0a
|
||||
DIST gitlab-ci-7.12.0.tar.gz 739627 SHA256 d9434a1e38728e9e90d5e6e7d5d08b4e553fc026c063dc00863daa39598b538f SHA512 6ade1586f37317deed41ed7a9df4996cf791b6b8c223f0aac03245f999b8b450f13ce2514875bf2ba3a62119dc63412a8c7914024bce4d4d9ffafb37eb6d2a10 WHIRLPOOL 5192511e0bc4384b1f1a18b6770eccad3409f918635266a10d4f3366474ffe20b4c7b5611ab959a9c919788158bdbf68770ef7433179454f194c068fb26c62d9
|
||||
DIST gitlab-ci-7.12.1.tar.gz 741319 SHA256 20bcacb1b51b50feac3bed510fc6bfe120f0a244e4a04b02e4b2c857c2003530 SHA512 13d2b50c9cdc43bfe57f8771bfd1bafab26330b9ff94f62b5596a617777613002df8b92570231836d426950fdc738664222a475abfdbf68479751c2a26ff0c6a WHIRLPOOL d01d3ccebfc69d713c4e080cc098b68a9a0fb5a112e8318b5d7ab188cb6764f4835f6a514f7efe8cc0fa9b0aceb11820729161a106f9f0352e3a498b88b5576f
|
||||
DIST gitlab-ci-7.12.2.tar.gz 741122 SHA256 d1e7f4b106a48d53a54942a2b543dd08097402bab3e379ef9daeecd9790e26f6 SHA512 a1197ba30d4bee985554cd54efefd46d278a22071a52cd2c367934f274bc268af5f42960c268792e8aa09f481f40fe6a6da640f69f63cae7c778af2c778bc86c WHIRLPOOL 57338dc79edfaeec0702cd75f74c2d89bf2cb6f41657a4aa1e36dd5427648783dcfad2c7ee534fd9fb8d20e1991dd3f7cef15234f7e96600f4c89cc2eb5dec62
|
||||
DIST gitlab-ci-7.8.1.tar.gz 655403 SHA256 b7685c5f906d0b40bdf88b376af72554ad20b48bab2437465df7539213d156d6 SHA512 71e7e1b5873c50de9b577acb611def2fe9b7f3decf4842e77b7c4ad275f810114beaf32874f35e92119db06ac8dc6ed70baa2dea4ecfc798652f2e475d238d7b WHIRLPOOL 95450996a8f9b7af43b04359fde79b5181195820e353179d6a6d493accf3e55778c2c57e4deed2eab7f58dde5163824aae1d6c24c8852cc25ec03f2dbd1406e8
|
||||
DIST gitlab-ci-7.9.4.tar.gz 669304 SHA256 dd21094def835a6492f27bd5507ee03b954b8fd65d1666cc9a32e4198c217336 SHA512 8ebb849ebe79180da7cef7163e276434a8fd1a5304539ca648221fbf7ac4b8a92189b61d911c2a597bcad21b3ca3a45a8adf7e9eb7e26d183866413ee28132ec WHIRLPOOL 1c372a9496fa11be72e3c1553d6b1ddfd417193841eda0a9a997758e7751c757feb98e8390ea0a3ec805aae5230bb17f24fab8af25b77fdc72dd8cd704135b95
|
||||
EBUILD gitlab-ci-5.4.2.ebuild 8568 SHA256 0f983ce12281aecfb784b9d97153ad71b27b77a1fc77867017ad299d81c90cd1 SHA512 a3db89945616666554f95c7c0121b46d23b53a7a6fde87802d937fa069162fd675ecaeffcd994ec9c7faa23185ea54808e42921d006b3f7ceb5fac3a9f7c28ff WHIRLPOOL c863e122b2c5d2efef75bc324ca39005b6093aec4cb6ca8e6eb0df6a0017e283afcfbb2e1f6edf006a801b403fcde9d07bbfc5fd21781432cfeda0addfc2e3a6
|
||||
EBUILD gitlab-ci-7.10.3.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.11.1.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.11.4.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.12.0.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.12.1.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.12.2.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.8.1.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
EBUILD gitlab-ci-7.9.4.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
|
||||
|
|
|
@ -1,309 +0,0 @@
|
|||
# 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="ruby19 ruby20 ruby21"
|
||||
PYTHON_DEPEND="2:2.7"
|
||||
|
||||
inherit eutils python ruby-ng user
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
# 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
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
# 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
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
# 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
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
# 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
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
# 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
|
||||
|
||||
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
|
||||
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
|
||||
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
RESTRICT="mirror"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE="mysql +postgres"
|
||||
|
||||
## Gems dependencies:
|
||||
# charlock_holmes dev-libs/icu
|
||||
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
|
||||
# pg dev-db/postgresql-base
|
||||
# mysql virtual/mysql
|
||||
#
|
||||
|
||||
GEMS_DEPEND="
|
||||
dev-libs/icu
|
||||
dev-libs/libxml2
|
||||
dev-libs/libxslt
|
||||
postgres? ( dev-db/postgresql-base )
|
||||
mysql? ( virtual/mysql )"
|
||||
DEPEND="${GEMS_DEPEND}
|
||||
dev-vcs/git"
|
||||
RDEPEND="${DEPEND}
|
||||
dev-db/redis
|
||||
virtual/mta"
|
||||
ruby_add_bdepend "
|
||||
virtual/rubygems
|
||||
>=dev-ruby/bundler-1.0"
|
||||
|
||||
# no patches needed so far ...
|
||||
#RUBY_PATCHES=(
|
||||
#)
|
||||
|
||||
MY_NAME="gitlab-ci"
|
||||
MY_USER="gitlab_ci"
|
||||
|
||||
DEST_DIR="/opt/${MY_NAME}"
|
||||
CONF_DIR="/etc/${MY_NAME}"
|
||||
LOGS_DIR="/var/log/${MY_NAME}"
|
||||
TEMP_DIR="/var/tmp/${MY_NAME}"
|
||||
RUN_DIR="/run/${MY_NAME}"
|
||||
|
||||
# When updating ebuild to newer version, check list of the queues in
|
||||
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
|
||||
SIDEKIQ_QUEUES="runner,common,default"
|
||||
|
||||
pkg_setup() {
|
||||
enewgroup gitlab_ci
|
||||
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
|
||||
}
|
||||
|
||||
all_ruby_prepare() {
|
||||
|
||||
# fix paths
|
||||
sed -i -E \
|
||||
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
|
||||
config/resque.yml.example || die "failed to filter resque.yml.example"
|
||||
sed -i -E \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
|
||||
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
|
||||
|
||||
sed -i \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
|
||||
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
|
||||
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
|
||||
|
||||
# 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"
|
||||
# modify default database settings for MySQL
|
||||
sed -i -E \
|
||||
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
|
||||
config/database.yml.mysql || die "failed to filter database.yml.mysql"
|
||||
|
||||
# rename config files
|
||||
mv config/application.yml.example config/application.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/init.d
|
||||
}
|
||||
|
||||
all_ruby_install() {
|
||||
local dest=${DEST_DIR}
|
||||
local conf=${CONF_DIR}
|
||||
local logs=${LOGS_DIR}
|
||||
local temp=${TEMP_DIR}
|
||||
local runs=${RUN_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; 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}
|
||||
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
|
||||
fperms 640 ${conf}/database.yml
|
||||
|
||||
## RC script ##
|
||||
|
||||
local rcscript=gitlab-ci-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
sed -i \
|
||||
-e "s|@USER@|${MY_USER}|" \
|
||||
-e "s|@GITLAB_CI_BASE@|${dest}|" \
|
||||
-e "s|@LOGS_DIR@|${logs}|" \
|
||||
-e "s|@RUN_DIR@|${runs}|" \
|
||||
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
|
||||
"${T}/${rcscript}" \
|
||||
|| die "failed to filter ${rcscript}"
|
||||
|
||||
newinitd "${T}/${rcscript}" "${MY_NAME}"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
|
||||
elog
|
||||
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
|
||||
elog " for \"production\" environment."
|
||||
elog
|
||||
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
|
||||
elog
|
||||
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
|
||||
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
|
||||
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
|
||||
}
|
||||
|
||||
pkg_config() {
|
||||
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
|
||||
|
||||
|
||||
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
|
||||
local gitlab_ci_home="$(egethome ${MY_USER})"
|
||||
|
||||
# configure Git global settings
|
||||
if [ ! -e "${gitlab_ci_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 CI'" \
|
||||
|| 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
|
||||
|
||||
else
|
||||
local update=false
|
||||
|
||||
einfo "Initializing database ..."
|
||||
exec_rake setup
|
||||
|
||||
einfo "Setting up cron schedules ..."
|
||||
exec_rake whenever -w
|
||||
fi
|
||||
|
||||
if [ "${update}" = 'true' ]; then
|
||||
ewarn
|
||||
ewarn "This configuration script runs only common migration tasks."
|
||||
ewarn "Please read guides on"
|
||||
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
|
||||
ewarn "for any additional migration tasks specific to your previous GitLab CI"
|
||||
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 $@"
|
||||
}
|
|
@ -1,36 +1,13 @@
|
|||
AUX gitlab-sidekiq-7.service 1192 SHA256 3d1bdb5e653448a46ff2530321090ac5c8897121f6361c09c4714b0387c3d42d SHA512 45e8fd0092ba45af62019b5a4f073cfaa050320d208e0ce9ebfe881024e7a9123283fb16635373d898827e156806738bba42a736b5d2ba5c5228167fedaf367d WHIRLPOOL 892911ffd089d13877481ee2589c016b1f67874f209d1757e67d42b5f7c0aa1d5f2010576a35becf7966dfcadbd00b68654067e00bc17b75e30cfc64a43bcf21
|
||||
AUX gitlab-sidekiq-noslot.init 972 SHA256 614b405d16e2042d013dae510796620d42461512705fad2a90a7f558e0051c33 SHA512 afd3837ae660d47297c6d65180ae5f3ec6a15c1c8ea23aa5b715ca2fc5b628f3d868adf265c16521e940e5aeb53e4a70a2ec6c0acfacb6b39a1fb5bc669672fd WHIRLPOOL 434ae6e789fc8894a9c83bd538de804784c23072129c79fe0c209848e0c8e1a3d607ce9f7f9da617a25c874ce81d276d010d5ae2d3bf95e25034e9048cbd747a
|
||||
AUX gitlab-sidekiq.init 979 SHA256 f9bc02031b0418e4c765fae37bb40cd9e16dbe5b1a7f5c105a2d7ba3568b0195 SHA512 e3311f1110fca02a378a9f74704d9241884a1973e90be1dbd663809b524528eda25e3ad0ac5d20737f6ccd78343582557ac579adb976473f8aabc0320172921f WHIRLPOOL 365d539cceacb5ff9171aa7316ac061ef4b4a8d63e6d4a26395afb841878a08bdd1b9bf2709602dc90f15a1ed5ff8566a0e8239e8ab9184e84814a16993f3aeb
|
||||
AUX gitlab-unicorn-7.init 1671 SHA256 714d5ba2fdba3287357120ff82b3fececc2baff1d037366ace4ccd4bc46eed9d SHA512 ca62bd581b03af2b4d8fa7429193f6075d1c286b672c184aca91d5d1ea9f0de1980a3c6e3cde73e6b0a79655c511eb0c19fd36083a4d9544db1ae78234ef3aeb WHIRLPOOL b6ba697eac3dab059a1199cc801baa60f5b3eb911b0bbe59478c105b1976a1e8fb49bb66f12a53d20b67a25e1fc8487d14b4d474650ef3259999ca8c5503eabf
|
||||
AUX gitlab-sidekiq.init 972 SHA256 614b405d16e2042d013dae510796620d42461512705fad2a90a7f558e0051c33 SHA512 afd3837ae660d47297c6d65180ae5f3ec6a15c1c8ea23aa5b715ca2fc5b628f3d868adf265c16521e940e5aeb53e4a70a2ec6c0acfacb6b39a1fb5bc669672fd WHIRLPOOL 434ae6e789fc8894a9c83bd538de804784c23072129c79fe0c209848e0c8e1a3d607ce9f7f9da617a25c874ce81d276d010d5ae2d3bf95e25034e9048cbd747a
|
||||
AUX gitlab-sidekiq.service 1192 SHA256 3d1bdb5e653448a46ff2530321090ac5c8897121f6361c09c4714b0387c3d42d SHA512 45e8fd0092ba45af62019b5a4f073cfaa050320d208e0ce9ebfe881024e7a9123283fb16635373d898827e156806738bba42a736b5d2ba5c5228167fedaf367d WHIRLPOOL 892911ffd089d13877481ee2589c016b1f67874f209d1757e67d42b5f7c0aa1d5f2010576a35becf7966dfcadbd00b68654067e00bc17b75e30cfc64a43bcf21
|
||||
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-6.0.2-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
|
||||
AUX gitlabhq-7.10.3-fix-project-name-regex.patch 674 SHA256 5291d514c19a8d330802d73a6c874e22d90b237231f0e4ed4c7a5ecc062c59f4 SHA512 74603047095e2f3bb8581a1d3bffebb68a3cccb7a0a4c962b98aafd221159100a6fe104eea096518889367526df306d7bf8c2dcc07a28c5d8de4164500cf2612 WHIRLPOOL 35e78af7cc503d2b26aa4cd8b630429bc60e10a3ef27cbed4cebc9d4c9c98049692a21e68b492db336427dffa4ba0e499d8b960d69017a86f9bbbd94ec21d0db
|
||||
AUX gitlabhq-7.7.1-fix-project-name-regex.patch 715 SHA256 b026094b1f910226ddef2365d55d555ba6ebb99c17abc1eceb3906a101bf9f1b SHA512 041eb436089508266a572ec97d5c2d934747f1937fedb81bc18b9a85ace663cd0628d409e037e78d7381c8e968b9913121e09ca152fa35a7b372642b93643cdf WHIRLPOOL d548d403201be0068027dc73b63870845c6c109ee820af4495ed9969165a0fa39a837c0343fe2686a297f845dcc7306fa71fd98ff4941ccf584842d1046748b9
|
||||
AUX gitlabhq-7.8.0-email-custom-reply_to.patch 1853 SHA256 ccf123b164fa323a212bb2b53104e0dc8d1bd0ecbc0a0dc3b41fa58740ba6779 SHA512 67b4f4624bd7fe91b78b28b2265f7166110611fe2a32ded733aff65291e7562af4bd3b0d3345a45991a537486eda4606cd82347b907b09c6ff47d55d40969227 WHIRLPOOL 678716e8dfa794055a7d4827a7f1e9bc67475738ed7308d5cc28a7661a99acf927cb91a59dd01055cdbde9690bb3dc10b87c53569351267dea2e86117140af5e
|
||||
AUX gitlabhq-7.8.0-fix-gemfile.patch 2123 SHA256 935a72dd9cdbb12de6c95ca5e3fba066b5fcf368830f9e4c7ce4466feab20400 SHA512 70960437b1e5e5054ee28134104a1cabdf95ac6a7f034f755f97eb859d526662ab9e6313fd1c72b6838c308df5173a0d08896f137f8f737c6c0a6e7b7f54bfc3 WHIRLPOOL 8d7cbc26934f2d0e993c75565a17992c3c44a7ab51e6154bf7a91667e0e1c5837cb6546730bea882772b042c6353459f20e59a9a95d56d130f6db8ce4d2d1123
|
||||
AUX gitlabhq-7.9.3-email-custom-reply_to.patch 1787 SHA256 278b23ce845f39a4342af8647a5453f69a34769c14bb221b250bbff9f59dea4d SHA512 d98ca57a7c1a46c6af8ffd86973cb0c7646dd7545b7ee17bafc3e025cc3be01b4a9f876a1b505be9b098054a194bd14ec79cd8d633afbdc74d845e376460a55a WHIRLPOOL 52298d14cefed3d86bf183524561101a5795b5de9ee33611196019fcb4bc43975f0330dba187eb16d8a96eb4cc865c8e38fbcd351d19b290d79f4fb2e4f78b11
|
||||
AUX gitlabhq-7.9.3-fix-gemfile.patch 1456 SHA256 ad7deb355b74a156ef04c031ff45946a4852d273b30c4bae2be5b2cb11d0d683 SHA512 f0535f57338833f734701ab9c64a1a1dc9f7d6e7c634756c18e98bd5c6811876e2cbc7d64bd93297d5717d1d1e4f9213c7982c32770000698dc7a718a7b00155 WHIRLPOOL dfc2083e7c3c7895a01f4e1e588610f542a38a636ce9af1165b5c0fa4301fa91a6b58f24833ab9e754ea3024e48894b6b58ee9e3d2acec6cddcc1ecc515b097b
|
||||
DIST gitlabhq-7.10.3.tar.gz 5690032 SHA256 e0d442b3c2bc4ae19bc0f146bc9ee0c07275616323f3aa9ae68a6021cd9e0e42 SHA512 46c59389aa9d699747cbea4790ef89f38b2d7c9a7b7452369be6eba47a3136c1ea8fa12c8a74a40e6700d83a238fc6aee78c7a22468878417e1f201e4f4e077b WHIRLPOOL 37ade7b0c5e33eb1ca018b461e12bbd83d15d89b0201e17e2857d595fca8f3fa783098fc7e090789a00786a83d7299f3597e664a2cf1fe9ea66690c4c8a325d2
|
||||
DIST gitlabhq-7.10.4.tar.gz 5690013 SHA256 9b87da87316ac32ce34b4826c1c8baf28b539c2289c62320ca69cf86298cdb5b SHA512 b97da9fa51fada1fb0694440f2e64de13faceed5bc716b83b39505af3e3f4680d8691360afd4c9ada0a0b7ed2c451ccb822eedf386aa39cd54cb8d57fe4e70ca WHIRLPOOL 2a0958df369b01c543402a2ff0377adb9ed6b7f508a879b89907c59614cd83ccdd9b1c952fca88921c933772d63cede2131273d74a920b2e99909e75670da84d
|
||||
DIST gitlabhq-7.11.1.tar.gz 5731386 SHA256 a877a0948df3f68d476316b88b9a10ea95a916d4c50532efd91e768bd7c04752 SHA512 477f124d72be0a744146691936182c06ff9770eb86a481a8da997150453995ca255f5e190162bacf312ea3111c1aa6ab53ada3fa2774354f15716bcff579583e WHIRLPOOL 69667a927be41c00200287167cb08e2980824a38da4f958cd8e5ee51f20a5c7c3dc2fc931c45f497cf4155c53c43b63d871e19ac6e6c8b6fd088f9fbb8cd25c1
|
||||
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.0.tar.gz 6095622 SHA256 57cdb0af2fae896db6fbde6bd04b71ed2996605117b11d8b8ddbaa7e269fdaf5 SHA512 40ec367c314a2f1a5e227f51a2d237d53feb466884ac478bf856678e031b121ee8470a41e22fba3aa9ff2f38049e36430ca3776f45daad0f60ec2f15349fcd1c WHIRLPOOL bbc0229a0380761ea3e081354fb8cb20d6546f6dbaaafd10c2fb17a94b4387e8f89b1f043f8c61e0bce92aaaaa58d704ab8333d7f519179ad6c0b2b30dcfa060
|
||||
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.8.1.tar.gz 5302130 SHA256 4308a945b605caa369c0cafc22fbf7aa9f6cf9143ab200cde86c9c9308849153 SHA512 ac789c6264e599f44e50edf4ff09187293f1d2a7f4fc9460b3f28d5753a4d868247fe68a443e50c2bcbd75871ed7a124f1d49e84565da954c83f36154b4cc302 WHIRLPOOL ceb7f82f86d31264321fec76b5344d908327546ba9c2ceec7ad81cd8eaba7832450459251cd3e52825ae00f926f8d74205681abc8e867f97d44eea195dca4652
|
||||
DIST gitlabhq-7.8.4.tar.gz 5302883 SHA256 84b2f2ed08aa524bcd85145921b99d176da1ed5210ebd00ef16b65b0c69c0c29 SHA512 35d803754b46b11087665f766279cd5b5fe348ba48cec3d889dc393ffa407f50bf9aea8564fd1f3e5fe1b513eec3a4e4e5032ed9c4f6e47189c59a7a60a515ff WHIRLPOOL d97911ac6cf5dcddffd784ee757846ca11c8134f80f88f9fbbb1ef90a3ed7a189ba00c126686fd34ba8889e0fafa0fe0059c9613ab922a1f155d8bfca5777d53
|
||||
DIST gitlabhq-7.9.3.tar.gz 5390351 SHA256 265bf36d8560b8cac59a24474dc8addb7854435600589faae2c46f40bc232b18 SHA512 2387ae0228dbb75d5c58bb7240a7a04a7c36edbc994f9aac4d26509b1163e3e65779958f985de11474693ec6a09e0662d8af8a6fd78f13507e1d9ab38a4092d8 WHIRLPOOL 800148f5490c9a559604d47cb4a1733afbc6dd3bc79755b7985152c2514335d0e15ecef5c4a250bcbae821db8d0dbbaf2457e55b9b6abec4068777282b98ea01
|
||||
DIST gitlabhq-7.9.4.tar.gz 5392634 SHA256 bbc6a0647832f983322ce2c80f3d642354709b32de28f8ba6009c508c3600ece SHA512 2503c32143df3d46bd7abb8956aa3e65d436f02bd993024c5fbd4838f90b746de44f5a78f82572b6d9e312f34e5ae27a4c51706ae9ae315c069cd14519e8d90d WHIRLPOOL 6bd1d8a451693c8906fe32c5705f57aacb59c69c1168d9d7461e7a6665b3ae7326ebaaaa1799af4c4d246fd6a071383eba48729dc4627de6ca75180771aa6db8
|
||||
EBUILD gitlabhq-7.10.3.ebuild 11280 SHA256 b68816f36f41d7c2771448db041b56c9c12d82b6326856e37c26b0d763463e2a SHA512 f7ad09d20d0c5a9167f5e9118ca56a6ce9b441e5c80d3d83dc5ed43d8809026cb285941747283c0813651a89fc3a0e25d0a1c11ab9efdf282dfeb8349214ae7b WHIRLPOOL 0b34c86392af8607a4a30c3b51dd4ec0816d4af0183e50cbe750105a644c0b6bcfc34454bd78cbdb6a5d358954cf390593778e3f5aa6ad453604f6e4a4722e05
|
||||
EBUILD gitlabhq-7.10.4.ebuild 11291 SHA256 d9958266f80306ae1961e00f50fd211d3d1b9496686301c1d145ecfcde7b03b1 SHA512 516d140f375ff5b915332555f06d805e4455eebab0cfa33dac2c0e8e1460c9f9611573d5f0604e75416f6ee376870123f3f3c4fc7405badc86a1ecbcfe5c4150 WHIRLPOOL ae0281c20bf798cc09ebd52e9e60393e36aee1be5ec10c26ec6bce2cf7a811477fcb67baf99815ef755521b25d24678bf24a42d569fac31daaa29bf6f85911a0
|
||||
EBUILD gitlabhq-7.11.1.ebuild 11337 SHA256 c2fae88e4a2ffc3aa16e4feaa56ad5e3ed7aaf891707db49296f77585dde5c56 SHA512 2cd81ec23f75846cc984961edc707ffa4aa837e7e0ca0aafac48e24616f5661aebc0912c5c191485465cc6a5c92edde6eda1b0ff7d79eaaf3688df1a4150cdca WHIRLPOOL c0c95e58f21d5496bc37654a67626eeb1fc7c660f14431fbf948dd2bb71a5fab409c69688dd44456fdc78d0456b24be978f732809305631e10b253a544586561
|
||||
EBUILD gitlabhq-7.11.4.ebuild 11337 SHA256 c2fae88e4a2ffc3aa16e4feaa56ad5e3ed7aaf891707db49296f77585dde5c56 SHA512 2cd81ec23f75846cc984961edc707ffa4aa837e7e0ca0aafac48e24616f5661aebc0912c5c191485465cc6a5c92edde6eda1b0ff7d79eaaf3688df1a4150cdca WHIRLPOOL c0c95e58f21d5496bc37654a67626eeb1fc7c660f14431fbf948dd2bb71a5fab409c69688dd44456fdc78d0456b24be978f732809305631e10b253a544586561
|
||||
EBUILD gitlabhq-7.12.0.ebuild 10965 SHA256 845a6d939b0c9d3e31af6f150ec81e57b931ad57d4c9da2454ea2b32e38ec8e6 SHA512 245cb32d36b5bb8fc541534e82ce17d34a9634ebc252eed505e74e400c6a427067c46e21ac757a7044b25f8b620095cc36e536d5c366815227c12d7a06709745 WHIRLPOOL edfc96c30d177f55841e1502304c66d0a2faae8d94e3e8c2786af4d1ef5626e0f2a0b73a632cec461bec07712c0ade6dc9295a5ee0e042b77a602cbad34f3c95
|
||||
EBUILD gitlabhq-7.12.1.ebuild 10965 SHA256 845a6d939b0c9d3e31af6f150ec81e57b931ad57d4c9da2454ea2b32e38ec8e6 SHA512 245cb32d36b5bb8fc541534e82ce17d34a9634ebc252eed505e74e400c6a427067c46e21ac757a7044b25f8b620095cc36e536d5c366815227c12d7a06709745 WHIRLPOOL edfc96c30d177f55841e1502304c66d0a2faae8d94e3e8c2786af4d1ef5626e0f2a0b73a632cec461bec07712c0ade6dc9295a5ee0e042b77a602cbad34f3c95
|
||||
EBUILD gitlabhq-7.12.2.ebuild 10965 SHA256 845a6d939b0c9d3e31af6f150ec81e57b931ad57d4c9da2454ea2b32e38ec8e6 SHA512 245cb32d36b5bb8fc541534e82ce17d34a9634ebc252eed505e74e400c6a427067c46e21ac757a7044b25f8b620095cc36e536d5c366815227c12d7a06709745 WHIRLPOOL edfc96c30d177f55841e1502304c66d0a2faae8d94e3e8c2786af4d1ef5626e0f2a0b73a632cec461bec07712c0ade6dc9295a5ee0e042b77a602cbad34f3c95
|
||||
EBUILD gitlabhq-7.8.1.ebuild 10966 SHA256 b5d3b822a4ce401b50909f0663bef4dacf7c9673c51bbbe2f600533f3bf7c365 SHA512 630b0b2bcda6fb7c5b407b4c094e35ad9de74ea9e6fd959f914f9944cd543ced2c3f9b1e8d3f98c6d3f1e0a3f6873e4ca64817ae3fe2aed61c4e656995e8ef62 WHIRLPOOL 3cede9b536a86cce0cc024a957d7b29c472cf60223ba9321bbe9e4b885cb9a58c3438d07708280a76dafb811551c3576559c4e6ec71b2050c3e81e88f460bce4
|
||||
EBUILD gitlabhq-7.8.4.ebuild 11421 SHA256 bb3de388ee40f9d63789c65da6d331f543870e88371c65a1f56ad019bf13d07f SHA512 600e93ceb3b4dbf018197e1462e14501bb6a36e1febead7078743034137e442d9104e505a4de622a6ca6108ef0f2427f4feb08bd2dddf95cae3830b2aa744984 WHIRLPOOL 2d30fe945665abe83ca138a49b18eb808d555b9a1f00e61c197cc3bfbc3167a1b46359e639893628f0dcb2bad871571ba416982685602c5a9195240986083906
|
||||
EBUILD gitlabhq-7.9.3.ebuild 11316 SHA256 491ab8495fe600a625a03826d5f4f0a70cd54781c69b35de4eefaa7d4bbca5d0 SHA512 c80a1a04c3090603bd2f795624a97ed9e69451d4027321ffa7291b252a643a7cc14b50303b5fec0968b79101b3d3c304ff9d3731dd897cfb2e7a0d7fc4ed177f WHIRLPOOL 84dba3eb8abc110fb88b71db1cf4ed1f1085109c6af330094e50a7eedd18ce4721a5157745978a2705a93d1b21d53d57a80acf85a121926259d723235dcce416
|
||||
EBUILD gitlabhq-7.9.4.ebuild 11330 SHA256 97c3ce2be954809e8d8938a266fbfadce8ef5a72c3c2d77c87d174b335f19401 SHA512 19f8bb8c87ec6f5ba5cdfa4954c33c9ef8439bd31ba0f95d8a83402ae83f3f01148dd053a48362ea77fdca17dcbd8ddfe17e30b6d9338a5db2f81237b727203d WHIRLPOOL 5a6a8b1d6a48424d498b008754ca515ae3bb298e1944c7dd77458ddd62d907b467de0589601435f6aa474d92b0ceac7519f711dcccb744c1e4eee3852434392c
|
||||
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
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
name="GitLab Sidekiq"
|
||||
description="Sidekiq for GitLab"
|
||||
|
||||
: ${gitlab_user:=@USER@}
|
||||
: ${gitlab_base:="@GITLAB_BASE@"}
|
||||
: ${rails_env:=production}
|
||||
|
||||
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
|
||||
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
|
||||
: ${sidekiq_queues:="@QUEUES@"}
|
||||
|
||||
sidekiq_command="/usr/bin/bundle"
|
||||
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
|
||||
|
||||
depend() {
|
||||
need redis
|
||||
use net
|
||||
}
|
||||
|
||||
start() {
|
||||
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
|
||||
|
||||
ebegin "Starting ${name} - Sidekiq"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--background --quiet \
|
||||
--chdir "${gitlab_base}" \
|
||||
--user=${gitlab_user} \
|
||||
--pidfile="${sidekiq_pidfile}" \
|
||||
--env RAILS_ENV=${rails_env} \
|
||||
--exec ${sidekiq_command} -- ${sidekiq_command_args}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping ${name} - Sidekiq"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${sidekiq_pidfile} \
|
||||
--exec ${sidekiq_command}
|
||||
eend $?
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
name="GitLab Sidekiq"
|
||||
description="Sidekiq for GitLab @SLOT@"
|
||||
description="Sidekiq for GitLab"
|
||||
|
||||
: ${gitlab_user:=@USER@}
|
||||
: ${gitlab_base:="@GITLAB_BASE@"}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
name="GitLab-@SLOT@"
|
||||
description="GitLab @SLOT@ on Unicorns"
|
||||
|
||||
: ${gitlab_user:=@USER@}
|
||||
: ${gitlab_base:="@GITLAB_BASE@"}
|
||||
: ${rails_env:=production}
|
||||
|
||||
: ${server_pidfile:="/run/gitlab/unicorn.pid"}
|
||||
|
||||
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
|
||||
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
|
||||
: ${sidekiq_queues:="@QUEUES@"}
|
||||
|
||||
server_command="/usr/bin/bundle"
|
||||
server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D"
|
||||
|
||||
sidekiq_command="/usr/bin/bundle"
|
||||
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues//,/ -q } -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
|
||||
|
||||
depend() {
|
||||
provide gitlab
|
||||
need redis
|
||||
use net
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting ${name} - Unicorn servers"
|
||||
|
||||
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${server_pidfile}")"
|
||||
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--chdir "${gitlab_base}" \
|
||||
--user=${gitlab_user} \
|
||||
--pidfile="${server_pidfile}" \
|
||||
--env RAILS_ENV=${rails_env} \
|
||||
--exec ${server_command} -- ${server_command_args}
|
||||
eend $?
|
||||
|
||||
ebegin "Starting ${name} - Sidekiq"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--background --quiet \
|
||||
--chdir "${gitlab_base}" \
|
||||
--user=${gitlab_user} \
|
||||
--pidfile="${sidekiq_pidfile}" \
|
||||
--env RAILS_ENV=${rails_env} \
|
||||
--exec ${sidekiq_command} -- ${sidekiq_command_args}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping ${name} - Sidekiq"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${sidekiq_pidfile} \
|
||||
--exec ${sidekiq_command}
|
||||
eend $?
|
||||
|
||||
ebegin "Stopping ${name} - Unicorn servers"
|
||||
start-stop-daemon --stop \
|
||||
--signal QUIT \
|
||||
--pidfile=${server_pidfile} \
|
||||
--exec ${server_command}
|
||||
eend $?
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
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
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
|
||||
index cf6e260..5657566 100644
|
||||
--- a/lib/gitlab/regex.rb
|
||||
+++ b/lib/gitlab/regex.rb
|
||||
@@ -1,3 +1,5 @@
|
||||
+# encoding: utf-8
|
||||
+
|
||||
module Gitlab
|
||||
module Regex
|
||||
extend self
|
||||
@@ -11,12 +13,12 @@ module Gitlab
|
||||
end
|
||||
|
||||
def project_name_regex
|
||||
- /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\. ]*\z/
|
||||
+ /\A[\p{Word}_.][\p{Word}_\-:\. ]*\z/
|
||||
end
|
||||
|
||||
def project_regex_message
|
||||
- "can contain only letters, digits, '_', '-' and '.' and space. " \
|
||||
- "It must start with letter, digit or '_'."
|
||||
+ "can contain only letters, digits, '_', '-', ':' and '.' and space. " \
|
||||
+ "It must start with letter, digit, '.' or '_'."
|
||||
end
|
||||
|
||||
def name_regex
|
|
@ -1,39 +0,0 @@
|
|||
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
|
||||
index 46ead62..d4ee6bb 100644
|
||||
--- a/app/mailers/notify.rb
|
||||
+++ b/app/mailers/notify.rb
|
||||
@@ -19,7 +19,7 @@ class Notify < ActionMailer::Base
|
||||
default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root
|
||||
|
||||
default from: Proc.new { default_sender_address.format }
|
||||
- default reply_to: "noreply@#{Gitlab.config.gitlab.host}"
|
||||
+ default reply_to: Gitlab.config.gitlab.email_reply_to
|
||||
|
||||
# Just send email with 2 seconds delay
|
||||
def self.delay
|
||||
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
|
||||
index 044b1f6..5ff344e 100644
|
||||
--- a/config/gitlab.yml.example
|
||||
+++ b/config/gitlab.yml.example
|
||||
@@ -44,6 +44,9 @@ production: &base
|
||||
# Email address used in the "From" field in mails sent by GitLab
|
||||
email_from: example@example.com
|
||||
|
||||
+ # Email address used in the "Reply-To" field in mails send by GitLab (default: no-reply@<host>)
|
||||
+ email_reply_to: no-reply@example.com
|
||||
+
|
||||
# Email server smtp settings are in config/initializers/smtp_settings.rb.sample
|
||||
|
||||
# default_can_create_group: false # default: true
|
||||
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
|
||||
index 6a8bbb8..de5c8f8 100644
|
||||
--- a/config/initializers/1_settings.rb
|
||||
+++ b/config/initializers/1_settings.rb
|
||||
@@ -102,6 +102,7 @@ Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
|
||||
Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
|
||||
Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].nil?
|
||||
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
|
||||
+Settings.gitlab['email_reply_to'] ||= "no-reply@#{Settings.gitlab.host}"
|
||||
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
|
||||
Settings.gitlab['user'] ||= 'git'
|
||||
Settings.gitlab['user_home'] ||= begin
|
|
@ -1,88 +0,0 @@
|
|||
diff --git a/Gemfile b/Gemfile
|
||||
index c3d8299..f1c9da6 100644
|
||||
--- a/Gemfile
|
||||
+++ b/Gemfile
|
||||
@@ -167,6 +167,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"
|
||||
|
||||
@@ -265,7 +269,6 @@ end
|
||||
|
||||
group :production do
|
||||
gem "gitlab_meta", '7.0'
|
||||
- gem "therubyracer"
|
||||
end
|
||||
|
||||
gem "newrelic_rpm"
|
||||
diff --git a/Gemfile.lock b/Gemfile.lock
|
||||
index 3283da4..ae2518f 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:
|
||||
@@ -74,7 +81,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)
|
||||
@@ -297,7 +303,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)
|
||||
@@ -453,7 +458,6 @@ GEM
|
||||
redis-store (~> 1.1.0)
|
||||
redis-store (1.1.4)
|
||||
redis (>= 2.2)
|
||||
- ref (1.0.5)
|
||||
request_store (1.0.5)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
@@ -564,9 +568,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)
|
||||
@@ -649,6 +650,7 @@ DEPENDENCIES
|
||||
cal-heatmap-rails (~> 0.0.1)
|
||||
capybara (~> 2.2.1)
|
||||
carrierwave
|
||||
+ charlock_holmes!
|
||||
coffee-rails
|
||||
colored
|
||||
coveralls
|
||||
@@ -752,7 +754,6 @@ DEPENDENCIES
|
||||
stamp
|
||||
state_machine
|
||||
test_after_commit
|
||||
- therubyracer
|
||||
thin
|
||||
tinder (~> 1.9.2)
|
||||
turbolinks
|
|
@ -1,39 +0,0 @@
|
|||
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
|
||||
index ee27879..90364a0 100644
|
||||
--- a/app/mailers/notify.rb
|
||||
+++ b/app/mailers/notify.rb
|
||||
@@ -19,7 +19,7 @@ class Notify < ActionMailer::Base
|
||||
default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root
|
||||
|
||||
default from: Proc.new { default_sender_address.format }
|
||||
- default reply_to: "noreply@#{Gitlab.config.gitlab.host}"
|
||||
+ default reply_to: Gitlab.config.gitlab.email_reply_to
|
||||
|
||||
# Just send email with 2 seconds delay
|
||||
def self.delay
|
||||
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
|
||||
index a85db10..47605d2 100644
|
||||
--- a/config/gitlab.yml.example
|
||||
+++ b/config/gitlab.yml.example
|
||||
@@ -45,6 +45,9 @@ production: &base
|
||||
email_from: example@example.com
|
||||
email_display_name: GitLab
|
||||
|
||||
+ # Email address used in the "Reply-To" field in mails send by GitLab (default: no-reply@<host>
|
||||
+ email_reply_to: no-reply@example.com
|
||||
+
|
||||
# Email server smtp settings are in config/initializers/smtp_settings.rb.sample
|
||||
|
||||
# default_can_create_group: false # default: true
|
||||
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
|
||||
index 70af7a8..ee00e17 100644
|
||||
--- a/config/initializers/1_settings.rb
|
||||
+++ b/config/initializers/1_settings.rb
|
||||
@@ -103,6 +103,7 @@ Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
|
||||
Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].nil?
|
||||
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
|
||||
Settings.gitlab['email_display_name'] ||= "GitLab"
|
||||
+Settings.gitlab['email_reply_to'] ||= "no-reply@#{Settings.gitlab.host}"
|
||||
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
|
||||
Settings.gitlab['user'] ||= 'git'
|
||||
Settings.gitlab['user_home'] ||= begin
|
|
@ -1,374 +0,0 @@
|
|||
# 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 $@"
|
||||
}
|
|
@ -1,374 +0,0 @@
|
|||
# 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"
|
||||
"${PN}-7.10.3-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:).*|\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; 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 $@"
|
||||
}
|
|
@ -1,374 +0,0 @@
|
|||
# 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="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.3
|
||||
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"
|
||||
"${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:).*|\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; 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 $@"
|
||||
}
|
|
@ -68,15 +68,12 @@ ruby_add_bdepend "
|
|||
# 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"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-fix-gemfile.patch"
|
||||
"${PN}-fix-sendmail-config.patch"
|
||||
)
|
||||
|
||||
MY_NAME="gitlab"
|
||||
|
@ -212,11 +209,11 @@ all_ruby_install() {
|
|||
|
||||
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-sidekiq.service"
|
||||
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
|
||||
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
|
||||
else
|
||||
local rcscript=gitlab-sidekiq-noslot.init
|
||||
local rcscript=gitlab-sidekiq.init
|
||||
use unicorn && rcscript=gitlab-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
|
|
|
@ -1,366 +0,0 @@
|
|||
# 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-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"
|
||||
"${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() {
|
||||
# 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_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 $@"
|
||||
}
|
|
@ -68,15 +68,12 @@ ruby_add_bdepend "
|
|||
# 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"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-fix-gemfile.patch"
|
||||
"${PN}-fix-sendmail-config.patch"
|
||||
)
|
||||
|
||||
MY_NAME="gitlab"
|
||||
|
@ -204,11 +201,11 @@ all_ruby_install() {
|
|||
|
||||
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-sidekiq.service"
|
||||
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
|
||||
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
|
||||
else
|
||||
local rcscript=gitlab-sidekiq-noslot.init
|
||||
local rcscript=gitlab-sidekiq.init
|
||||
use unicorn && rcscript=gitlab-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
|
|
|
@ -68,15 +68,12 @@ ruby_add_bdepend "
|
|||
# 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"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-fix-gemfile.patch"
|
||||
"${PN}-fix-sendmail-config.patch"
|
||||
)
|
||||
|
||||
MY_NAME="gitlab"
|
||||
|
@ -204,11 +201,11 @@ all_ruby_install() {
|
|||
|
||||
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-sidekiq.service"
|
||||
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
|
||||
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
|
||||
else
|
||||
local rcscript=gitlab-sidekiq-noslot.init
|
||||
local rcscript=gitlab-sidekiq.init
|
||||
use unicorn && rcscript=gitlab-unicorn.init
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${T}" || die
|
||||
|
|
|
@ -1,369 +0,0 @@
|
|||
# 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
|
||||
# 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.5.4
|
||||
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.8.0-fix-gemfile.patch"
|
||||
"${PN}-7.7.1-fix-project-name-regex.patch"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-7.8.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_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.init
|
||||
use unicorn && rcscript=gitlab-unicorn-7.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 $@"
|
||||
}
|
|
@ -1,378 +0,0 @@
|
|||
# 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.5.4
|
||||
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.8.0-fix-gemfile.patch"
|
||||
"${PN}-7.7.1-fix-project-name-regex.patch"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-7.8.0-email-custom-reply_to.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
|
||||
rm -r lib/support/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}"/
|
||||
|
||||
cp "${FILESDIR}/${rcscript}" "${D}/${dest}/lib/support/init.d/gitlab"
|
||||
|
||||
# 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 $@"
|
||||
}
|
|
@ -1,375 +0,0 @@
|
|||
# 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.0
|
||||
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=(
|
||||
"${P}-fix-gemfile.patch"
|
||||
"${PN}-7.7.1-fix-project-name-regex.patch"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${P}-email-custom-reply_to.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 $@"
|
||||
}
|
|
@ -1,375 +0,0 @@
|
|||
# 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.0
|
||||
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"
|
||||
"${PN}-7.7.1-fix-project-name-regex.patch"
|
||||
"${PN}-6.0.2-fix-sendmail-config.patch"
|
||||
"${PN}-7.9.3-email-custom-reply_to.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 $@"
|
||||
}
|
Loading…
Reference in a new issue