diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog index a20d2c4..7dda7b0 100644 --- a/www-apps/gitlab-ce/ChangeLog +++ b/www-apps/gitlab-ce/ChangeLog @@ -1,3 +1,8 @@ +*gitlab-ce-10.0.1 (25 Sep 2017) + + 25 Sep 2017; Manuel Friedli +gitlab-ce-10.0.1.ebuild: + www-apps/gitlab-ce: Add ebuild for gitlab-10.0.1. + *gitlab-ce-10.0.0_rc3 (17 Sep 2017) 17 Sep 2017; Manuel Friedli +gitlab-ce-10.0.0_rc3.ebuild, diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index eb18956..4e6b52d 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -17,6 +17,7 @@ AUX gitlab-unicorn.service 773 SHA256 010c9e223a30400d9155b39499eb0d7efad23b66ba AUX gitlab-workhorse.service 930 SHA256 09348a52fec333b4b19828752e0484400c1efa9dfb644723fcf8e80537e294b6 SHA512 6332024fe0049287899cf482b6e4439e9dd90da14e489d08aa8e5e79cb7872efcc517d99b69fa23b011b382acb1e5926496a78f08af5d2d64daa515b869a0c6a WHIRLPOOL 3749c6719b2a35c7de29763cd616e1e9cc30a85aa1630ffc46440334459b5922503d52629556c125a6dd6574bdc5f23f1b2a7f2a85e2270a415b22246e0b6bae 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.1.tar.gz 40042674 SHA256 b3b978c0fdacb920850e04ae4f7a08ab01f9d04d7c10746020af54dedcedc2d3 SHA512 c0220d36b47dd4aa0ab5b484f7e4df0e74890c14b7b98375c4f4540d236186023a64af6d28b30280778f1bf320a80595ea6db2b8485fa9fdfdc06dba7ed363d6 WHIRLPOOL ab0d76d27eba28465e7d646803be2d110cc18dd33abb0c757dbca812bfb9eb8be28b702429657a1554a1b9b3ee94196dbc3cbacf9295c0cd5ab53ae08f493dd9 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 @@ -24,6 +25,7 @@ DIST gitlab-ce-9.3.11.tar.gz 31768655 SHA256 0eaeb3a9daf3f1ea56ad7435b2d7fe3e15e DIST gitlab-ce-9.4.6.tar.gz 32855962 SHA256 2bfe2595dc334438d27fc1ab1e94464f02577f36ff5f9c5e76f4247ec96a685d SHA512 4ccbd1988fc40ef8f12f4e2e2610724e9e799e6e2f31ca234dca2c1c0642a3f123f0c90590ba7b01deb761a1802be0e49a56b089067879193f5256c2c13f3909 WHIRLPOOL 2bc05cda6705de79264b323dc4b0f6cd1d49561637827a08de0b3f6ab35e8131f72ba05ddc2f7073c879236a248c469c831dd724482a33865bc80044c09ca917 DIST gitlab-ce-9.5.4.tar.gz 36194887 SHA256 5b6e8558e228df6f645a4b7bed6b3a51f73732e4f68818331b89c81bef055d91 SHA512 b90028217f835389db9e01f8d6466a69d5fe3b164239e306c8dbd97e49574c652fd88de15c4110ebcc2b3f93cfd89758cb8ec928bd1d16caf1dcbe3984d1f0f1 WHIRLPOOL 2999f4afab19eeac42b0f4f00db685e72e457122040ae8c0e91f48dfb389f1cdc03157278bb7ad29fe2e9b88e179b22e03d7d6328e10af534244167c716981d1 EBUILD gitlab-ce-10.0.0_rc3.ebuild 13515 SHA256 4d9c3702ecca4d10a30c7be72d76142de55f5cf028b2372676addb06fdb6853e SHA512 501c9a66b17aedd1c39479048f9360018643c356d245e37b422bb39514b8d88058dad998151edfe9ec2f9980b8f7d81acb3d9311c12a1585f9310f46f5b6e240 WHIRLPOOL 1a802e628fd521f2994365cfc046e1f93ad725e65a24c524e89f98948000bc857bfb83cd72d357744e7abe928bd7b287531663df28e183080ede6f8f9faa8826 +EBUILD gitlab-ce-10.0.1.ebuild 13533 SHA256 7d5948cf820ea47895e6f7552693cbe237998853773812ba3fbe6e1279f2ed11 SHA512 5326f4c5234cd7f99e3321e0cf4d71ec11e0b6dd8377587cda3e36b8c0704a354b9ba5918f92c80c67f72b934ec437505b029695bd75465f09461347dcff7563 WHIRLPOOL 664984a599db73b6bd90693de43bc59535533365eab4f5b56bec61c0787da6abcd657b9ced2448bb25130c1bac02f8523d581fa2733b175e9e44ad136b754f9f EBUILD gitlab-ce-9.0.13.ebuild 13146 SHA256 64748b6e753c67ac3c46094a5bd021b13bca05d5dbf5955de6e0796ab8bb43fc SHA512 ba2ad250ef3c35d333d22ae25dd62c05fc53591438bf2f77a6d0ccc8993e53695d8458153bb6e80dcde4b092bc7523909b2d9e3949e640862a3455deaf647b1f WHIRLPOOL 78863ffbb92f592405227209a4980c05cf40e34be35a1198bdd3cba938fa34709ca0af850b4b4735f7aeb54dd3e35b1825233dd32afa2a964524bf7cc2035839 EBUILD gitlab-ce-9.1.10.ebuild 13302 SHA256 3fc7a2a4e386e49362a4c9abec30799e0a794b9e1636b18b57c988323acc86bc SHA512 de31e302e94df6dbf263aaf4afce12d3260dac06b22b3f48965e4e7687b3be8e831d06ce2d05581acf9c9305dc1b40842e5be0fed2dc7f7948e9836361f82e87 WHIRLPOOL a6599e4d5c77ae0c6f0a8ba71797a20e73747f1cc4d5a43d2b3939efb7dfd59b8c409b17c32ffc39e6c8cee976da77840309c6be4f51f84a3034812c6b481e99 EBUILD gitlab-ce-9.2.10.ebuild 13047 SHA256 19f794001a59da5c2de341c2f4fa73f69cb11af3139ad1c908f7fedeffe7c5f9 SHA512 df7fe4662cf1c85758d8634b13b14211242115113c37f78bb7ad1196a40243a0420aca3d3548743043a9de8410db1b80192f75c492347928ae0a574ba2abc924 WHIRLPOOL 5f38b97cba750b57c3f9300c8b8a19fa20eb6e82d35e79431ec3f1b91dd16a578776d125962d94ad2d9d34e2a6142fcfe332d6322b60afc975e761bca85591cc @@ -31,5 +33,5 @@ EBUILD gitlab-ce-9.3.11.ebuild 13706 SHA256 cbaf37ceb4aa22bca196023e3282f66f858d EBUILD gitlab-ce-9.4.6.ebuild 13533 SHA256 2cf84d7c1638e0083a34a18e259a4f03e3c56007cdcd0f1184e7cfa186eed47b SHA512 6f7346319677838db6e539622c1123781e9b65cad2bfc964801fc9235f6738a58e04bbd3a3b7fb088704e508b5304802bcd1f940ed535b683d78a7ffbc740701 WHIRLPOOL 829021ef040afef15b8c7d961e337817b040d13e7ab3672f8cadeabbf55e795dfa19d5ff90b2a010b5f9bf492f4491fd2dcb6c3dead4920290b1e30448270e70 EBUILD gitlab-ce-9.5.4.ebuild 13533 SHA256 e44291160456e0e578a58e5d094bdbe338952d6e7b7f2b42a6280d2382f2b7b2 SHA512 708c4ae80b5e8a08406a32d08f0a1666e002818bdc423355c8371ec15983e601557d54be5aa7d49c3fe7ec6e39d3622299de3fb9134e512cce36840f227713f8 WHIRLPOOL c5eca7f0cb92b268c3cdd396d1f6bc4ad905d95558bf669755fe1517ccbde0499b9fa97eab686c61f743ce4fed440d46c0140bce9fda4381941517caa9177488 EBUILD gitlab-ce-9999.ebuild 13475 SHA256 c6cd66ca400c0560780faf0e2aa1b1fc13a583408ccf55f39af840d240b3e2df SHA512 a92b5382f091c3ce6372c3205a6469e3dcb877a5dcebf2e367c012b29ea90e3b63e84d84c666bcc32d6a5f8ce35c40e6df1b7bf04d0f488413c06d9af2c5f466 WHIRLPOOL bc50cf6e5ad695c62ae69f5122cf2de860cd05b63d538bc390f0448395aa64140d01cf19ab7563cb7c7a3e1d76471297737700a37c7b31ac1333bff7c72192e2 -MISC ChangeLog 24139 SHA256 167f167e65867a261f28eb2fae514ee02c6bd1176ddf69459262a78443b9375f SHA512 3f12832a42d46bf0f6d4ecd8c24b228032c99b3614eab070d96877526d99b6bf15ba0b235c8c53fe636eec3289607ff2965ad16835f48da522dd59abb7190ee3 WHIRLPOOL 4bf5c31f89e89edce8790fbcfa83a8a2923f3809c0d0e3f5ab5b7b364199e5a4870e34e224ca765bae13b3d5f36e6c992ceefae0a84c283e3b270ac2abd398d6 +MISC ChangeLog 24303 SHA256 885f880841adc7e1fc83eb47bd559ec5b36ae6a9f695e68dff71b76c671949d6 SHA512 d86e37be1fc61af114d8b3d09e97fc03c5c8113743713949c26dbbab098d88e7310b60ea20fb6d54ba2d31d43bd3bd8c7da4d4604ead0ff8fde02cb9ade63013 WHIRLPOOL 3396f07afa2af59a84e1fae55fcbb9b670a0273836ef00f11f08cad3da783e5d843068506c019d38fe2d97a8aea2d852a90b9e840036d2ba5697711b7ed0c101 MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6 diff --git a/www-apps/gitlab-ce/gitlab-ce-10.0.1.ebuild b/www-apps/gitlab-ce/gitlab-ce-10.0.1.ebuild new file mode 100644 index 0000000..9e6cce9 --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-10.0.1.ebuild @@ -0,0 +1,430 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +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="2417795bf3d3b0893df9c53e145a3b0b9838f693" + +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.1:* ) + 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 $@" +}