diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog index 0c0a764..d456df3 100644 --- a/www-apps/gitlab-ce/ChangeLog +++ b/www-apps/gitlab-ce/ChangeLog @@ -1,3 +1,8 @@ +*gitlab-ce-9.5.3 (05 Sep 2017) + + 05 Sep 2017; Manuel Friedli +gitlab-ce-9.5.3.ebuild: + www-apps/gitlab-ce: Add ebuild for version 9.5.3. + *gitlab-ce-9.0.13 (17 Aug 2017) *gitlab-ce-9.1.10 (17 Aug 2017) *gitlab-ce-9.2.10 (17 Aug 2017) diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index a22b51c..9d015d2 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -22,12 +22,14 @@ DIST gitlab-ce-9.2.10.tar.gz 30988788 SHA256 a30e9d08d08433713df958d447a76cf2ed1 DIST gitlab-ce-9.3.10.tar.gz 31765280 SHA256 bda195e39e38428af95c0806bbe28b2667f346a346fe1498b772df9465809163 SHA512 2d248376daa5b10d9232022f78209a6be054290f2470c70df4ce8332428ba0f72461fe7c62ad35460056f2c2dabac73d278f0f65f50a09cf6f72d8d1178a8d26 WHIRLPOOL 87c8ba0086c9da2d3f67d41e3ac36a15b1bcb13df8b2a408eef87797828a0a6fa642b9eac4ba220b178a21687b752227f4a1d61bf204a9f4ac0ead89d2586d0e DIST gitlab-ce-9.4.0_rc6.tar.gz 32810524 SHA256 4cd8ae890bbe2b90047078c6d61fd29c8c62e8aa0059d97ca14db81b68ea64f2 SHA512 b8aeaa3f017b47c3455885c57fc21da8fc393ce6258de6813f0c7104f7dc725ffd3800c22d480ed19aa553c7d1040a4006dbd923cb6a1f3cdd685b17ee21afc0 WHIRLPOOL dd583d05f6937612e9a34980c558030bed266f2a0f50a2d9977c23a4cb8fcbfcfc71a3157c846250a02091688333c5b76ccdeec2a9f3e5a23af715caa7d58f05 DIST gitlab-ce-9.4.5.tar.gz 32848913 SHA256 fe3d686d017de2af5079327af360addf67410b41ab26f2aa2cecce982649807c SHA512 167291086d96445fb9a8fe3b0868ec5884fbfa8fe77f63b048d4b2b79aeaa5fca2279ed9e9374dc0d3f78ae5aabad1d8788aa7e58b50c16e9155c46d061f619d WHIRLPOOL 390fd8f883375d7f47d9870904fe46521f457c5e517c8299875d2bf0a25aae33ac7bec68984c17f6996af7638baf35c5f62a090f57ca16c26f256d4e92b339fd +DIST gitlab-ce-9.5.3.tar.gz 36190930 SHA256 c04f7e0ee437ef72ab1ca156599a992adb396d8ca91ddb6702b7c93904be5ab0 SHA512 a45b246be1373dbcc9f556e4836ff53fd9fb3c46134e4668de1c6121c214b006da1a15d8e1e4fb4f90b7a235c6c849b0cbc8edf11920bfd43cde50feeda66faf WHIRLPOOL 2c88bbbf10adaed7c182d66e87d1d9c757f5ef99f7d8826d0e137f6b624069d950ce159af06ebd005ab964539120462143b9beb3e993a9f774cf0908d6c40e86 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 EBUILD gitlab-ce-9.3.10.ebuild 13706 SHA256 a02bc1d9e5912932663dc896683b63ecdfd44a00945db5d0955ab5ad31b97e04 SHA512 c3490ba8dea6cf7058de0aac62910e7e4c1b125256311fdb0648d2f40555ae408d0db87a7b179d7f53ae823a1c104d42a68eb7c5affdb79ed108d39eb5cf2666 WHIRLPOOL 9627551b7d3439f33e4816d55e3c9be54ebf0905cc57e4b1ad41ab4aed7c156221ee3a11c33636153a9eef4545ef870534b2a7faafd4c7e2cffe8fa6020ab37b EBUILD gitlab-ce-9.4.0_rc6.ebuild 13515 SHA256 55d3f521d4b54ae3a8e1730e603cc3699a957bb037d7bb402984c27b68e3ba50 SHA512 b47acf7328fc7396bf4e33b5e5fd147e20a5b4d0ea115518ad3492cac3e8d65e861e3ab961e73779d0bee82a5c08ca04a355e4c547c4504d5881d81f182ba6e4 WHIRLPOOL 47547b6d7368a086aa474cad44a304936a06615406c9c72d899677c2742596a991d9b2e4cb4f7a65a1011db2966b7f21ff0901004e00e4f96cbae8b28018e3bb EBUILD gitlab-ce-9.4.5.ebuild 13533 SHA256 c48168a56f787a8ad4f1feca02b6d6ffa72ce093dbea96a43944a26cabeb74be SHA512 6c6d428cbfc2510172cafadb7e96f2328c41e4b884ae97ff18a47de90f95ea0df8b9e19c439b3aab55b9508b74ebb18f0d805ba1c4d98d44fb47e4451784bb67 WHIRLPOOL 6c1ff65d02f671856f5dc95ef7cd4ec7e7b37876d1543942adc66bb25d0f82b7625e9370dd69338eb944b5d5c890ab383490e16d29df34f1ce50c50f4f83fcaa +EBUILD gitlab-ce-9.5.3.ebuild 13533 SHA256 13cce9472011e86028cfca5e50414188eea7c54b729d29fbde486e0e8d5e3c91 SHA512 632f58d3518ac0a5b6ffafab9e945f3b92d5d1eaf9f73ca153c0ccb9c521cbab311cff4b2494d9cc4de6eb66e6e1d81af0df3e9cc6761654deaa6c1bea4f5f6e WHIRLPOOL b967fa1f66ea8ceef62c11d17685dee79a694a1d8b556216d41fa0b5eb118dd3acb1edff030cddf6abd46864f82224ea10557a537a314832f0147995b83c4fcb EBUILD gitlab-ce-9999.ebuild 13475 SHA256 ae6496c7a3fd61c484fed4822631005348ab5d9c05df61ef927ae797753e83c6 SHA512 79f6b2457187f95a52cddcd67643c9b6d4ca72a4f4e52f34849786ff8ac9be32b771504f6cdd7dbaf5de5f77869db75812ff4ea3aeaf2abbdc874e755b627d99 WHIRLPOOL 2fbd6ea7b1013128416c511f2d4eb4f08e087046a8c3dfe60c5b3d5b7ac521d86ab33dba9a62e5bd10b4f5ef0e1d9d3a8cac43a189dca018c6ddb734806d8a76 -MISC ChangeLog 23010 SHA256 098af296bfa9a821af4bd8b722d69d03dab82de49f0123e45bca0c7e52525caf SHA512 9ee0b24eae33d9a3a4f97337b288f4a88bc6e1ced5f75db854cbcbc9519f8954fcadeed1709f7a7cd155694dd818ca6da8337095195f322318b9bb4f1f6e722c WHIRLPOOL 140529c4a0694affbe3514920427cdadc565de32123436a9026431a95575dd429392c69d1df6e4ebf06d21cc1fdd7ffb0ac7c991c3b95f1a98b41d849368f421 +MISC ChangeLog 23172 SHA256 74233c80552a9d05c8388ff5181a4355232ca270fea2cd4f4e179124b7dfb03f SHA512 817f80d29bb65588183fcce6271eaf7c67317c513e29b3e812be17334a902c47161fffc3b2832db13478d4270581cd12a6700ef6a4f50c34f7a3f202cfbce02c WHIRLPOOL 6d36bbfcba26f314eaea8bac6d789a0768d3b20cc4d7fc379df589b89a624658871cff017be75550e82ddfd94d0e74bb5aaab31249113b61c760107d695564c8 MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6 diff --git a/www-apps/gitlab-ce/gitlab-ce-9.5.3.ebuild b/www-apps/gitlab-ce/gitlab-ce-9.5.3.ebuild new file mode 100644 index 0000000..71ebfaa --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-9.5.3.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="789cc6787fff872693625565732cbbc18009ed2f" + +GITALY_VERSION="0.35.0" +GITLAB_PAGES_VERSION="0.5.0" +GITLAB_SHELL_VERSION="5.8.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/25 ) + 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.1 +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 $@" +}