Merge branch 'feature/gitlab-8.0.5' into 'master'
added ebuild for gitlabhq-8.0.5 See merge request !1
This commit is contained in:
		
						commit
						58880b6e21
					
				
					 2 changed files with 372 additions and 0 deletions
				
			
		|  | @ -13,10 +13,12 @@ DIST gitlabhq-7.14.3.tar.gz 6393535 SHA256 3814a3bdff9610b269be15b8cf35701fcdd78 | |||
| DIST gitlabhq-8.0.2.tar.gz 8238940 SHA256 e17a889f33c85b86744ea7be7cabb69feb340b82a4f01706360a985ceb6fd0f3 SHA512 901d0841075514af6e5f1a5a1064f81347769d024b1d0a5527de069ba29de1746ec3c27045529acd7fd993ad53ea65a08d24f3fc3fcbb2fafebc4b7c75490f97 WHIRLPOOL 19e9c1f4ea7e0106dea552bc875e2bfd1f518fe6aeefa6934772ebb29ba388eaad0715e36fa53f22fdc7e90203eea380ae62fc0dc8b7ce999efb2ee05d0cc63b | ||||
| DIST gitlabhq-8.0.3.tar.gz 8238927 SHA256 b299b100f8963f86aaeab01ad4ba49ac034cf77e803cff0fa710065e3464a049 SHA512 e247b3677ca86f43e665623c3a2602ab33843860537813fa64e3cd33b408698f0482e1ce437a4a30976b0656977f86890173ca044b7d07bfdfda3d269d311802 WHIRLPOOL 710f473d8b6c06fff9e72258102653f24035d5533f257d2d6d842ae0598fb048c6e76f9706e3662a93a9d1ec34ef67a67686fdee7439fb776de686eae19120ea | ||||
| DIST gitlabhq-8.0.4.tar.gz 8238901 SHA256 644b4bc98907bb171a1281ae73ac510f1bc6d379d39020f61e1697bb73547ae8 SHA512 41d4e8088221beb4aab731cf0ddccba0be2e4746ece0e33f92ec5488a4ed759f1e18788efed2351f5a643c31f47b4138a33077313b27e4e4567c9e9ad8dc79e5 WHIRLPOOL 08157b0f82150a5245cb2985b704026dab5f6342ab9e080c3149850ea37be5482d2dfc330a8d441957c1d8383528d3e65eb41c70ccfbb4a49e4a442f6f24a56e | ||||
| DIST gitlabhq-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d31449136e76029daa77e89086539d30c6 SHA512 af9d11f0ed744d0c92c9329ba94fe51534996f18dbb2c110d70912cd3ce9e60c3a127b7c8597c95b010b0e2251f98aabdddc314ddae53ab26a44c19b4ba7a7d7 WHIRLPOOL 6e4bc8c43cbfe215efd21a87a5d0395abde4f9998564fc0295d946ffa6a7021d2b5bc2ea625482fb400088bcc57431b3969a6c9dfa0f2121420356d153d297f0 | ||||
| EBUILD gitlabhq-7.14.3.ebuild 11037 SHA256 41ef6da353b308ddf94dea245cee85b8fa0a16d15d20cfd210ec8b908ea1a123 SHA512 c88df7c472fef7fc609bc4c4f622dfb7c9d7288a21859b3794305a100be013153a1058cd111c0e880094626b620cda72cc29632661e0c3c4f2b325beec555e97 WHIRLPOOL 795038d6d9443e242175132638bf32bf3bb191ec876f6abc3874ee68fce15c32b86e6574158ab6561c3693ecfce6457a0da619c9405fc447cbebf1c8732ac0e8 | ||||
| EBUILD gitlabhq-8.0.2.ebuild 11112 SHA256 afcb266ca7ac24191a917a1d7bd06e4b4ac5008a120cbec9efa1985d5137d007 SHA512 917c07d6560a068309b2012d0e9e4ac67dee0255ac3bfc2ec3ac079d9f16aac08f8920f6b9655b6e3a0cd2bf9b3f457747bec5286c7516937beccc4ef32f0f26 WHIRLPOOL 2ca4c67d7e4f6309db0c3bd1434779facdd07c133e7ce8d2e886028adc39db750a7218e6b2c0fdae35f738cf238bb8744179205f55f62ee113b53102c8719fc0 | ||||
| EBUILD gitlabhq-8.0.3.ebuild 11119 SHA256 0e22a53bab9bc2b87e5cead173b3e95b05e020c44eb2fbe7c51901f16b0a01d1 SHA512 d6cad9084f278d69d7051ce1036d951113631e6f2fd666f7a69ca1ddf210d64baa19aec776c84a2aa84b6ae5519ed7198c5d031aa2a4e6bc3e0557691b4a02eb WHIRLPOOL 727fcbfbc8b63d940ff35ef84f49b6507d1f94d56c99277595a7b1846c4a7fd6d0c619d67118cd955c0944d0814c197fe70cf52b6d92ce654feca1d84537422a | ||||
| EBUILD gitlabhq-8.0.4-r1.ebuild 11195 SHA256 ab0d638ed62f0a33d64af89c5cb024977371dc963a97d8a5c3abd69adbcf11ae SHA512 d8ec4be62629ee7c7e8a8142df9a36f7eb1f8658b31abe0e2498c4ddb299e098c337f8b69bce9a1fddc4e10ddc7e2d1876c8b82c4044ad08817a68310b6d6993 WHIRLPOOL 53ca5fe97448210bee6c944e62045377a9d156d1bbf47546392e11f3030f3c02cbcf4e44e3d7b55db8ceccfe75bbe423f5d81f3b3de500ca8109e1eda8b4b98a | ||||
| EBUILD gitlabhq-8.0.4.ebuild 11119 SHA256 0e22a53bab9bc2b87e5cead173b3e95b05e020c44eb2fbe7c51901f16b0a01d1 SHA512 d6cad9084f278d69d7051ce1036d951113631e6f2fd666f7a69ca1ddf210d64baa19aec776c84a2aa84b6ae5519ed7198c5d031aa2a4e6bc3e0557691b4a02eb WHIRLPOOL 727fcbfbc8b63d940ff35ef84f49b6507d1f94d56c99277595a7b1846c4a7fd6d0c619d67118cd955c0944d0814c197fe70cf52b6d92ce654feca1d84537422a | ||||
| EBUILD gitlabhq-8.0.5.ebuild 11195 SHA256 ab0d638ed62f0a33d64af89c5cb024977371dc963a97d8a5c3abd69adbcf11ae SHA512 d8ec4be62629ee7c7e8a8142df9a36f7eb1f8658b31abe0e2498c4ddb299e098c337f8b69bce9a1fddc4e10ddc7e2d1876c8b82c4044ad08817a68310b6d6993 WHIRLPOOL 53ca5fe97448210bee6c944e62045377a9d156d1bbf47546392e11f3030f3c02cbcf4e44e3d7b55db8ceccfe75bbe423f5d81f3b3de500ca8109e1eda8b4b98a | ||||
| EBUILD gitlabhq-9999.ebuild 11099 SHA256 68344a9cef613ca15b26f4024c41d28149ce8d00e1280186d874444b44653d68 SHA512 c29bb3b1d47e0bacb64be831608e980194e1e8f4d6f766884e13f0233c216f34347f6a42627ab37a02e540d4a3eb07f6d117caab61b1247c40dda1d40358fd40 WHIRLPOOL 0d32b27ebdff19c8a2e0f44cf84f2cb5518522eb00a54d591008e8fd592a3277d999e5c04d79cfe0b3d00d0a711dd22c378316705544ffcf5c752d026715341d | ||||
| MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1 | ||||
|  |  | |||
							
								
								
									
										370
									
								
								www-apps/gitlabhq/gitlabhq-8.0.5.ebuild
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										370
									
								
								www-apps/gitlabhq/gitlabhq-8.0.5.ebuild
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,370 @@ | |||
| # Copyright 1999-2015 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" | ||||
| PYTHON_COMPAT=( python2_7 ) | ||||
| 
 | ||||
| inherit eutils python-r1 ruby-ng user systemd | ||||
| 
 | ||||
| DESCRIPTION="GitLab is a free project and repository management application" | ||||
| HOMEPAGE="https://github.com/gitlabhq/gitlabhq" | ||||
| SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v${PV}.tar.gz -> ${P}.tar.gz" | ||||
| #SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v8.0.0.rc1.tar.gz -> ${P}.tar.gz" | ||||
| #RUBY_S="${PN}-8.0.0" | ||||
| 
 | ||||
| RESTRICT="mirror" | ||||
| 
 | ||||
| LICENSE="MIT" | ||||
| SLOT="0" | ||||
| KEYWORDS="~amd64 ~x86" | ||||
| 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" | ||||
| DEPEND="${GEMS_DEPEND} | ||||
| 	>=dev-vcs/gitlab-shell-2.6.5 | ||||
| 	dev-vcs/git | ||||
| 	>=dev-vcs/gitlab-git-http-server-0.2.10 | ||||
| 	kerberos? ( !app-crypt/heimdal ) | ||||
| 	rugged_use_system_libraries? ( net-libs/http-parser =dev-libs/libgit2-0.22* )" | ||||
| RDEPEND="${DEPEND} | ||||
| 	dev-db/redis | ||||
| 	virtual/mta | ||||
| 	systemd? ( sys-apps/systemd:0= )" | ||||
| ruby_add_bdepend " | ||||
| 	virtual/rubygems | ||||
| 	>=dev-ruby/bundler-1.0" | ||||
| 
 | ||||
| # | ||||
| # fix-gemfile: | ||||
| #     Remove therubyracer that doesn't compile well on Gentoo (we're using | ||||
| #     nodejs instead that is faster and better). Also replace broken | ||||
| #     charlock_holmes version with fixed one. | ||||
| # | ||||
| # fix-sendmail-config: | ||||
| #     Fix default settings to work with ssmtp that doesn't know '-t' argument. | ||||
| # | ||||
| RUBY_PATCHES=( | ||||
| 	"${PN}-8.0.2-fix-gemfile.patch" | ||||
| 	"${PN}-fix-sendmail-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}" | ||||
| 
 | ||||
| # When updating ebuild to newer version, check list of the queues in | ||||
| # https://gitlab.com/gitlab-org/gitlab-ce/blob/v${PV}/bin/background_jobs | ||||
| SIDEKIQ_QUEUES="post_receive,mailer,archive_repo,system_hook,project_web_hook,gitlab_shell,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} ${temp}/repo_satellites | ||||
| 
 | ||||
| 	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" | ||||
| 
 | ||||
| 	# 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-git-http.service" | ||||
| 		systemd_dotmpfilesd "${FILESDIR}/gitlab.conf" | ||||
| 	else | ||||
| 		local rcscript=gitlab-sidekiq-8.init | ||||
| 		use unicorn && rcscript=gitlab-unicorn-8.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 | ||||
| 	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 initlize environment:" | ||||
| 	elog "       emerge --config \"=${CATEGORY}/${PF}\"" | ||||
| 	elog "   Note: Do not forget to start Redis server first!" | ||||
| 	elog | ||||
| 	elog "If this is an update from previous version, it's HIGHLY recommended" | ||||
| 	elog "to backup your database before running the config phase!" | ||||
| 	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." | ||||
| } | ||||
| 
 | ||||
| pkg_config() { | ||||
| 	local shell_conf='/etc/gitlab-shell.yml' | ||||
| 
 | ||||
| 	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 | ||||
| 
 | ||||
| 	# check gitlab-shell configuration | ||||
| 	if [ -r ${shell_conf} ]; then | ||||
| 		local shell_repos_path="$(ryaml ${shell_conf} repos_path)" | ||||
| 		local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \ | ||||
| 			production gitlab_shell repos_path)" | ||||
| 
 | ||||
| 		if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then | ||||
| 			eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}" | ||||
| 			eerror "must points to the same location! Fix the repos_path location and" | ||||
| 			eerror "run this again."; die | ||||
| 		fi | ||||
| 	else | ||||
| 		ewarn "GitLab Shell checks skipped, could not find config file at" | ||||
| 		ewarn "${shell_conf}. Make sure that you have gitlab-shell properly" | ||||
| 		ewarn "installed and that repos_path is the same as in GitLab." | ||||
| 	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 | ||||
| } | ||||
| 
 | ||||
| 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 $@" | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue