Updated gitlab / dependency ebuilds

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@34766 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
Torsten Kurbad 2015-10-08 15:00:59 +00:00
parent f785efbb4b
commit 92a1341c6e
21 changed files with 1419 additions and 0 deletions

View File

@ -0,0 +1,6 @@
AUX fix-Makefile-0.2.12.patch 386 SHA256 66a4b8e4f883d5147266a7db4f84ffdf7147946ae5222f43adaee04f11a40d6b SHA512 f47adb7ace8f903b8261b83cbc589ebda009e2d1f694ff6fe125cf3cbb80b55d06a61dff815d84d35aa6948976e17ebbe28cff9eb8a5bc4608ad05baa82b3f7c WHIRLPOOL 550e82c1c041fa0a899eda1a598c2d4ea6ffbaf1f8182e1ca66cf24b13a244590a2317a279b9548a47196dfb6e7f1e6ee829b6bab3178b60d183ac5c00156453
AUX gitlab-git-http-server.conf 254 SHA256 b0c0a9a0c6db8743f46e38124ad3591f5f4e3b7d0cf1e0ff6a426504d85a1006 SHA512 9a6948e6491727737fb4faf12238e459992f95a8011726badba7202a8e3a409a4fd34d7a78b933e473bf0b6516d54c08b5905e35e304e022b5d9d2a8f7e38e62 WHIRLPOOL 1d2b11f973f7a0249a75df929c1f71f36c59bc0b7537cb7aed598dc40cb0ca581b9443eb499f2894069f3857d89c058fa3fd01418bbdab40b16a9896e83a52d2
AUX gitlab-git-http-server.init 689 SHA256 7c3ca271bfaa696fde364ca5915abe0874dfed67601680f3ab91a9560cabb810 SHA512 9d724a4a5c83d12ad817f33ba6d8a68df195e6a91ff75755c24f04678bb8e91f3708900770d87c824418406b3eca5774117e8a5b9e28210f2d8c48726007912b WHIRLPOOL 3078871755f1d425690adb30b4d096f6ed71e5da6aca7f28383ef154d958748536efef6c53e1417c36259591d165a364e1fde64bb8b490287183e02ac1b42571
DIST gitlab-git-http-server-0.2.12.tar.bz2 7352 SHA256 0a50682ac246a0f7b27844959da829521df7f86ef7e88fd72d84fb500f09a6a5 SHA512 393ec8fe17310a79e4094eca464bec2f9e4e8508c8bbd911c9f4843b400f28617e35a06b6e41a9c84f8db904f4f20a3386e3473896ad27a1d278260dd4cd3b93 WHIRLPOOL df9fb21fd63db3aac811b1a62eb60225822a6fcc0b874f5b399d2d38f5f3e4c5dcb370c3a1773dd73a67f34cfc21fb6b56144b02987c29f50cef35b33b48f8bc
EBUILD gitlab-git-http-server-0.2.12.ebuild 889 SHA256 e17a6fef2fcbb31d705d7f086a490a7af9465c380e8942c90d9b414ebc7b3d43 SHA512 2f34f1f09caa33b41e948ffdf1f8f561a20cf51b10d7333ba315876fdd869d2b57baf57d995cf5632f08d9aff50e499f791ad47ba4a00b68d24dece5597f6182 WHIRLPOOL 72691c344d68b657c9b06da4f9c31160b5f9afc99b5d10de8140774712afe509fef152779e1395a6d2ed68fbde0863226537ac733f3aeb107687dadb575d8f1d
MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431

View File

@ -0,0 +1,12 @@
diff --git a/Makefile b/Makefile
index f6456e1..c25e29e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-PREFIX=/usr/local
-VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
+PREFIX=${DESTDIR}/usr
+VERSION=0.2.12-$(shell date -u +%Y%m%d.%H%M%S)
gitlab-git-http-server: main.go githandler.go
go build -ldflags "-X main.Version ${VERSION}" -o gitlab-git-http-server

View File

@ -0,0 +1,11 @@
AUTH_BACKEND=http://localhost:8080
LISTEN_ADDR=localhost:8181
LISTEN_NETWORK=tcp
LISTEN_UMASK=022
PPROF_LISTEN_ADDRESS=
GIT_REPO_PATH=/var/lib/git/repositories
RUNAS_USER=git
RUNAS_GROUP=${RUNAS_USER}
LOGFILE=/var/log/gitlab/gitlab-git-http-server.log

View File

@ -0,0 +1,16 @@
#!/sbin/runscript
start() {
ebegin "Starting gitlab-git-http-server"
start-stop-daemon --start --exec /usr/bin/gitlab-git-http-server --pidfile /run/gitlab-git-http-server.pid \
--make-pidfile --background --user ${RUNAS_USER}:${RUNAS_GROUP} --stdout "${LOGFILE}" --stderr "${LOGFILE}" \
-- -authBackend=${AUTH_BACKEND} -listenAddr=${LISTEN_ADDR} -listenNetwork=${LISTEN_NETWORK} -listenUmask=${LISTEN_UMASK} \
-pprofListenAddr=${PPROF_LISTEN_ADDR} ${GIT_REPO_PATH}
eend $?
}
stop() {
ebegin "Stopping gitlab-git-http-server"
start-stop-daemon --stop --exec /usr/bin/gitlab-git-http-server --pidfile /run/gitlab-git-http-server.pid --user ${RUNAS_USER}:${RUNAS_GROUP}
eend $?
}

View File

@ -0,0 +1,37 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
inherit eutils user
DESCRIPTION="GitLab Git HTTP Server is the new backend for Git-over-HTTP communication needed for GitLab >= 8.0"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-git-http-server"
SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.bz2?ref=${PV} -> ${P}.tar.bz2"
S="${WORKDIR}/${P}-dda7c98adf850e032fa19c24173cbe567a416065"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND=">=dev-lang/go-1.5"
src_prepare() {
epatch "${FILESDIR}/fix-Makefile-${PV}.patch"
}
src_install() {
local dest=/usr/bin
diropts -m755
dodir ${dest}
exeinto ${dest}
doexe "${S}/${PN}"
## RC script ##
newinitd "${FILESDIR}/gitlab-git-http-server.init" "${PN}"
newconfd "${FILESDIR}/gitlab-git-http-server.conf" "${PN}"
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer>
<email>manuel@fritteli.ch</email>
<name>Manuel Friedli</name>
</maintainer>
</pkgmetadata>

View File

@ -1,3 +1,5 @@
AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659cba5e41404e90f21070ed50b5460177f28f1b2 SHA512 0445cd42086b2d77825c487d604ddcb11f8fdf4eb8dcdfa1fe1b8e8c24d7b8f273834dbec0bfbb763a35a74605d558cc8d3feaa056eb02a113d18124a764551e WHIRLPOOL 0e3367b229ea4f13818fe2e485dc8da83ad695aec496881cb5eb918b183029b0013518ca64acba1568d93dc418dfaf083c2a86b9f2e3adf9fe15cad038011b30
DIST gitlab-shell-2.6.5.tar.gz 33445 SHA256 586092a62b053adf0b046372aa5983b1170446456cd24e63c145460acc927648 SHA512 52f5c1db5b813dcd68183c6ca02e1fa0eb693040d2e6dedbb903743c285feaddd2a2836726228673eb6da99da07fcd04103e9207443b9f4fb42ba6d1bd4e29db WHIRLPOOL f52937b73942bd2064bc4414f9d4c8b34366dac59912ee926347ba02b7d44c28630a8f530beea82c3df5b6b801db5249080269a9a4e2f8daf33c484a3d203754
EBUILD gitlab-shell-1.8.0.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
EBUILD gitlab-shell-1.9.1.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
EBUILD gitlab-shell-1.9.4.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
@ -5,3 +7,4 @@ EBUILD gitlab-shell-1.9.6.ebuild 2500 SHA256 a39c5a44b54c70d16f30de155020ff003fb
EBUILD gitlab-shell-2.0.1.ebuild 2633 SHA256 5ca86fbf40b7d606d5a456285437b46fd317aa94053a5e108c9830fe149cba5e SHA512 fe036c162fe78aab513aad36439cb41711248a7cc88956eee93974648ff17d973e1cd302fe73453db193eacd97d4bd93c82cb51087dff5b028d7c88793fedb71 WHIRLPOOL 5692ecf2f4e05676dc648b1159e96925b7e261704d4b8180d454e58e47bb6acca009e6e7106a76c1737fad6bb909f5ae75ac04f6a3ca54ebd8121ee78026b11b
EBUILD gitlab-shell-2.5.4.ebuild 2783 SHA256 bcb7ce5594785e8bbe4da4817e37fb9ea5c674cc704da48df228ff77d04fe182 SHA512 14c1089278f77482653540b1df9ec64d8b7aefcd900625592377834a3ad9cb9068a56dd98e8f6019e80fad233e920b4ffde743f9b09b1deacac323efe86acd1f WHIRLPOOL 56e63a5aa0b0f40f76c060c3785a263eb42bb427554cdd346ee07364b647d009b5e9c7d1a285a74ffcc70b7538ad6a8a5b2cb4ee99430b75d828fc1a284599b5
EBUILD gitlab-shell-2.6.0.ebuild 2629 SHA256 16e0bdaa0817acadb808b9ef389fbcf653f320c97299c596efae920da2bd32fd SHA512 4bb3342ffad64d13b5f60ca3d17c3dc8e428d7730596d8cfdad6889122dc5cc53f4d3716b7414dcf470ca54fe90aa01836958ddf009e2f8271564c5346c7c323 WHIRLPOOL cbb368bc8da1f78ead7aeda3187a58f7f4b13247f97b97cd1b25acd578bcdedfb5c189d3b1a3a4cecf2e932f2f9bbe1fdca8fe123d2026ef6a4b67d58869ba61
EBUILD gitlab-shell-2.6.5.ebuild 3494 SHA256 18b44221e71ae92d0c6d7d5d12a895a2241b9fd51f3eb081e50ff49c36e6e13e SHA512 3b33ff20e643bd8a9b66b2c4830bd3c43b38707306adca5522cf428699fd83d8b16d3c55bc5c86c022afc50a3b5fe913ff1d7b903313ebbac72131831be8a6bc WHIRLPOOL 36ccf083f951ef9b1a432dc9d543bd0111a0abab3b7299b2ff40657a5ae725adcb9aa414610f43f8624045317d044aab4aa86f1245024ec57774083f56861a44

View File

@ -0,0 +1,48 @@
diff --git a/config.yml.example b/config.yml.example
index 94eb593..3d60f48 100644
--- a/config.yml.example
+++ b/config.yml.example
@@ -19,10 +19,10 @@ http_settings:
# Give the canonicalized absolute pathname,
# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!!
# Check twice that none of the components is a symlink, including "/home".
-repos_path: "/home/git/repositories"
+repos_path: "/var/lib/git/repositories"
# File used as authorized_keys for gitlab user
-auth_file: "/home/git/.ssh/authorized_keys"
+auth_file: "/var/lib/git/.ssh/authorized_keys"
# Redis settings used for pushing commit notices to gitlab
redis:
@@ -36,7 +36,7 @@ redis:
# Log file.
# Default is gitlab-shell.log in the root directory.
-# log_file: "/home/git/gitlab-shell/gitlab-shell.log"
+# log_file: "/var/log/gitlab/gitlab-shell.log"
# Log level. INFO by default
log_level: INFO
diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
index c97743b..97f4658 100644
--- a/lib/gitlab_config.rb
+++ b/lib/gitlab_config.rb
@@ -8,7 +8,7 @@ class GitlabConfig
end
def home
- ENV['HOME']
+ "/var/lib/git"
end
def repos_path
@@ -36,7 +36,7 @@ class GitlabConfig
end
def log_file
- @config['log_file'] ||= File.join(ROOT_PATH, 'gitlab-shell.log')
+ @config['log_file'] ||= "/var/log/gitlab/gitlab-shell.log"
end
def log_level

View File

@ -0,0 +1,126 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,6 +1,12 @@
AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214
AUX gitlab-git-http.service 972 SHA256 752e1b62a6c182d69b097788d4c21672655af92f150aa5ee416efab67c869f28 SHA512 ba6feefd2741fe97c176e00fbbb802fb4bfc9fc71b2d584c3ad44a312f2b01c9fe92d268d26ab18cb9372ad8616a5ca1554f2895297a17d35f6818bd27b8244b WHIRLPOOL c7c7fa598f2bae6f736a5f84aa3e737dd3b3bce8803128b0b17a8375e4e0c528b95bcd88b959c5bb9bd5ca1fd73330170be6fe2680c1a14702073d3c1c15f265
AUX gitlab-sidekiq-8.init 995 SHA256 179f8f9267f8358827c4c70697bf27dac728451ac7b9dbe0637d397850260fc2 SHA512 fca6c3b86788113f50120ada81859535bcdd3524ebf79e495c532049a5e1cb09b44499268b22610707ea4763bd6b380fe8abfad10520cd17b03802264c34f0bc WHIRLPOOL edc9c083447662bebdde5b0bbb97816f15a3122aa5cae966d1df805aac5a81e51a608cb5447283bda222af3bd28519b653a6ca6b34d1eef84abc37fd719e5955
AUX gitlab-sidekiq.service 1066 SHA256 b9a15ee7498cc5ebecfd51a037ab1e32e66723a1612d5ce9365eefd890b5670e SHA512 33ece22389637b7b4591f4dceedb488fb43a92ca47facb19432f87772bbbf1774d4fb737ace52a6d55533c9e291e343dc56971c6f70fed285a10429d6d97d318 WHIRLPOOL b5a81751b8317bb9244018f9ed82f9793734adbad9983c244429a33d710169eeeed25cdf868d724032866d83bb9676ccbbf616b53363491e15a80e474443f331
AUX gitlab-support.init 1052 SHA256 e7265ab4237298ed2a849c100c24a76e81c8fcfa726acc1256d5ad623474bab1 SHA512 fe2661d1d0940ca663227156715d2d20147cf500b0129a4a38edd1642e8f8c5c7a8d73d5cfd88f1b1785bd0e0a321eb23f62b2e7f2751b10f392bc6d2d5f905b WHIRLPOOL f72764e19a7aa85c8b82c8e7825c8308bc08579d440d68fbe0086c8670aa1f765289d71baf99cf6057b1fc4b31f15d8544608632271408134bb8fae1dc15335a
AUX gitlab-unicorn-8.init 1680 SHA256 c74c6db7c7bbce85df66648e20c11215917041577733454c6590dff3aacf7362 SHA512 44461e070b19abb1ddfa297aa995b04412cd367fb252591a7faf871f958e78c92955c78ba51137fcd1933dce896a9d05efdf06cabbf2cbe86e138fb12ead1bdb WHIRLPOOL 313548a006a3431e8116edbf3d0ce8613a9e65e3725ba4fb3683e95ebf2b2afac3801900d372839e6dc9a0004d805b98889c47292e8622e918c73a3a5e2fc0de
AUX gitlab-unicorn.init 1782 SHA256 198814924c71f3de35cec935c2e50c00ecf0f6aeb3129ec829d6aa170f569377 SHA512 b4c00769dd55eeb3b61c8c4cf1155be286cd3269601f80c21e03c9cd0359dc7e13ed8ad6e4421ce5639d21acb8163172f72482ba300523af2ef09d181201d6ce WHIRLPOOL f484373b7e77d8c4a86e46a61ba35b4e4cde69b054fc441d6d7cd4605a63b6e8b65c396fd6ce6001f0d20b28f39c22447a8746b5ec0716332cb5bb581db0bf46
AUX gitlab-unicorn.service 773 SHA256 010c9e223a30400d9155b39499eb0d7efad23b66baab9fcd9e365c689086b9bd SHA512 0bf9630aa91ed8f590a7bfa42d09b7ba33f6342b43b3d191c792c11157f8926c2a2ac2390eebd8179637e29b5bf68233d4699d62463497a0fd45b9bdbdd9167b WHIRLPOOL fbc709a5550dcc548a35c22c812dafe52ee507f5678b57c22c709ee89a399ae9109e2f56b7a13135d4140f1e024ebc4effe4aa4de13e0f36691da2a0737d9792
AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c101f43ca263 SHA512 909c49fee6d050c1e94b2559ff2a9d54c5c346492be0e2920b50d56d69eaddbed67e3ac12e012d2a9601b5596640ebf33c8dc68fc588a03ca370d963294be37f WHIRLPOOL fa436e8d7d2643d450259d26b6e7b24dae69df47ed22e5ef2a567f37aa785fbf3b0eb1129ae7c8bf8986c29559fc3b744a34064375e5245dce2b10053cd715d9
AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee
AUX gitlabhq-6.9.2-fix-checks-gentoo.patch 413 SHA256 5e9358e6670ed6711f171876c46b7222e3fcb66e6cfa1658b3627d2878a92d87 SHA512 50a1e441d9bfcf0f5784fa1b940833653010dca23d96ca9b2cd462b7f659aa5ca6042c7eb8b2b5dd3319e507accd0ccb8d0c5ee2be78aa35749df9c3e924e899 WHIRLPOOL 7452073e202ecf7bb08ee463c088bbe883ba31aeb8f96db18f16af6f119cba6e698fa3a619122b05a69c932434b856d8162ff59c33f66214b7cbb53035a619a3
AUX gitlabhq-6.9.2.init 1920 SHA256 3fe052a74614130c3e8cddc59ef40c05e5249e9714b77201791344ddf933da25 SHA512 6d2ebc5559248696eae55d34b17562262c1ba4faf3be7e58da149addcde77a75137e9cef7c9f2a9a7b5382fa1ad1e79eaab035c74a435b9ba4510dbb10cffe60 WHIRLPOOL 191ee5ebf2b8c4d0552848e2323250073a667fbf04987907f7840435ae9dc862ab4a0b0f8bf157a1adeeb24d6385053ae049592b5b4f06db076a7b31ae63d6a0
@ -12,8 +18,14 @@ AUX gitlabhq-7.8.1-fix-checks-gentoo.patch 412 SHA256 01a04c47d51b10674e38395d81
AUX gitlabhq-7.8.1.init 1943 SHA256 a3706f4b58a86320ea205396eee9561388f5da5d0694f839b83222d83f57cf4b SHA512 29cc7acb41f02441273bb76fcf94f0b781c96d4c7b7ccb3b5bafeff168831d841921afe052671da21ba3fb84200cfffcfcc86eaf61e84b4ce7b102369b4d23c7 WHIRLPOOL 6d9e7da52c173f6d4ba723105f10513eea9efd280d5bdd228eaa44d14d7fc459e58a04482b7cfe61d4c5ddc30cdeefcd085ab0f660246eb28bf927a017ff3ee2
AUX gitlabhq-7.9.0-fix-checks-gentoo.patch 413 SHA256 5e9358e6670ed6711f171876c46b7222e3fcb66e6cfa1658b3627d2878a92d87 SHA512 50a1e441d9bfcf0f5784fa1b940833653010dca23d96ca9b2cd462b7f659aa5ca6042c7eb8b2b5dd3319e507accd0ccb8d0c5ee2be78aa35749df9c3e924e899 WHIRLPOOL 7452073e202ecf7bb08ee463c088bbe883ba31aeb8f96db18f16af6f119cba6e698fa3a619122b05a69c932434b856d8162ff59c33f66214b7cbb53035a619a3
AUX gitlabhq-7.9.0.init 1920 SHA256 ceb6bdd0f497d5c615c3d037c9211ed68b0979356a2e972be430243d1248a7d1 SHA512 37bbea92a7a9427c8b9203e5ef13e2f1db7b0fb02b22457849d785517f8253e161f065821a17ed06d41d662237f2cb930cc2ae4f75091ed951e7eadf9283803a WHIRLPOOL 3c7fe0029385b85ad9fd9a07bfc1ba3683664d2233367e369ed89e43bebd9615279fbbe76bc777ca3366adc3a856a4c27f55b80fa685fc53608fc8078ab3b5e1
AUX gitlabhq-8.0.2-fix-gemfile.patch 1586 SHA256 c91945e0e639b1297519d7165a3aa03fe203a29cde1d195f277be6cba71c67e1 SHA512 6eb15935292902b3090e856e00a972ee2e442eadbf2e42fbde1e4727d75d65e0e06c6be54be8fcd7aeebb5e0616c8d5123f60ebabebd7e02531f0fbc7b03d760 WHIRLPOOL 985e86c5bcb1ea059b41f1f08d3528afd3ab31d71eb81df79a2b454a0e2fb24dbf08b4a1c9197e56864550842baa60599db631bbd2a3603caaea9b7d6743e3d1
AUX gitlabhq-8.0.4.init 1944 SHA256 9f6b25a118dcbdc144290acb828f67a7e766d223854390036606bf845882d6da SHA512 3706a84b0c01392264f6036708ada0a3941ca26ff0ee7a3abd2eccebbd2e66fa4b6501b5b4efd24f4b1170502843860fdb4209f9536b51a65a4c0325d5d85ea5 WHIRLPOOL af5e48939c34640130facb6a54a5386e05d620feea6ccc96d00c07442c64717bcb39cbf01471a93297a8e7ac5b14329906e570ca92e5a0a6a60831d5f7155222
AUX gitlabhq-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
DIST gitlabhq-8.0.4.tar.gz 8238901 SHA256 644b4bc98907bb171a1281ae73ac510f1bc6d379d39020f61e1697bb73547ae8 SHA512 41d4e8088221beb4aab731cf0ddccba0be2e4746ece0e33f92ec5488a4ed759f1e18788efed2351f5a643c31f47b4138a33077313b27e4e4567c9e9ad8dc79e5 WHIRLPOOL 08157b0f82150a5245cb2985b704026dab5f6342ab9e080c3149850ea37be5482d2dfc330a8d441957c1d8383528d3e65eb41c70ccfbb4a49e4a442f6f24a56e
EBUILD gitlabhq-6.9.2.ebuild 11730 SHA256 baca492d6634b1e932cf5d1be9a9f56f3aada00ee7e3f10e5fbbb40fd180bf22 SHA512 c1731cb8df63ff9bc04e29ac06a0ec9cd7587ac372460ea0d4ae17735257c19376b9b95e943f46570b3feff541110c96b19de1b1e215655ee28e07f5bdb07846 WHIRLPOOL f916eab9f96e93caba3954079af7f2af5cb3c83bbc5ca2b4f419845c6d84a89148e64a5a7a43c6771bf0590206bc5f2733ec7ba642f74b103a4d142d362b44b8
EBUILD gitlabhq-7.0.0.ebuild 11770 SHA256 319b8321bad5bd01db8cc633733c557643cacf0251a93c2b94e53d6c8cf716ca SHA512 3c8537afbb1b0aa03957cede02747e967088410e782ed35aed8e2f34d4c282312b88a6fb2f60cb87aeda42688af492795d8562345dcdf010f9844516bd419827 WHIRLPOOL b47a85ee57523a67e9ec6fe6dd93231344e358920b1f42796fc60d614d0cad1ae4696f93b474e12ac08922d684b622b493e45ce5cf968ae3374c83d462e7af19
EBUILD gitlabhq-7.4.3.ebuild 12261 SHA256 355978fca0c05f261864a0514cb60379b76d7a943daca390fd96601125da7e28 SHA512 02cb41d7ae7cc29c46dc8b745679e3ee6d1bf39fed035e6e1a773900fca743783f8604a3f3bd70c9673a7f03581410ee32c50808226c55ab390671949a68da58 WHIRLPOOL 095d19b2fe9f0789881ab89ef98cc1f711dc567900e160b1a8a0a4523295ad0a8a49e45beeac62c7698ad0c9f46bccba3e0a24c6a190cf21ece2c9bf0e22325a
EBUILD gitlabhq-7.8.1.ebuild 14387 SHA256 a2cee01efcb169abb21486117be2f57a8cdf213d206b52fc88b1a2fdd7b73a87 SHA512 bfa3f2c3623a10b9f2255a1c9f1b08921c8afc6085a7f4e58e926b2e637b23ea5c2661a67643fb6c8be6e0d057ce57a3cd200ff933d5325d5d6d325fc0a46873 WHIRLPOOL c418d9409554beb683a586a5e0dbce6796d641a957fafdd1d1243544ac4706cbb2ab00bd7fdfe74ab56938bb07745bfe1671cebb41c09bd6d20a7e5a105972ec
EBUILD gitlabhq-7.9.0.ebuild 12273 SHA256 37e25a3640a33b0ce8a5cb5ed579665a118134882a1946f1ab869169418eb9c4 SHA512 8f467ae66b6fe25d58401c9f0aced0f2c8d54df40689a0b4d6a45437dde03e422e4ba0d419f4bc9b7e9232e475fdae3efc0d28e7855bc15a2f61aa04fdc5b14f WHIRLPOOL 3d23bb51ed5da285cd61e535da75349a5a43e86e4a35a300d7eae8500b4badf35da6ebc7c37ecfb77ce010a60cf1ee28516a93cbd2d26f472aeb9b2e0691ea41
EBUILD gitlabhq-8.0.4-r1.ebuild 11220 SHA256 93a8b2b23b6db248006db6f6340999864723dbf6288111bf20c92d195c8c133c SHA512 c67cb757651ae76f2b2774a99908536dadd0aa8b77277719d14c91bbc9c4705b6c82759e21799edee459fb634d5e336ef8eef7e75ad78718723a205ffcd72cc5 WHIRLPOOL 223b14502091b9fa06e4bd1b3e02a252d8c75651ec7f6ad0790257ed0494215f94690cc71f306fb1748f269ef2790fbc43a038685b207475f0e221455512e20b
EBUILD gitlabhq-8.0.4.ebuild 14399 SHA256 3ec4be257e35c2ae4266435749ddfff9368e437fa075836a5e03f39574817ca7 SHA512 6ee8f4ec901d42d66553a243eeb9ee4b6bb3d309c6091979f4f25998527f69370601af43d32d86a0eaf649dd47355ed8715eed427f16db39ea85d726d5ab7f36 WHIRLPOOL 686afcddcd51478f626aa064a1dfed9b6c7b2073ab99a1af31e37d2ef8fd33abece4a9aae911fd78b78c05c82f8ab410266b0e7ecea4102505d24c9521e8e378

View File

@ -0,0 +1,25 @@
#####################################################
#
# GitLab version : 8.x - 8.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=Gitlab Git HTTP Worker
Requires=gitlab-unicorn.service
Wants=gitlab-unicorn.service
After=gitlab-unicorn.service
[Service]
Type=forking
User=git
WorkingDirectory=/opt/gitlab
SyslogIdentifier=gitlab-git-http-server
PIDFile=/run/gitlab/gitlab-git-http-server.pid
ExecStart=/opt/gitlab/bin/daemon_with_pidfile /run/gitlab/gitlab-git-http-server.pid /usr/bin/gitlab-git-http-server -listenUmask 0 -listenNetwork unix -listenAddr /run/gitlab/gitlab-git-http-server.socket -authBackend http://127.0.0.1:8080 /var/lib/git/repositories/ >> /var/log/gitlab/gitlab-git-http-server.log 2>&1
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,43 @@
#!/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 gitlab-git-http-server
}
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 $?
}

View File

@ -0,0 +1,27 @@
#####################################################
#
# GitLab version : 5.x - 7.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=GitLab Sidekiq Worker
Requires=redis.service
Wants=mysqld.service postgresql.service
After=redis.service mysqld.service postgresql.service
[Service]
Type=forking
User=git
WorkingDirectory=/opt/gitlab
Environment=RAILS_ENV=production
SyslogIdentifier=gitlab-sidekiq
PIDFile=/run/gitlab/sidekiq.pid
ExecStart=/usr/bin/bundle exec "sidekiq -d -q archive_repo -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e production -P /run/gitlab/sidekiq.pid -d -L /var/log/gitlab/sidekiq.log >> /var/log/gitlab/sidekiq.log 2>&1"
ExecStop=/usr/bin/bundle exec "sidekiqctl stop /run/gitlab/sidekiq.pid >> /var/log/gitlab/sidekiq.log 2>&1"
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,67 @@
#!/sbin/runscript
name="GitLab"
description="GitLab 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 gitlab-git-http-server
}
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 $?
}

View File

@ -0,0 +1,25 @@
#####################################################
#
# GitLab version : 5.x - 7.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=GitLab Unicorn Server
Requires=redis.service
Wants=mysqld.service postgresql.service
After=redis.service mysqld.service postgresql.service
[Service]
User=git
WorkingDirectory=/opt/gitlab
Environment=RAILS_ENV=production
SyslogIdentifier=gitlab-unicorn
PIDFile=/run/gitlab/unicorn.pid
ExecStart=/usr/bin/bundle exec "unicorn_rails -D -c /opt/gitlab/config/unicorn.rb -E production"
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
d /run/gitlab 0755 git git

View File

@ -0,0 +1,56 @@
diff --git a/Gemfile b/Gemfile
index 5443374..31e1db6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -181,6 +181,9 @@ gem "underscore-rails", "~> 1.4.4"
# Sanitize user input
gem "sanitize", '~> 2.0'
+# The newer revision of charlock_holmes that is finally fixed to be compatible with Gentoo
+gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
+
# Protect against bruteforcing
gem "rack-attack", '~> 4.3.0'
@@ -190,9 +193,6 @@ gem 'ace-rails-ap', '~> 2.0.1'
# Keyboard shortcuts
gem 'mousetrap-rails', '~> 1.4.6'
-# Detect and convert string character encoding
-gem 'charlock_holmes', '~> 0.6.9.4'
-
gem "sass-rails", '~> 4.0.5'
gem "coffee-rails", '~> 4.1.0'
gem "uglifier", '~> 2.3.2'
diff --git a/Gemfile.lock b/Gemfile.lock
index 3c16251..960effc 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:
@@ -101,7 +108,6 @@ GEM
json (>= 1.7)
celluloid (0.16.0)
timers (~> 4.0.0)
- charlock_holmes (0.6.9.4)
chronic (0.10.2)
chunky_png (1.3.4)
cliver (0.3.2)
@@ -802,7 +808,7 @@ DEPENDENCIES
capybara (~> 2.4.0)
capybara-screenshot (~> 1.0.0)
carrierwave (~> 0.9.0)
- charlock_holmes (~> 0.6.9.4)
+ charlock_holmes!
coffee-rails (~> 4.1.0)
colored (~> 1.2)
colorize (~> 0.5.8)

View File

@ -0,0 +1,64 @@
#!/sbin/runscript
name="GitLab"
description="GitLab 8.0 on Unicorns"
: ${gitlab_user:=git}
: ${gitlab_group:=git}
: ${gitlab_home:="/opt/gitlabhq-8.0"}
: ${server_pidfile:="/opt/gitlabhq-8.0/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="/opt/gitlabhq-8.0/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="/var/log/gitlabhq-8.0/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e ${rails_env} -P ${sidekiq_pidfile} -d -L ${sidekiq_log} >> ${sidekiq_log}"
sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net mysql
}
start() {
ebegin "Starting GitLab 8.0 Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab 8.0 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab 8.0 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab 8.0 Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}

View File

@ -0,0 +1,20 @@
diff --git a/config/environments/production.rb b/gitlab-6/environments/production.rb
index 82eb250..10e25e5 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -73,11 +73,10 @@ Gitlab::Application.configure do
# config.active_record.auto_explain_threshold_in_seconds = 0.5
config.action_mailer.delivery_method = :sendmail
- # Defaults to:
- # # config.action_mailer.sendmail_settings = {
- # # location: '/usr/sbin/sendmail',
- # # arguments: '-i -t'
- # # }
+ config.action_mailer.sendmail_settings = {
+ location: '/usr/sbin/sendmail',
+ arguments: '-i'
+ }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
end

View File

@ -0,0 +1,371 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
# Maintainer notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
#
USE_RUBY="ruby21"
PYTHON_COMPAT=( python2_7 )
inherit eutils python-r1 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/v8.0.0.rc1.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-8.0.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# rugged dev-util/cmake, virtual/pkgconfig
# json dev-util/ragel
# pygments.rb python 2.7+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
net-libs/nodejs
postgres? ( >=dev-db/postgresql-9.1:* )
mysql? ( virtual/mysql )
kerberos? ( virtual/krb5 )"
CDEPEND="
dev-util/cmake
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.5
dev-vcs/git
>=dev-vcs/gitlab-git-http-server-0.2.10
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser =dev-libs/libgit2-0.22* )"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
dev-ruby/http_parser_rb
>=dev-ruby/bundler-1.0"
#
# fix-gemfile:
# Remove therubyracer that doesn't compile well on Gentoo (we're using
# nodejs instead that is faster and better). Also replace broken
# charlock_holmes version with fixed one.
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-8.0.2-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ce/blob/v${PV}/bin/background_jobs
SIDEKIQ_QUEUES="post_receive,mailer,archive_repo,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}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
# clean gems cache
rm -Rf vendor/bundle/ruby/*/cache
rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script ##
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dounit "${FILESDIR}/gitlab-git-http.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-8.init
use unicorn && rcscript=gitlab-unicorn-8.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 $@"
}

View File

@ -0,0 +1,441 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Mainteiner 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 flags analytics and public-projects applies our custom patches, see
# https://github.com/cvut/gitlabhq for more information.
#
USE_RUBY="ruby20"
PYTHON_DEPEND="2:2.7"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlabhq.git"
EGIT_COMMIT="v${PV}"
inherit eutils git-2 python ruby-ng versionator user
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
LICENSE="MIT"
SLOT=$(get_version_component_range 1-2)
KEYWORDS="~amd64 ~x86 ~arm"
IUSE="memcached mysql +postgres +unicorn"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# json dev-util/ragel
# yajl-ruby dev-libs/yajl
# pygments.rb python 2.5+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql-base
# mysql virtual/mysql
# rugged net-libs/http-parser dev-libs/libgit2
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-ruby/rb-inotify
dev-util/ragel
dev-libs/yajl
net-libs/nodejs
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )
memcached? ( net-misc/memcached )
net-libs/http-parser
>=dev-libs/libgit2-0.22.0
<dev-libs/libgit2-0.23.0"
DEPEND="${GEMS_DEPEND}
$(ruby_implementation_depend ruby20)[readline,ssl]
>=dev-vcs/git-1.8.1.5
>=dev-vcs/gitlab-shell-2.6.5
net-misc/curl
virtual/ssh"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
virtual/krb5"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#RUBY_PATCHES=(
# "${P}-fix-checks-gentoo.patch"
#)
GIT_USER="git"
GIT_GROUP="git"
GIT_HOME=$(getent passwd $GIT_USER | cut -d: -f6)
DEST_DIR="/opt/${PN}-${SLOT}"
CONF_DIR="/etc/${PN}-${SLOT}"
GIT_REPOS="${GIT_HOME}/repositories"
GIT_SATELLITES="${GIT_HOME}/gitlab-satellites"
GITLAB_SHELL="/var/lib/gitlab-shell"
GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks"
RAILS_ENV=${RAILS_ENV:-production}
RUBY=${RUBY:-ruby20}
BUNDLE="${RUBY} /usr/bin/bundle"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "$GIT_GROUP}"
}
all_ruby_unpack() {
git-2_src_unpack
}
each_ruby_prepare() {
# fix path to repo and gitlab-shell hooks
test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"?
sed -i \
-e "s|\(\s*path:\s\)/.*/gitlab-shell/|\1 ${GITLAB_SHELL}/|" \
-e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \
-e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \
-e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \
-e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
# modify database settings
sed -i \
-e 's|\(username:\) postgres.*|\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"
# replace "secret" token with random one
local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128)
sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \
config/initializers/secret_token.rb \
|| die "failed to filter secret_token.rb"
# remove needless files
#rm -r .git Satisfy gitlab::check.
rm .foreman .gitignore Procfile
use unicorn || rm config/unicorn.rb.example
use postgres || rm config/database.yml.postgresql
use mysql || rm config/database.yml.mysql
# remove dependency on therubyracer and libv8 (we're using nodejs instead)
local tfile; for tfile in Gemfile{,.lock}; do
sed -i \
-e '/therubyracer/d' \
-e '/libv8/d' \
"${tfile}" || die "failed to filter ${tfile}"
done
# change thin and unicorn dependencies to be optional
sed -i \
-e '/^gem "thin"/ s/$/, group: :thin/' \
-e '/^gem "unicorn"/ s/$/, group: :unicorn/' \
Gemfile || die "failed to modify Gemfile"
# change cache_store
if use memcached; then
sed -i \
-e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \
config/environments/production.rb \
|| die "failed to modify production.rb"
fi
# Update pathes for unicorn
if use unicorn; then
sed -i \
-e "s#/home/git/gitlab#${DEST_DIR}#" \
config/unicorn.rb.example \
|| die "failed to modify unicorn.rb.example"
fi
# Use >timfle-krb5-auth-0.8, see https://github.com/timfel/krb5-auth/pull/7
sed -i \
-e "s#timfel\-krb5\-auth (0.8)#timfel\-krb5\-auth (0.8.3)#g" \
Gemfile.lock \
|| die "failed to update Gemfile.lock"
}
each_ruby_install() {
local dest="${DEST_DIR}"
local conf="/etc/${PN}-${SLOT}"
local temp="/var/tmp/${PN}-${SLOT}"
local logs="/var/log/${PN}-${SLOT}"
local uploads="${DEST_DIR}/public/uploads"
## Prepare directories ##
diropts -m750
keepdir "${logs}"
dodir "${temp}"
diropts -m755
keepdir "${conf}"
dodir "${dest}"
dodir "${uploads}"
dosym "${temp}" "${dest}/tmp"
dosym "${logs}" "${dest}/log"
## Link gitlab-shell into git home
dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell"
## Install configs ##
insinto "${conf}"
doins -r config/*
dosym "${conf}" "${dest}/config"
insinto "${dest}/.ssh"
newins "${FILESDIR}/config.ssh" config
echo "export RAILS_ENV=production" > "${D}/${dest}/.profile"
## Install all others ##
# remove needless dirs
rm -Rf config tmp log
insinto "${dest}"
doins -r ./
## Install logrotate config ##
dodir /etc/logrotate.d
sed -e "s|@LOG_DIR@|${logs}|" \
"${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \
|| die "failed to filter gitlab.logrotate"
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test thin"
local flag; for flag in memcached mysql postgres unicorn; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
# Use systemlibs for rugged
${BUNDLE} config build.rugged --use-system-libraries
# Use systemlibs for nokogiri as suggested
${BUNDLE} config build.nokogiri --use-system-libraries
# Fix invalid ldflags for charlock_holmes,
# see https://github.com/brianmario/charlock_holmes/issues/32
${BUNDLE} config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc'
einfo "Running bundle install ${bundle_args} ..."
${BUNDLE} install ${bundle_args} || die "bundler failed"
## Clean ##
local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version')
# remove gems cache
rm -Rf ${gemsdir}/cache
# fix permissions
fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}"
fperms o+Xr "${temp}" # Let nginx access the unicorn socket
## RC scripts ##
local rcscript=${P}.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@GIT_USER@|${GIT_USER}|" \
-e "s|@GIT_GROUP@|${GIT_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@DEST_DIR@|${dest}|" \
-e "s|@LOG_DIR@|${logs}|" \
-e "s|@RESQUE_QUEUE@|${resque_queue}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
if use memcached; then
sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \
"${T}/${rcscript}" || die "failed to filter ${rcscript}"
fi
newinitd "${T}/${rcscript}" "${PN}-${SLOT}"
}
pkg_postinst() {
if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
einfo "Generating SSH key for git user"
su -l ${GIT_USER} -s /bin/sh -c "
ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
|| die "failed to generate SSH key"
fi
if [ ! -e "${GIT_HOME}/.gitconfig" ]; then
einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to "
einfo "modify this file according to your needs!"
su -l ${GIT_USER} -s /bin/sh -c "
git config --global user.email 'gitlab@localhost';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
elog "If this is a new installation, proceed with the following steps:"
elog
elog " 1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
elog " and edit this file in order to configure your GitLab settings."
elog
elog " 2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml"
elog " and edit this file in order to configure your database settings"
elog " for \"production\" environment."
elog
elog " 3. If this is a new installation, create a database for your GitLab instance."
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 gitlab_production"
elog " Note: You should change your password to something more random..."
elog
elog " GitLab uses polymorphic associations which are not SQL-standard friendly."
elog " To get it work you must use this ugly workaround:"
elog " psql -U postgres -d gitlab"
elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;"
elog
fi
elog " 4. Execute the following command to finalize your setup:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server."
elog
elog "To update an existing instance, run the following command and choose upgrading when prompted:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog
}
pkg_config() {
## Check config files existence ##
einfo "Checking configuration files ..."
if [ ! -r "${CONF_DIR}/database.yml" ] ; then
eerror "Copy \"${CONF_DIR}/database.yml.*\" to \"${CONF_DIR}/database.yml\""
eerror "and edit this file in order to configure your database settings for"
eerror "\"production\" environment."
die
fi
if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then
eerror "Copy \"${CONF_DIR}/gitlab.yml.example\" to \"${CONF_DIR}/gitlab.yml\""
eerror "and edit this file in order to configure your GitLab settings"
eerror "for \"production\" environment."
die
fi
# Ask user whether this is the first installation
einfo "Do you want to upgrade an existing installation? [Y|n] "
do_upgrade=""
while true
do
read -r do_upgrade
if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break
elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break
else eerrorn "Please type either \"Y\" or \"N\" ... " ; fi
done
if [[ $do_upgrade ]] ; then
LATEST_DEST=$(test -n "${LATEST_DEST}" && echo ${LATEST_DEST} || \
find /opt -maxdepth 1 -iname 'gitlabhq-*' -and -type d -and -not -iname "gitlabhq-${SLOT}" | \
sort -r | head -n1)
if [[ -z "${LATEST_DEST}" || ! -d "${LATEST_DEST}" ]] ; then
einfo "Please enter the path to your latest Gitlab instance:"
while true
do
read -r LATEST_DEST
test -d ${LATEST_DEST} && break ||\
eerror "Please specify a valid path to your Gitlab instance!"
done
else
einfo "Found your latest Gitlab instance at \"${LATEST_DEST}\"."
fi
einfo "Please make sure that you've stopped your running Gitlab instance and that you've created a backup: "
elog "\$ cd \"${LATEST_DEST}\" && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:backup:create RAILS_ENV=production"
elog ""
einfo "Press ENTER to continue, STRG-C to cancel"
read
einfo "Migrating uploads ..."
einfo "This will move your uploads from \"$LATEST_DEST\" to \"${DEST_DIR}\", continue? [Y|n] "
migrate_uploads=""
while true
do
read -r migrate_uploads
if [[ $migrate_uploads == "n" || $migrate_uploads == "N" ]] ; then migrate_uploads="" && break
elif [[ $migrate_uploads == "y" || $migrate_uploads == "Y" || $migrate_uploads == "" ]] ; then migrate_uploads=1 && break
else eerror "Please type either \"Y\" or \"N\" ... " ; fi
done
if [[ $migrate_uploads ]] ; then
su -l ${GIT_USER} -s /bin/sh -c "
mv ${LATEST_DEST}/public/uploads/* ${DEST_DIR}/public/uploads/" \
|| die "failed to migrate uplaods."
fi
einfo "Migrating config ..."
for conf in database.yml gitlab.yml resque.yml unicorn.rb ; do
cp "${LATEST_DEST}/config/${conf}" "${DEST_DIR}/config/"
example="${DEST_DIR}/config/${conf}.example"
test -d "${example}" && mv "${example}" "${DEST_DIR}/config/.cfg0000_${conf}"
done
CONFIG_PROTECT="${DEST_DIR}" dispatch-conf || die "failed to migrate config."
einfo "Migrating database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake db:migrate RAILS_ENV=production
${BUNDLE} exec rake gitlab:satellites:create RAILS_ENV=production" \
|| die "failed to migrate database."
einfo "Clear redis cache ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake cache:clear RAILS_ENV=production" \
|| die "failed to run cache:clear"
einfo "Clear and precompile assets ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake assets:clean RAILS_ENV=production
${BUNDLE} exec rake assets:precompile RAILS_ENV=production" \
|| die "failed to run assets:precompile"
else
einfo "Initializing database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \
|| die "failed to run rake gitlab:setup"
fi
einfo "You might want to run the following in order to check your application status:"
einfo "# cd ${DEST_DIR} && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:check RAILS_ENV=production"
einfo ""
einfo "GitLab is prepared, now you should configure your web server."
}