diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog index 0cf6f90..2048bf1 100644 --- a/www-apps/gitlab-ce/ChangeLog +++ b/www-apps/gitlab-ce/ChangeLog @@ -1,3 +1,8 @@ +*gitlab-ce-10.3.7 (17 Feb 2018) + + 17 Feb 2018; Manuel Friedli +gitlab-ce-10.3.7.ebuild: + www-apps/gitlab-ce: Add ebuild for version 10.3.7. + *gitlab-ce-10.2.8 (16 Feb 2018) 16 Feb 2018; Manuel Friedli diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index d9dfbed..63b7338 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -23,6 +23,7 @@ DIST gitlab-ce-10.0.4.tar.gz 40040781 SHA256 eef116f75b64b835402a87e3737a3721143 DIST gitlab-ce-10.0.7.tar.gz 40049508 SHA256 890eed75ee502cd6c612756815ac8c854eeee3d00ab3d7bf00ee580db8141264 SHA512 770b747a35988b663f1ffe3b05b317839cc66e9c76e64e51673d066787a42acbb688b739fe9fe3a6dc787f2e44d6fbd99388ea0a20f103bedc631ed0054401f4 WHIRLPOOL 0de51582532936620b4140013f87652e7581956fd6e662d83e53ed024699ff70c2c52fbb863f8052c5df36bd5b63cff0cc6fd9372c97ea2265aa1242a2d6afdc DIST gitlab-ce-10.1.7.tar.gz 41749804 SHA256 d04dca23289adad80ba239d993aa67dcd14f50a1b935d91136247124e8b5f1f9 SHA512 3ebf8ab1e57ef82caeef940264a6f755e091717879d7ac36ce786155440ebd1264fa3320012cea4d1e6c319926a818cfcb19740fb765f069d5d18841ac1c0a21 WHIRLPOOL c91234ffd82c5e7380afbb49e3a6cd848d7744dc299dfe039fa02485e4d831fc24247e7613d5dd20d4e9752015f59c0638ea95f4eaa96afe50e8748eca0a7ad5 DIST gitlab-ce-10.2.8.tar.gz 42393303 SHA256 4314e87513684dc08f67c3d4be5f5f26502ae9963793a9abd8ba8cb4cc0b0a48 SHA512 cdd30f8500d1c902c42fd60b155143dc76ebc9990cc9c515ab2229f678feedebf6e1c7bd9c2c59b374cea2259eb7ad1384f50184787f45381afdaf3eb8e82803 WHIRLPOOL d5bb64d4f4254acd6a675dda653490ed34560f331d47ff9ad294dd042a515d8d3b14345a7950754f2d7c7ad676fb4328a76bf1885c91bec540c26b4edaaa5b14 +DIST gitlab-ce-10.3.7.tar.gz 42852145 SHA256 383485d773ef506c7d8b0d2a6b4f59ba53bd638639c6ebec0282808b0f4e3701 SHA512 f4488e5a02067ebfbc9dcc0d1e0b06eeb047ea793c5e5c286e54c2fcee56d88f0a4b4dcbae66319a63960e7737ff134ab615764524fb7bb5bf017b0d035a55e0 WHIRLPOOL 051981082d07726abc0c98b2070e26aa2770bb2ce38e37d4711c69745cf704f7c3ecec577bee840f331bae456c5d6c0e43a4e7527bb845541c43ec4b40874d28 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 @@ -34,6 +35,7 @@ EBUILD gitlab-ce-10.0.4.ebuild 13526 SHA256 0fa438ddcca42b2ec6090bdb587635c8e82c EBUILD gitlab-ce-10.0.7.ebuild 13568 SHA256 c164db3f0af93824bb97992b20b0bc5415bbc701c80469593038c773c453b976 SHA512 ba702162d9fad73d46953649c9faf913069f2059fbd253d8019224c1645c56cb6c0ec69893be6238e42ee3d54bbcd9a22343eece1975e084d7ff73d4efbb79dd WHIRLPOOL 37f6ebb5c9e4a60df200272235dca55819b81936cb8f74a43fff7a79a3330666587d082e18cdca20ecd610eea0b18c86eadf183353f83e72606d1ccffb756949 EBUILD gitlab-ce-10.1.7.ebuild 13679 SHA256 9c1bec7e86d46422f87baecaece80197c506b758eab28fd85fc214512ff67e3c SHA512 6958f3f67b7d8729519175337b5e411b9d32fa3e7348105870d5f35c938e905cc60e7af23802b1b5835610c72e9a76ca50c229f5d862403ffd5065e82ee39d25 WHIRLPOOL 6caf644203291c7903f7c67a93e3f11a3f8d632e01384390742bc8b1fc4068e494f750c44817f0143a0f6eeaadbb4a7243c4194397fded59956363b49bd32ae4 EBUILD gitlab-ce-10.2.8.ebuild 13681 SHA256 0e02e1a51f335872facce2751aa23d8ff5b9cd8aa7359fed1cd0f5a3ed5bd1e7 SHA512 805d6a717b0dcdc6551f549722abb8322a51d6cee1eb807dabac1fe4b98ffd32fcf3667d1de7f845a08e9dfb72afa257c51c6382cbc48f5f23fe15b027724dde WHIRLPOOL 1c48b8ea54d65d1d2ea001c6af45c0a76f0587d815353675ce36245c721f4b2d9c5b48c608fe632743863f5db859c5ee0c96b95fe6b429fcdd7053d4e8fb86e8 +EBUILD gitlab-ce-10.3.7.ebuild 14085 SHA256 cbff8442516b815e386974191d48464202b3b4f93e5d4688a71de08fadaeb89c SHA512 311e256f675c6cbb8e374448858e0adcfecd6a5432c4384a5d9c302a3c82dcab0aab0eb9a79d90f8f770dba0d1d984f0b7e3d53ce1e3b2c4c915aaa2facdbdd7 WHIRLPOOL 29674dc1a54311518047df70ecd21971b642bc7b8511d8c6ba3f754b7beae3de10c289704dcd214c7c5cf76f60772117c2649daac4d691b13387d758d2fb3f36 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 @@ -41,5 +43,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.10.ebuild 13526 SHA256 6e7c361f31989dd608eff4c8dd01b7301b142b4d38acdf38e61e2eecb2d4b285 SHA512 e33e56c8e49bd2ef03dd9af508b186f7908b8502960cbdb95ca9166631b84d5357c4965c0919e432ee5de9b9eeb33f68773ac405c24430568f9abb0d8e7354a6 WHIRLPOOL 3e866d785e8018096a92a223a2f6cedf4398cc07726a183d805005b3cd718fed2296edd63f5bc9d2b8849fe2298e9a61bf998a2241de2cd5ab4527f8ddaed325 EBUILD gitlab-ce-9999.ebuild 13468 SHA256 ab13060918b09a67f3f0c653a3836c1077933c606e5ea4e3416fde204aa530af SHA512 f14bc61622929dc57460fd7e4b3d965437fdc44706c52608a6b278021960bb70b62f81a6dd38beeb134c0f40ef29a81e07ea5a49c9a7a8e7ab63f55529231cb8 WHIRLPOOL 204d2f97890f2868b9f890fcc9b03d3c47c6916e52af341cf946e197acd8c2287409a5a1e525183a62fec9588eaa21b9d3ad30bba3b12267aa4c9e1163ca7fb0 -MISC ChangeLog 25899 SHA256 f59dc17469898c39b749dd8ca802123585790c2467c1f3a66fbc8129fd035035 SHA512 fc43a3374e811f74b88102db461cb1b31a3ff830c7c770604f346e372867595ad8713ee3afb3c60c3df77a7e1be7504dc1925e48111176e3573155f197dc6e93 WHIRLPOOL f1394d10f61611b5c539086890910ef03651bdab21dead81b60e90b0a30257128ca9f8443e5c8a3929805dfe47ee53984d46c852431d444258aca776b4fd6830 +MISC ChangeLog 26064 SHA256 8820edb5b622f84bedd3dc859312642a9efc672eda16f3d6517424a0af71e118 SHA512 269983d651bf8c7e1e67d9a32d29da88b7f01754b58380e18dabded57374a49b4be4651659026373d14b51d8d3d3ea2441aeab5e274dc236eb0a02d584e0e72f WHIRLPOOL 22267d14138614165b9c5cb4407cb46ed7be44ffaa2f5346b6dbffe9b684fe7b733191d344771d89c2fd059ec58ecfe9724d616bdad366a6b616fde929ae0580 MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6 diff --git a/www-apps/gitlab-ce/gitlab-ce-10.3.7.ebuild b/www-apps/gitlab-ce/gitlab-ce-10.3.7.ebuild new file mode 100644 index 0000000..ba4141f --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-10.3.7.ebuild @@ -0,0 +1,442 @@ +# 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="586669a02ee7a18635d8e590117ac9e2bd9b62f4" + +GITLAB_GITALY_VERSION="0.59.2" +GITLAB_PAGES_VERSION="0.6.0" +GITLAB_SHELL_VERSION="5.10.2" +GITLAB_WORKHORSE_VERSION="3.3.1" + +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-${GITLAB_GITALY_VERSION}" +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.15.4" + +# +# 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}-10.2.8-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 + + ewarn "Now is a good time to create a backup of your Gitlab installation, just in case." + ewarn "To do so, abort this configuration with Ctrl+C and type the following commands:" + ewarn " cd /opt/gitlab" + ewarn " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production" + ewarn "Then, re-run the configuration step. If you want to skip the backup, press any key now." + read + + ## 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 + + einfo "Compiling GetText PO files ..." + exec_rake gettext:compile + + # 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 "Compiling GetText PO files ..." + exec_rake gettext:pack + exec_rake gettext:po_to_json + + 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 $@" +}