Merge branch '30-gitlab-8-10-2' into 'master'

Resolve "GitLab 8.10.2"

Closes #30

See merge request !93
This commit is contained in:
Manuel Friedli 2016-07-27 15:34:54 +02:00
commit c646608c1c
6 changed files with 528 additions and 2 deletions

View file

@ -1,3 +1,9 @@
*gitlab-shell-3.2.1 (27 Jul 2016)
27 Jul 2016; Manuel Friedli <manuel@fritteli.ch> +gitlab-shell-3.2.1.ebuild:
dev-vcs/gitlab-shell: Added ebuild for version 3.2.1 which is a dependency of
gitlab-ce-8.10.2
26 Jul 2016; Manuel Friedli <manuel@fritteli.ch> -gitlab-shell-2.7.2.ebuild:
dev-vcs/gitlab-shell: removed ebuild for gitlab-shell-2.7.2, as all available
versions of gitlab-ce require >=gitlab-shell-3*

View file

@ -2,7 +2,9 @@ AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659
AUX gitlab-shell-3.2.0-config-paths.patch 1826 SHA256 c83db7c37dcac577ce499eab4bb0168253f49d303ba1991fdec90d13cc3fe37a SHA512 7524b6b8cd7cd141a56c468efa303b1d21576ac9e03cb866cbf9dcac34e1b8d4f356333737050e2e5dfeb0f0ad904b3f548c40e1209c1f35054ed2027b1d8271 WHIRLPOOL fdbd2dfe43ff4a2af97227fbf8c4589ca3734ebf0320b7e9c5e8ea39882c49d45815a0ee3c765a141affacbe48f4063987b9664a918e0e216b49ca46a475cc5f
DIST gitlab-shell-3.0.0.tar.gz 68088 SHA256 3b00daa0e003b73a34f20ed06b4c0298b33099600de7832bec25bfbce525d779 SHA512 97874a4a76240b73e3dac93510910fde847d0ccb8906011412091769345a2efef82bd187609ea2596b6a7b1838fa144eb62f9e246f4aea396df96316f18121e9 WHIRLPOOL 378b9f9a879e4c011fb0714387aa0f24616e6cb8c19084431923cc24853212e0319dffe5081a0b556dca41712e5015538a7038548bcd737cd9116fecbb2421c9
DIST gitlab-shell-3.2.0.tar.gz 68796 SHA256 a279d78f1439b13f9f96c6cc1507175040732aab25954b1e6a41445b336d1460 SHA512 836b94fdff10daafa54ad672752eb8fcf1acc4f238a7c47a0795669ffcbfd0c892abd49c4102cb07bcc0350867a7bc53acecffe5b0eb46849f1fae0b38200c25 WHIRLPOOL cb536713dd2352d94e657313c717f3c13f50c1056e30391f31a6bfdc82b559c8738d722b95aa194d1c4182923198cf4defda7c1c31e00fa360b132a2c610398c
DIST gitlab-shell-3.2.1.tar.gz 68788 SHA256 ad21f8676901b9d90a1c8016b5fe2ad73f9a7966ab378ce244b12fc0373e9f46 SHA512 2280b5ea529d1efff365b1f72ded2af71c7cd19c88c1d7638f730044c5a804a0adb8670685b2016b26e894755a0b70f365d234c95e4ca3bf09913d7b6bebca76 WHIRLPOOL e21d77c00a02105babe4cf84c7ff9223131eef5e7e1db80d06b40bae87d225b579f4fbdca4ac2809be436f96b25753f73b354e6d03ad1b22ad57bfac7c720ae9
EBUILD gitlab-shell-3.0.0.ebuild 3516 SHA256 5ae386bd0f8960b1d068530a5b8502651c76cb43195502f76551a4249a510efc SHA512 ed9d009a894ee3ae2f1d140aec64f8c9ad4013178419f87f96e57f5cda4dbd7b099436568cf3d718d25753e405d859bb7bc8aea2c4683a14b024b942503eaa13 WHIRLPOOL b325873e31a1b5b8afaa4ba3678ae8435c20678b5ad720482283f48ba217f48cfe50c533b13c7e9bfb4e32719dc8155512d743b7f7db3dae6262e07612519331
EBUILD gitlab-shell-3.2.0.ebuild 3509 SHA256 55b1f12be58f972793adc90dc952e7f09d7a2cee3591d9ba40f42a503f22b9cb SHA512 fe5d78bf082e9bd53acf4326764d3a99c509c3a8bde7af7d6edd294e35c1c4cca808a38d5a91f090fcf20922b91f2a2efb33db410e3041b5a998164b35e34d78 WHIRLPOOL 2777285c7ac88b68d99fb60b0dea2725bdcade41bca08eeb30b666b9ed6c0867db6e54438da884ec558455c8e01801cb622b584073c6a6c14bb22828eaaf19d8
MISC ChangeLog 463 SHA256 cd01d6ba8fcbab1b203eeb8ef14f4ee765b84986e912792143fcf499fb8abfcf SHA512 bf2790c9155c3237787ef12f4ceab474b218504e8a44575838507344f3e318f8f956beefd5da0bafdd6fe87e26a3f8bc2558be7cdd51783ed615152926bb89f7 WHIRLPOOL 0f5a4302d1a7ba0bce33b9b510d74ac0ee277651f1c14b2caa0944292f5735fdb2379e45cee495f7825658e5cd1052679e716d61e79836219f65bac907072230
EBUILD gitlab-shell-3.2.1.ebuild 3653 SHA256 e8043271a1a42664862a4284a185ee11c7fc6c133a1b3c7dfb44b748d705cc3d SHA512 0232d94c21d675b1e8762a2de1d95a36bf41afc97435d84e54dd93bbf190cacbbfd426e6e6253c5f2f894c5d3ff7c878c261df7714d477c4332beeb433fea223 WHIRLPOOL 02fa858649c50c040fc16930c5f7f35dcb9d9df2d693898dd930cc945d0d5f264b52009cde063fafbaae78aecfab6dcf6d6f03fb9e4c2f9444300e8fd514175a
MISC ChangeLog 678 SHA256 9f9189571066a0bf35ca4647472790074c914ccbafc88620acc206cd81ca8bf7 SHA512 193ca08208434a87b26ccaac1d98d562e79346d4261159d2bdabb448eea713b5252c1278ff5b5bd2431cd555d7f529967aa8d8f4b1786afb33696a549ebaad56 WHIRLPOOL 28174489e18ab1f0a8f05e942700c7716aa1389e6312264f88ef60085fd56dda0aa899433b1a872602d6101c4e043aed67f1bdb072500806ced12485498e0737
MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431

View file

@ -0,0 +1,130 @@
# Copyright 1999-2016 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
MY_PV="v${PV/_/-}"
MY_GIT_COMMIT="87b388232505b1715a1d7448dc393a383cd7a53f"
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-shell"
SRC_URI="https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz"
RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~arm ~arm64"
IUSE=""
DEPEND=""
RDEPEND="
>=dev-vcs/git-2.7.4
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-3.2.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,3 +1,8 @@
*gitlab-ce-8.10.2 (27 Jul 2016)
27 Jul 2016; Manuel Friedli <manuel@fritteli.ch> +gitlab-ce-8.10.2.ebuild:
www-apps/gitlab-ce: added ebuild for version 8.10.2 which fixes several bugs
27 Jul 2016; Manuel Friedli <manuel@fritteli.ch> gitlab-ce-8.10.1.ebuild:
www-apps/gitlab-ce: Fixed config phase for gitlab-ce-8.10.1

View file

@ -9,10 +9,12 @@ AUX gitlab-workhorse.service 930 SHA256 09348a52fec333b4b19828752e0484400c1efa9d
AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c101f43ca263 SHA512 909c49fee6d050c1e94b2559ff2a9d54c5c346492be0e2920b50d56d69eaddbed67e3ac12e012d2a9601b5596640ebf33c8dc68fc588a03ca370d963294be37f WHIRLPOOL fa436e8d7d2643d450259d26b6e7b24dae69df47ed22e5ef2a567f37aa785fbf3b0eb1129ae7c8bf8986c29559fc3b744a34064375e5245dce2b10053cd715d9
DIST gitlab-ce-8.10.0_rc9.tar.gz 20704170 SHA256 6f072d72b21d11c1cf8355213afe69642841164b4433620700fdede72a2412fa SHA512 9b99dbedcab82a0226d5dc3418e57da8c29c5d78ba419ef1ba446409e2b60bdb9158cdc8a742ccbab99ca3e5b2da0161a3d1a3ada6029a9de51bb5e3ab633995 WHIRLPOOL 06a3b67d1e5a22f7053f60970b283941f076e14b996188e9c6515760592edbddf4f12717c206ddeb482e7a9db702472b10deacbf9a6d71e8937f771a3cb31268
DIST gitlab-ce-8.10.1.tar.gz 21035550 SHA256 8fe9c994b87f4ef819b14c8149b07a594a8f624285e6f80f888a63978b3c9ef8 SHA512 00d762c65d24cdebe05b3a31e9577500f437c0c64711c121b3967a9ebf3f711dc94cf08e8cc3fe1a3919236acce019e149ce1c64dd8ad0f43d9f298b9d76a167 WHIRLPOOL c3bfe435b8018c0488e760d115c6a290a13f8eaebd900201a807a386a62a0aeace04e4e7daa24f500347676b5aab760efbcbb1daf252aaefd6a73033b382a4fb
DIST gitlab-ce-8.10.2.tar.gz 21038115 SHA256 71cba117f895beb96278b81ec09d60d46189f71024cb2e1db14628206d64c26e SHA512 d9fccb2530357835e647ecbbd04e825154cb9b780c4d67210b3cd5598418e377af90046c10a1b192e8b4ea99b77ad0b6ac734e237360c4c179338003ce24463f WHIRLPOOL bfe3eb27576a31d5abcc1bb60824ce06feb78c1c15b0a94a514707ba536db0d37be00db0ebc3a6c83b0533b0bfb80d01e9bcd851545703ea4ac398a12e6fc866
DIST gitlab-ce-8.9.6.tar.gz 21555571 SHA256 1b357ed1157a2a20b647004f588b67d72416df805a385fa7b605905bafb26f55 SHA512 d4693cdc80fff44e2f2d2e640163337b153ee08fbd12cefd055c8a595e1487010f7c0db39a11056577d331d3a76cc7da9936139199aad324d9c324395f684f9a WHIRLPOOL 00474d385cd9b574bbef0847f80613253f4543c54b356ab654b0ca3e7233e056efbe995a9de3e418c68d482d4a2b9b0cf676941c7013755bd795bfe83c9766aa
EBUILD gitlab-ce-8.10.0_rc9.ebuild 12391 SHA256 a73a04d2d82338674f601b9cbce505e7aa591723937b9110d759d2f4c785adbc SHA512 19acc92cf9a59c1498ae07fc0f1635d35aa6f37b61e86c5eeddae68ec96dc8120f5a1bf66aa44c0f41ea48de0ab2dff91ce0d1eb19b47d8aab66c5118ccb23e4 WHIRLPOOL 9678d325b6690602af31a085c59de62ef20dc7919479c8ff297af9cf04f149b32936e1a2019b4d6f2d2b035af870e81a5cd0d510fa67c42b20bbb07acb46562d
EBUILD gitlab-ce-8.10.1.ebuild 11676 SHA256 18467061975ce0212ddb08cb12b4d2d9f2da6f7999e9d42dd249d96891326318 SHA512 ee1538902ef35fe4f771211eacd0c7fb81aaa81c4b18049111eead6a5ada19318763165245e3e6d05fd41490e0ee4d30ab6fcc946b35e31e1a3f41b200cc46c9 WHIRLPOOL cfad8b037071a70bedf8095cd29cd27d2c703dc9470f4ee943860716e01e7347e78cd9a6612c44fd749a8cb06d6979376493606ab941266ce732e285dc7e3edc
EBUILD gitlab-ce-8.10.2.ebuild 11677 SHA256 d131e1f22e6ab5d5dfbeca80128ce0838631c82f71cb7f11dbf58d3aec9c2ed6 SHA512 e2530f1f2f2b31ebd4a6adcfacb512d4579baaf69aa2adfb7fd8fd9408966d5454cebdf4441ebc016ff89fa2dbe61ec19239f6e39844e0d3b0a44ec0f73d3cf4 WHIRLPOOL 30d1aa4d499013205953c70210edf6962a4da78ce3c1d11c98d2b048eb57e2d45991a4a2dda34c5c5269dc077ae67cbee76e4859b1c0897b6377673a6f451fb4
EBUILD gitlab-ce-8.9.6.ebuild 12341 SHA256 a46bb7c78639ee411a8c0994847f4f90a89133f2d85e7eb71f76f9f6756e5c25 SHA512 19712bb3ece7873e9dc2a5d471512a553108b95338bd370dab8dfac6695da34ee713d4d106c62de1472eab7e3e953471ad6274f7d646900e7ef2c7521460211b WHIRLPOOL 1cdff895e32079e2bd85863d46a3c6c0f39590e454f7c77d058f7403341ab39adf477005a9c6c417ec7ca527bffedf0ec1ec3b3f64cb242c3b2d3404c41b6e8f
EBUILD gitlab-ce-9999.ebuild 12344 SHA256 cd17ceba505495a7633f8f106d2adc1ee81b74d2b09f8a83cccb0010600f8005 SHA512 c961866f01e626855cddc928c14c8f4a8aa4285dd04e87d1bc310b02c7617dce73c93e5b670650a86c075c4adcdd6b4c3489feb4c204d0474a8e993f3e000440 WHIRLPOOL 11159c64d381f201fa33941bbe7f549ca368a16ebc7e1087b286a8a375e687073e1c586e02411e4a2b50ca74835bf1e81ca069eedefaee483ac3deb20f51fa05
MISC ChangeLog 3605 SHA256 f3edf3958fb420b68dd776852e03a23aa20b3a16d0271b0b8813c4fbf6fdfd08 SHA512 e430b335f11a3baf0e1e5f3133bda54338c0a0fc26041829b4eba69ff910db40b616224a215436c9370ef6ad9a6c9470a9859b718097bfa1d3e7d342f53d3f74 WHIRLPOOL 246b3f70d27d68023f97d0983841b1172966ac3635b4e23747c250853ab1dcbb2215cb9d1242fe303e58ee4e2b8b8dadb6f2ccc640838f3e130ac42ed274aee3
MISC ChangeLog 3796 SHA256 065a0577cce93830f509b6b204e36507e65ada4048e07d5a07fb3601c25ca027 SHA512 e5e4463075d3f4956f7953aac81b18001bf0285987f0dff2cbe15ba546578cfbb384365f14533b8c658ad70280d84e580d3e75e8dcda2cd98d3020170aa5f4d8 WHIRLPOOL 3538b37f3db2a6f459e0d1f65cddfc0f6050a3b762cb31ea5d75a443b444886a55e0648cb4efe4a846b428a4b6f514f202b3b4ea8aed2975513d531a9e65b29d
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View file

@ -0,0 +1,381 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
# Maintainer notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
#
USE_RUBY="ruby21"
inherit eutils ruby-ng user systemd
MY_PV="v${PV/_/-}"
MY_GIT_COMMIT="97a7ad76ccfb08361b1a18a71b71bfec3f21eb68"
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 ~arm ~arm64"
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"
COMMON_DEPEND="
${GEMS_DEPEND}
~dev-vcs/gitlab-shell-3.2.1
>=dev-vcs/git-2.7.4
~dev-vcs/gitlab-workhorse-0.7.8
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )"
DEPEND="
${CDEPEND}
${COMMON_DEPEND}"
RDEPEND="
${COMMON_DEPEND}
>=dev-db/redis-2.8
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
# fix-redis-config-path:
# Point to the absolute location of redis_config.rb
#
RUBY_PATCHES=(
"${PN}-8.7.5-fix-sendmail-config.patch"
"${PN}-8.9.1-fix-redis-config-path.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/${MY_PV}/bin/background_jobs
SIDEKIQ_QUEUES="post_receive,mailers,archive_repo,system_hook,project_web_hook,gitlab_shell,incoming_email,runner,common,default"
all_ruby_prepare() {
# fix paths
local satellites_path="${TEMP_DIR}/repo_satellites"
local repos_path=/var/lib/git/repositories
local shell_path=/usr/share/gitlab-shell
sed -i -E \
-e "/satellites:$/,/\w:$/ s|(\s*path:\s).*|\1${satellites_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*path:\s).*|\1${shell_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${shell_path}/hooks/|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
local run_path=/run/${MY_NAME}
sed -i -E \
-e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \
-e "s|/home/git/gitlab/log|${LOGS_DIR}|" \
-e "s|/home/git/gitlab|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \
lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
# modify default database settings for PostgreSQL
sed -i -E \
-e 's|(username:).*|\1 gitlab|' \
-e 's|(password:).*|\1 gitlab|' \
-e 's|(socket:).*|\1 /run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# rename config files
mv config/gitlab.yml.example config/gitlab.yml
mv config/unicorn.rb.example config/unicorn.rb
local dbconf=config/database.yml
if use postgres && ! use mysql; then
mv ${dbconf}.postgresql ${dbconf}
rm ${dbconf}.mysql
elif use mysql && ! use postgres; then
mv ${dbconf}.mysql ${dbconf}
rm ${dbconf}.postgresql
fi
# remove useless files
rm -r lib/support/{deploy,init.d}
use unicorn || rm config/unicorn.rb
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${conf} ${dest}/public/uploads
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
# install configs
insinto ${conf}
doins -r config/*
dosym ${conf} ${dest}/config
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# remove needless dirs
rm -Rf config tmp log
# install the rest files
# using cp 'cause doins is slow
cp -Rl * "${D}/${dest}"/
# install logrotate config
dodir /etc/logrotate.d
cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
${logs}/*.log {
missingok
delaycompress
compress
copytruncate
}
EOF
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test aws"
local flag; for flag in mysql postgres unicorn kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
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
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script ##
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dounit "${FILESDIR}/gitlab-workhorse.service"
systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq.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 "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
}
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
if [ ! -d "${DEST_DIR}/.git" ]; then
# create dummy git repo as workaround for
# https://github.com/bundler/bundler/issues/2039
einfo "Initializing dummy git repository to avoid false errors from bundler"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
git init
git add README.md
git commit -m 'Dummy repository'" >/dev/null
fi
## Initialize app ##
local RAILS_ENV="production"
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
local dbname="$(ryaml ${CONF_DIR}/database.yml production database)"
if [ -f "${DEST_DIR}/.secret" ]; then
local update=true
einfo "Migrating database ..."
exec_rake db:migrate
# https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
einfo "Migrating iids ..."
exec_rake migrate_iids
einfo "Cleaning old precompiled assets ..."
exec_rake assets:clean
einfo "Cleaning cache ..."
exec_rake cache:clear
else
local update=false
einfo "Initializing database ..."
exec_rake gitlab:setup
fi
einfo "Precompiling assests ..."
exec_rake assets:precompile
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
ewarn "for any additional migration tasks specific to your previous GitLab"
ewarn "version."
fi
elog
elog "If you want to make sure that the install/upgrade was successful, start"
elog "Gitlab now and then run these commands (as root):"
elog
elog " cd /opt/gitlab"
elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production"
elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production"
elog
}
ryaml() {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
}
exec_rake() {
local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}"
echo " ${command}"
su -l ${MY_USER} -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${command}" \
|| die "failed to run rake $@"
}