diff --git a/sys-cluster/ganglia-web/Manifest b/sys-cluster/ganglia-web/Manifest
new file mode 100644
index 0000000..564eb13
--- /dev/null
+++ b/sys-cluster/ganglia-web/Manifest
@@ -0,0 +1,3 @@
+DIST ganglia-web-3.7.2.tar.gz 704632 SHA256 98820187c98d24d3645b92d31060623de696dad331a361a19874898339523628 SHA512 033b00923a4cf7f342a44de9e37da67411992054e7f103fa09d91bbd125fb9066cc4e77ae5011810d7d926e2997b48d30e3d505d83239cd4c0a6b996a7679f8d WHIRLPOOL 3af95583cacd81deb9516a1dcbd036a8d16a254b8997fd0307812b1b471e888b4716b496c367bb1a545f6305bff2275a95145ba322b55ba6fea03c93acde0f26
+EBUILD ganglia-web-3.7.2.ebuild 1146 SHA256 2ca148c26fb671d36f477e39518f1ff5e1ed0801f3b430992b4340687b4b9f62 SHA512 aba058daab68b3c273e6f9276a8fba06269865b3962ed1b6a2cbc53debb34262d211090d12985ffa2592fac84ee714acb03c8e84e5e9589a33ba428656c0fa16 WHIRLPOOL bfa0ceadb11b50e51156aace19e364ff0bd6e58cce7d872ae1715d1b6e7a52165a52403a7f559797b10c7d12d2597691e9d09c83ba7f47fbf2ef9d3a9c728fe6
+MISC metadata.xml 334 SHA256 a0156eea226535177cb784d92cec49e67ab431b69a129bd5f792d2b11804ccde SHA512 9b58ae22b5ef2ebe1d7b247b179273a68033ccbc01c78969a2ec10a2a3932432ea4328b91e192b30dcef84381313fff1d26fc0e4d7e4cf70f0a36aa9c3cd8a63 WHIRLPOOL 7a92b4c49c9d0a34865d7e5ff49dccc327e2b8f12e58c9ae494757c6d40ace8819027d23dc382f9ab53cbefbe74f0e046d51fbec63e8d6ad705a400a21ebb224
diff --git a/sys-cluster/ganglia-web/ganglia-web-3.7.2.ebuild b/sys-cluster/ganglia-web/ganglia-web-3.7.2.ebuild
new file mode 100644
index 0000000..d0456ad
--- /dev/null
+++ b/sys-cluster/ganglia-web/ganglia-web-3.7.2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+WEBAPP_MANUAL_SLOT="yes"
+inherit webapp eutils
+
+DESCRIPTION="Web frontend for sys-cluster/ganglia"
+HOMEPAGE="http://ganglia.sourceforge.net"
+SRC_URI="mirror://sourceforge/ganglia/${PN}/${PV}/${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="vhosts"
+
+DEPEND="net-misc/rsync"
+RDEPEND="
+ ${DEPEND}
+ ${WEBAPP_DEPEND}
+ >=sys-cluster/ganglia-3.7.0[-minimal]
+ dev-lang/php[gd,xml,ctype,cgi]
+ media-fonts/dejavu"
+
+src_configure() {
+ return 0
+}
+
+src_compile() {
+ return 0
+}
+
+src_prepare() {
+ return 0
+}
+
+src_install() {
+ webapp_src_preinst
+ cd "${S}"
+ emake \
+ GDESTDIR="${MY_HTDOCSDIR}" \
+ DESTDIR="${D}" \
+ APACHE_USER=nobody \
+ install || die
+ webapp_configfile "${MY_HTDOCSDIR}"/conf_default.php
+ webapp_src_install
+
+ fowners -R nobody:nobody /var/lib/ganglia-web/dwoo
+ fperms -R 777 /var/lib/ganglia-web/dwoo
+
+ dodoc AUTHORS README TODO || die
+}
+
+pkg_postinst() {
+ webapp_pkg_postinst
+
+ # upgrade from < 3.5.6
+ if [ -d "${ROOT}"/var/lib/ganglia/dwoo ]; then
+ rm -rf "${ROOT}"/var/lib/ganglia/dwoo || die
+ fi
+}
diff --git a/sys-cluster/ganglia-web/metadata.xml b/sys-cluster/ganglia-web/metadata.xml
new file mode 100644
index 0000000..89825de
--- /dev/null
+++ b/sys-cluster/ganglia-web/metadata.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ cluster@gentoo.org
+ Gentoo Cluster Project
+
+
+ ganglia
+
+
diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog
index d2ed9bc..2dffa66 100644
--- a/www-apps/gitlab-ce/ChangeLog
+++ b/www-apps/gitlab-ce/ChangeLog
@@ -1,3 +1,9 @@
+*gitlab-ce-10.0.7 (08 Feb 2018)
+
+ 08 Feb 2018; Manuel Friedli +gitlab-ce-10.0.7.ebuild:
+ www-apps/gitlab-ce: Add ebuild for version 10.0.7, the latest version for the
+ 10.0 branch.
+
*gitlab-ce-10.0.4 (27 Oct 2017)
27 Oct 2017; Manuel Friedli +gitlab-ce-10.0.4.ebuild,
diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest
index a567a08..0e2bea4 100644
--- a/www-apps/gitlab-ce/Manifest
+++ b/www-apps/gitlab-ce/Manifest
@@ -18,6 +18,7 @@ AUX gitlab-workhorse.service 930 SHA256 09348a52fec333b4b19828752e0484400c1efa9d
AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c101f43ca263 SHA512 909c49fee6d050c1e94b2559ff2a9d54c5c346492be0e2920b50d56d69eaddbed67e3ac12e012d2a9601b5596640ebf33c8dc68fc588a03ca370d963294be37f WHIRLPOOL fa436e8d7d2643d450259d26b6e7b24dae69df47ed22e5ef2a567f37aa785fbf3b0eb1129ae7c8bf8986c29559fc3b744a34064375e5245dce2b10053cd715d9
DIST gitlab-ce-10.0.0_rc3.tar.gz 39936453 SHA256 347840d9beb01f765c4962616e241924b48ec0e3c09b35ff96563d1b509d4375 SHA512 855324e0c351ff1db3bc8823f85768d6968628da1452edc68f63249467eede89ba371e3d2de94a5fca3f31462c3d13dc2a8b3cd467f0647896183ead27492c81 WHIRLPOOL b7e98abb055cb6e884505dd2d49e93031f6722c0fb7cc34470903248de6f8871456deee2e41cf4da27b42dd7b4996111ecac02d568aa44286670edfd07d5cd7a
DIST gitlab-ce-10.0.4.tar.gz 40040781 SHA256 eef116f75b64b835402a87e3737a3721143823c7094ded06edf8f9ac974a7ca8 SHA512 346719e7ea8dba4cb55396cfaafc8d70c7145d4de63913dc736c7f21f3f1ac133a1c837c19a3b1131879678a7b5e8b9bb6abb0bf29031802dda6e3b96e0715c0 WHIRLPOOL a62361a9f48911a9bf0244411aa638017f8cd928e6b7fce501da5645b3f1813323abaebb2e7937d3c78bbf2724962575813940222d729b5356e77ff524231d02
+DIST gitlab-ce-10.0.7.tar.gz 40049508 SHA256 890eed75ee502cd6c612756815ac8c854eeee3d00ab3d7bf00ee580db8141264 SHA512 770b747a35988b663f1ffe3b05b317839cc66e9c76e64e51673d066787a42acbb688b739fe9fe3a6dc787f2e44d6fbd99388ea0a20f103bedc631ed0054401f4 WHIRLPOOL 0de51582532936620b4140013f87652e7581956fd6e662d83e53ed024699ff70c2c52fbb863f8052c5df36bd5b63cff0cc6fd9372c97ea2265aa1242a2d6afdc
DIST gitlab-ce-9.0.13.tar.gz 26366204 SHA256 056c98acb558776a2919b1aa501cb5303e66eb3cfe1d54b26988492be1c3816b SHA512 42fae9a01adc1eaac8e59b4ddb5f1d7c11d409dab32b84bf9849eedfed88bf87f7d36d0f9687f253424e2eacdbf83b3560bf9e64baa1533e4b1b6ff6e3be65e7 WHIRLPOOL d5c312d3f63057786ad28b2fba328d7a0593a5140aad617067b0aa0319d741f36ff32e573a436bf663f0f56d820b02fea5e22a430355856268306582fb62396a
DIST gitlab-ce-9.1.10.tar.gz 30516975 SHA256 37cfd9dafcfbcd432d7d7a3abc6889bcd35321fc00b717f4810bf432791b0243 SHA512 81a7b9836aafcb348b6c38d8c19917053fc7a6adc6328d4b05215aa3d5c698adb708068d36bdc82df61e5b2d6b269c0ba8682b4994fa4a36b98fabe5b17e5f07 WHIRLPOOL b0affc921e0b41faabe354805fbcbd56a5839f7eeb880c00c2f10b68b0f2865b8e39ed58cfd99f6b6d0f2517bd465ff3f227fc6f17e1c1e17128299f21a911f2
DIST gitlab-ce-9.2.10.tar.gz 30988788 SHA256 a30e9d08d08433713df958d447a76cf2ed16344c7de56614f2849e8caad3e3b5 SHA512 fd4602c86edaf3060e1f5b8c8d6c5e4d40ec64f7f3d2519008b8c096720016c9a0dc6357bc464e72e4b52b25bd12ab26a4166898fba608383b4e4647ad49782c WHIRLPOOL f6b79e71f906c461ed89bd23bd537ae640b55c6727d7275e16ecb3b7349957f1461138d8fef5163137cabae59dccfdd8c4b22bd425800bf2eee3b732fd9a2908
@@ -26,6 +27,7 @@ DIST gitlab-ce-9.4.7.tar.gz 32854784 SHA256 c6b0db5ced47a92c211ccb9889a21cf5c698
DIST gitlab-ce-9.5.9.tar.gz 36464622 SHA256 0ef546feae5d66347e4a662332c329e29664ead709641ae4580123c59a9079c4 SHA512 8eae1bddb19753ad87751817f96d0b6eff52fa26f06a56e5aa087dad7954d358aadfaa11ba8138f8e2bebc0d77aed00dd3839d074a9d3125aa27c598b0ead7ff WHIRLPOOL 5683622e9f046bd7884cc4bdfee3653b8c29a8a029f804f795c28fdaf32b70beca7a4e975b4c236f730e72f75a49fa57792d3425d718ceb4364ae27fe00a521e
EBUILD gitlab-ce-10.0.0_rc3.ebuild 13508 SHA256 bb22763056e0686ff308db2bc14e55ed74c4af247eab55f4ba4502ac0fa3f210 SHA512 99f298076aff75183d68b9969e99bba1898501554aa08448539c154b021040d3af7b6f2bac3704511b3b83af7c39d7e42530142a6c5061078ea82fb93aafcbae WHIRLPOOL 129b9b2a0e4d512947c2be0b3143ece02d870f790f9425d5408191aef53e0631bb001390b2438a2f0d4a38b38a679af0909a9df1f9c9a4e3d7448f32110cb997
EBUILD gitlab-ce-10.0.4.ebuild 13526 SHA256 0fa438ddcca42b2ec6090bdb587635c8e82c9d4fb515427f24b264ab4b70db64 SHA512 dd84a68b17bd5ee193f55519bf83d52385e372dbde672915b4a799d30ecf08e2dd004946fbf73acaefcafce9af20355538a5c0d453ee52f7009deb8403001fe4 WHIRLPOOL db04a3db49544333341a4fbd1b1d3ce49e58106b91da12de0b5b2cfeece52876ce6845e6e8b0fd8048fe40ad3b02e78efc191e716fda52a576c959569a9527d5
+EBUILD gitlab-ce-10.0.7.ebuild 13526 SHA256 258085d5365f3c65aed09ea9515bcf453ee2d6f91368401a885376337b2b0c27 SHA512 2ae1bb85618e73b3765323d0f6e8d2ac35aa471c1051b1559c752d567a7d7e4c1f4e5dd3558e20f5b5ee73d75a29da27914a39333ddf2e6e3818b8ae4496e57b WHIRLPOOL cc299c60414881559d80970d1c78b35ed3bd9d9c59a5ad8aaaf51c676109d72616f048f2c80c4bd125c889a35fb45a2f2e48ae7a2db68979805820de2a0df5ae
EBUILD gitlab-ce-9.0.13.ebuild 13139 SHA256 ecdcd1d6ca3999eb4b299628bac4c97a231cfcf682569cc1a0c11241cfcb6099 SHA512 8a6b8f3f05f54a752d57651b34ba4f6310e6695ea6eea1bbebe4a1dd38aa9ea0e9030bd59448a886918e20ea81f1b167236712e21fb6c43b7fb50b79565e2d87 WHIRLPOOL 0873a646dcb208e8c006e0e587fc03003594fd00e790e22d89839c9ffb8b7403a2df7b306ddfb817ea10a32e58d095d97989591de18ca78782bd468ae1fb8bc7
EBUILD gitlab-ce-9.1.10.ebuild 13295 SHA256 a69c179d072e76597091d825956bc308a25757a95406444a95a4ccbe9fe8ee9e SHA512 cc01ae887bce9e838eb020c7b414de4f80c5cc94762bd7c65fc5f6ab732b3ac7447f3f136b054557a5a93d09ed946b821d027fe29d7fdeea6eaaa6fc336cf394 WHIRLPOOL 1778e46da386704fbecc9e62769b9ab6ccdb40ee1028ef33607b4668e3fafbd0996ff4397128d8320098e3bf5c8f1d47a227e3c61a73a26a63663223790c8107
EBUILD gitlab-ce-9.2.10.ebuild 13040 SHA256 ace7b7561f499e43c19284153358b718275ac55792650391f39fa4ab89941c20 SHA512 22c8723251fefd50739ac082f04c377543f659720346cd29680d4956a2d6a37bb27b2c6beb723c09f49d7e478375e6679940f63f43c644564155a0eaffe300ed WHIRLPOOL 9601c5fcdc9b8d753a58ea4b4606957f3d09e63834335703896f55b16c41df7b81ef00b64e57f4409322789dcaa3745d60b31a973950c99037895d71a38ddaf2
@@ -33,5 +35,5 @@ EBUILD gitlab-ce-9.3.11.ebuild 13699 SHA256 e56490b1f59cf32e84d65ba3c91231c07a41
EBUILD gitlab-ce-9.4.7.ebuild 13526 SHA256 5078d51dcca18d9c5380bff25d494437506482beb4e586727b577f1c475363ec SHA512 244e178828910739018fa794c9f03c8f3b0411e45298800eaf828099f9d468b01d73102c9183ce6552d4ba208c086e5b4de85b4e0427e5502b9a54d56cb6a636 WHIRLPOOL 0306b7fc67f570d2ece6cc321461604c2be4fe886122750a481c6573800bbb4164c4cecee54a29a408b1eee17aa479a54271b395575d2d606dbd2ec3ddc4a1ae
EBUILD gitlab-ce-9.5.9.ebuild 13526 SHA256 2618481753b31e74c6a5397ae85a055020356a02b2af9bfc9e3db93afeccb5b4 SHA512 ff259f6b0ae403efe40af5d07a9a9901f6e7f0df262a767e10a6d3a77ad251c44675ea448521327a633b2185c717d45d718351a78ecb3151e205696aa0df9722 WHIRLPOOL b74f4e38d5038cdd9ded17ceb254703c8be00cf552495cb97d416b38c4af6d8579a5f97233776c74f558b527cff9d48eb48d64d84bc7f867f47976432834be8a
EBUILD gitlab-ce-9999.ebuild 13468 SHA256 ab13060918b09a67f3f0c653a3836c1077933c606e5ea4e3416fde204aa530af SHA512 f14bc61622929dc57460fd7e4b3d965437fdc44706c52608a6b278021960bb70b62f81a6dd38beeb134c0f40ef29a81e07ea5a49c9a7a8e7ab63f55529231cb8 WHIRLPOOL 204d2f97890f2868b9f890fcc9b03d3c47c6916e52af341cf946e197acd8c2287409a5a1e525183a62fec9588eaa21b9d3ad30bba3b12267aa4c9e1163ca7fb0
-MISC ChangeLog 25031 SHA256 4a75f508eddf856c391eeda8d9fd66d32a7791f962cc16e2883995f29c6c5afa SHA512 3dc3c3b9b179e2808b40e775b39ae836afec94fdb66dfc7b724129c897acf36ea4963641a615b9ddc8dea87560d7aae07a9fd73be0ec2a93910e895d1eb8fac8 WHIRLPOOL c18f9a85e1274eaa747d371be79588b182e3941494069976838a5f6813a78a0dd6fc89c6ca5f9ed3f21df90bba3a140f7755ecc94e26cf5aa026b79314523856
+MISC ChangeLog 25238 SHA256 5ad291aef68d2d6531f1cf0f5e7db1206dc13eeea05c1286906aed17610f58e5 SHA512 9be2a04da23dbfbd49892e384e8fa62a2b7c345ecb56973b47b1ebedc53384e76974f514bf11406012f623abdbff73e72dae5a724d88546700676d0dd1e5b3eb WHIRLPOOL 8156a954426822a89421cd85208cbc88f13cfaa30ac693a1f5e9301c7222f401aefad399d9166e9190d268878c8dad88833248865a59cea73237eb74c35732eb
MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6
diff --git a/www-apps/gitlab-ce/gitlab-ce-10.0.7.ebuild b/www-apps/gitlab-ce/gitlab-ce-10.0.7.ebuild
new file mode 100644
index 0000000..fe13d59
--- /dev/null
+++ b/www-apps/gitlab-ce/gitlab-ce-10.0.7.ebuild
@@ -0,0 +1,429 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+# 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="ruby23"
+
+inherit eutils ruby-ng user systemd
+
+MY_PV="v${PV/_/-}"
+MY_GIT_COMMIT="03a14086924c017c49b49d20b525b90ae2a965f5"
+
+GITALY_VERSION="0.38.0"
+GITLAB_PAGES_VERSION="0.5.1"
+GITLAB_SHELL_VERSION="5.9.0"
+GITLAB_WORKHORSE_VERSION="3.0.0"
+
+DESCRIPTION="GitLab is a free project and repository management application"
+HOMEPAGE="https://about.gitlab.com/"
+SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz"
+RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}"
+
+RESTRICT="mirror"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~arm64"
+IUSE="kerberos mysql +postgres +unicorn systemd pages 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-libs/re2
+ dev-util/ragel
+ >=net-libs/nodejs-4.3.0
+ >=sys-apps/yarn-0.17.0
+ postgres? ( >=dev-db/postgresql-9.6:* )
+ mysql? ( virtual/mysql )
+ kerberos? ( virtual/krb5 )"
+CDEPEND="
+ dev-util/cmake
+ virtual/pkgconfig"
+COMMON_DEPEND="
+ ${GEMS_DEPEND}
+ ~dev-vcs/gitlab-shell-${GITLAB_SHELL_VERSION}
+ >=dev-vcs/git-2.8.4
+ ~www-servers/gitlab-workhorse-${GITLAB_WORKHORSE_VERSION}
+ kerberos? ( !app-crypt/heimdal )
+ rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/26 )
+ pages? ( ~www-servers/gitlab-pages-${GITLAB_PAGES_VERSION} )
+ ~www-servers/gitlab-gitaly-${GITALY_VERSION}"
+DEPEND="
+ ${CDEPEND}
+ ${COMMON_DEPEND}"
+RDEPEND="
+ ${COMMON_DEPEND}
+ >=dev-db/redis-2.8
+ virtual/mta
+ systemd? ( sys-apps/systemd:0= )"
+# required bundler >= 1.15.3
+ruby_add_bdepend "
+ virtual/rubygems
+ >=dev-ruby/bundler-1.14.6"
+
+#
+# fix-sendmail-config:
+# Fix default settings to work with ssmtp that doesn't know '-t' argument.
+# fix-redis-config-path:
+# Point to the absolute location of redis_config.rb
+#
+PATCHES=(
+ "${FILESDIR}/01-${PN}-8.7.5-fix-sendmail-config.patch"
+ "${FILESDIR}/02-${PN}-9.0.0-fix-redis-config-path.patch"
+ "${FILESDIR}/03-${PN}-9.4.0-database.yml.patch"
+ "${FILESDIR}/04-${PN}-9.3.0-fix-check-task.patch"
+ "${FILESDIR}/05-${PN}-9.0.0-replace-sys-filesystem.patch"
+ "${FILESDIR}/06-${PN}-8.17.0-fix-webpack-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}"
+
+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
+ local run_path=/run/${MY_NAME}
+
+ 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/|" \
+ -e "/path: \\/home\\/git\\/repositories\\/$/ s|/home/git/repositories/|/var/lib/git/repositories/|" \
+ -e "/gitaly_address:/ s|/home/git/gitlab/tmp/sockets/private/|${run_path}/sockets/|" \
+ config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
+
+ sed -i -E \
+ -e "s|/home/git/gitlab/tmp|${run_path}|g" \
+ -e "s|/home/git/gitlab/log|${LOGS_DIR}|g" \
+ -e "s|/home/git/gitlab|${DEST_DIR}|g" \
+ config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
+
+ sed -i \
+ -e "s|/home/git/gitlab/tmp|${run_path}|g" \
+ lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
+
+ # modify default database settings for PostgreSQL
+ sed -i -E \
+ -e 's|(username:).*|\1 gitlab|' \
+ -e 's|(password:).*|\1 gitlab|' \
+ -e 's|(socket:).*|\1 /run/postgresql/.s.PGSQL.5432|' \
+ config/database.yml.postgresql \
+ || die "failed to filter database.yml.postgresql"
+
+ # rename config files
+ mv config/gitlab.yml.example config/gitlab.yml
+ mv config/unicorn.rb.example config/unicorn.rb
+
+ local dbconf=config/database.yml
+ if use postgres && ! use mysql; then
+ mv ${dbconf}.postgresql ${dbconf}
+ rm ${dbconf}.mysql
+ elif use mysql && ! use postgres; then
+ mv ${dbconf}.mysql ${dbconf}
+ rm ${dbconf}.postgresql
+ fi
+
+ # remove useless files
+ rm -r lib/support/{deploy,init.d}
+ use unicorn || rm config/unicorn.rb
+}
+
+all_ruby_install() {
+ local dest=${DEST_DIR}
+ local conf=${CONF_DIR}
+ local logs=${LOGS_DIR}
+ local temp=${TEMP_DIR}
+
+ # prepare directories
+ diropts -m750
+ dodir ${logs} ${temp}
+
+ diropts -m755
+ dodir ${conf} ${dest}/public/uploads
+
+ dosym ${temp} ${dest}/tmp
+ dosym ${logs} ${dest}/log
+
+ # install configs
+ insinto ${conf}
+ doins -r config/*
+ dosym ${conf} ${dest}/config
+
+ echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
+
+ # remove needless dirs
+ rm -Rf config tmp log
+
+ # install the rest files
+ # using cp 'cause doins is slow
+ cp -Rl * "${D}/${dest}"/
+ 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"
+
+ einfo "Cleaning old gems ..."
+ ${RUBY} /usr/bin/bundle clean
+
+ # clean gems cache
+ rm -Rf vendor/bundle/ruby/*/cache
+ rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git
+
+ ## RC script ##
+
+ if use systemd ; then
+ ewarn "Beware: systemd support has not been tested, use at your own risk!"
+ systemd_newunit "${FILESDIR}/gitlab-8.13.0-sidekiq.service" "gitlab-sidekiq.service"
+ systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
+ systemd_dounit "${FILESDIR}/gitlab-workhorse.service"
+ systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
+ systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
+ else
+ local rcscript=gitlab-9.3.5-sidekiq.init
+ use unicorn && rcscript=gitlab-9.3.5-unicorn.init
+
+ cp "${FILESDIR}/${rcscript}" "${T}" || die
+ sed -i \
+ -e "s|@USER@|${MY_USER}|g" \
+ -e "s|@GITLAB_BASE@|${dest}|g" \
+ -e "s|@LOGS_DIR@|${logs}|g" \
+ "${T}/${rcscript}" \
+ || die "failed to filter ${rcscript}"
+
+ newinitd "${T}/${rcscript}" "${MY_NAME}"
+ fi
+
+ # fix permissions
+ fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
+}
+
+pkg_postinst() {
+ elog "If this is an update from a previous version, stop your GitLab"
+ elog "instance and issue the following command to perform all required"
+ elog "migrations:"
+ elog " emerge --config \"=${CATEGORY}/${PF}\""
+ elog "PLEASE NOTE: It's HIGHLY recommended to backup your database"
+ elog "before running the config phase. Run these commands (as root):"
+ elog
+ elog " cd /opt/gitlab"
+ elog " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production"
+ elog
+ elog "If this was a fresh install, follow these steps:"
+ elog
+ elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml."
+ elog
+ elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
+ elog " for \"production\" environment."
+ elog
+ elog "3. Then you should create a database for your GitLab instance, if you"
+ elog " haven't done so already."
+ elog
+ if use postgres; then
+ elog "If you have local PostgreSQL running, just copy&run:"
+ elog " su postgres"
+ elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
+ elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
+ elog " createdb -E UTF-8 -O gitlab gitlabhq_production"
+ elog " Note: You should change your password to something more random..."
+ elog
+ fi
+ elog "4. Finally execute the following command to initialize the environment:"
+ elog " emerge --config \"=${CATEGORY}/${PF}\""
+ elog " Note: Do not forget to start Redis server first!"
+ elog
+ elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and"
+ elog "you can't login after the upgrade, be sure to read the section about the"
+ elog "verification of the CSRF token in GitLab's trouble-shooting guide at"
+ elog "http://goo.gl/5XGRGv."
+ if use postgres; then
+ elog "Please note: As of GitLab 8.6, users of PostgreSQL need to enable the"
+ elog "`pg_trgm` extension by running the following command as a PostgreSQL"
+ elog "super user for *every* GitLab database:"
+ elog " CREATE EXTENSION IF NOT EXISTS pg_trgm;"
+ elog "For details, see the documentation at the GitLab website."
+ fi
+ if use mysql ; then
+ ewarn "You must grant the GitLab user permissions the following on the database:"
+ ewarn " mysql -u root -p -e \\"
+ ewarn " \"GRANT TRIGGER ON \`gitlab\`.* TO 'gitlab'@'localhost';\""
+ ewarn "PLEASE also read this document about needed migrations on MySQL:"
+ ewarn
+ ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md"
+ ewarn
+ ewarn "Failing to follow those instructions may make the config phase fail!"
+ fi
+}
+
+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}/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
+
+ su -l ${MY_USER} -c "git config --global repack.writeBitmaps true"
+
+ # determine whether this is an update or a fresh install. we do this by
+ # checking whether the ${DEST_DIR}/.git directory exists or not
+ #
+ if [ -d "${DEST_DIR}/.git" ]; then
+ local update=true
+ else
+ local update=false
+ fi
+
+ if use mysql ; then
+ ewarn "Please only proceed if you've read and understood the following page:"
+ ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md"
+ if [ "${update}" = 'true' ]; then
+ ewarn "Failing to follow those instructions may cause the upgrade to fail"
+ fi
+ ewarn
+ ewarn "Press any key to continue, or abort with Ctrl+C"
+ read
+ fi
+
+ ## Initialize app ##
+
+ local RAILS_ENV="production"
+ local RUBY=${RUBY:-/usr/bin/ruby}
+ local BUNDLE="${RUBY} /usr/bin/bundle"
+
+ if [ "${update}" = 'true' ]; then
+ einfo "Migrating database ..."
+ exec_rake db:migrate
+
+ # https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
+ einfo "Migrating iids ..."
+ exec_rake migrate_iids
+
+ einfo "Installing npm modules ..."
+ exec_rake yarn:install
+
+ einfo "Cleaning old precompiled assets ..."
+ exec_rake gitlab:assets:clean
+
+ einfo "Cleaning cache ..."
+ exec_rake cache:clear
+ else
+ # 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
+
+ einfo "Initializing database ..."
+ exec_rake gitlab:setup
+
+ einfo "Installing npm modules ..."
+ exec_rake yarn:install
+ fi
+
+ einfo "Precompiling assests ..."
+ exec_rake gitlab:assets:compile
+
+ if [ "${update}" = 'true' ]; then
+ ewarn
+ ewarn "This configuration script runs only common migration tasks."
+ ewarn "Please read guides on"
+ ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
+ ewarn "for any additional migration tasks specific to your previous GitLab"
+ ewarn "version."
+ fi
+ elog
+ elog "If you want to make sure that the install/upgrade was successful, start"
+ elog "Gitlab now and then run these commands (as root):"
+ elog
+ elog " cd /opt/gitlab"
+ elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production"
+ elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production"
+ elog
+ if ! use systemd ; then
+ elog "You may also run"
+ elog " /etc/init.d/gitlab check"
+ elog " for convenience."
+ 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} NODE_ENV=${RAILS_ENV}"
+
+ echo " ${command}"
+ su -l ${MY_USER} -c "
+ export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; export NODE_PATH=${DEST_DIR}/node_modules
+ cd ${DEST_DIR}
+ ${command}" \
+ || die "failed to run rake $@"
+}