aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/gitlabhq')
-rw-r--r--www-apps/gitlabhq/Manifest12
-rw-r--r--www-apps/gitlabhq/files/config.ssh10
-rw-r--r--www-apps/gitlabhq/files/gitlab.logrotate10
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.14-fix-checks-gentoo.patch11
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.14-fix-sendmail-param.patch17
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.14.init92
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.15-fix-checks-gentoo.patch11
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.15-fix-sendmail-param.patch17
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.15.init92
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.16-fix-checks-gentoo.patch11
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.16-fix-sendmail-param.patch17
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.16.init92
-rw-r--r--www-apps/gitlabhq/gitlabhq-8.16.2.ebuild463
13 files changed, 855 insertions, 0 deletions
diff --git a/www-apps/gitlabhq/Manifest b/www-apps/gitlabhq/Manifest
new file mode 100644
index 0000000..22a01db
--- /dev/null
+++ b/www-apps/gitlabhq/Manifest
@@ -0,0 +1,12 @@
+AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214
+AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee
+AUX gitlabhq-8.14-fix-checks-gentoo.patch 390 SHA256 60324945dfff6d236faf7959a75089a782018b048ba1cb846b91e14109673236 SHA512 0ac979616639fdd9b9534c9e7c0ad3263f39fa10e6858a6c8cf401a3234d5ef20201fd97e2a5a39071dcf98fb7ca7a48b41d18db7689103e996baf65ae9f00ea WHIRLPOOL 98c46a4b4bafeb870425f437506b202c0c836b4df8763a3716d2cf21da73b04ffd0c31a6222317cf22e550a7676b463771038b595c1b2f9d491955dd0a82885a
+AUX gitlabhq-8.14-fix-sendmail-param.patch 617 SHA256 685ad4c2307477b6f389db9b37048beb63af5a556669859d48d137c7b8b3687a SHA512 092aedb88d892d086128d76a0442ba81dc1b2e573322c7f33fad00a1b56dd035f596de82568463043fcfd02e4e30a81b6d42f83a2052144d133c5edffaa8edd1 WHIRLPOOL 61aaa2c1d8b8476f24f34257d29ac482dc38e503560a71de5511c62f1c86aa1ca3cec67272c2db42df36c6cc80688b6f1b60f0de7bb23e71f7daabf9746f70a7
+AUX gitlabhq-8.14.init 2987 SHA256 37d01155d681a17cb669ffbd8e32d127a79f0fbc3864f941e5444efcd2114859 SHA512 e5395f6ff8e3e65ee8a856d93cdfa6a3c063f0cc160c2e86ced93d6d62430ee9b841ee20e902b8c49843d3c737b2f690b0478ff190bbf107692a4bb12cb090f5 WHIRLPOOL 1bee9675ca1856efd5b1587b64b5ba3a26df340ad9044a4b3d239bec00e24d931e48083c7a4dee60bd5082c9b580ecd5d251ff1f1987e094e4cb2bc15af8a237
+AUX gitlabhq-8.15-fix-checks-gentoo.patch 390 SHA256 60324945dfff6d236faf7959a75089a782018b048ba1cb846b91e14109673236 SHA512 0ac979616639fdd9b9534c9e7c0ad3263f39fa10e6858a6c8cf401a3234d5ef20201fd97e2a5a39071dcf98fb7ca7a48b41d18db7689103e996baf65ae9f00ea WHIRLPOOL 98c46a4b4bafeb870425f437506b202c0c836b4df8763a3716d2cf21da73b04ffd0c31a6222317cf22e550a7676b463771038b595c1b2f9d491955dd0a82885a
+AUX gitlabhq-8.15-fix-sendmail-param.patch 617 SHA256 34e84a76399a55ee25386a5869a42e2973e929bf3b97d1bb3247de1bffe7f063 SHA512 1d11e2942337a4e00d47fef6997173ef50c89330b70569bdb07bcd29dbc28071088825e7f5bd2380c131ae11b818fe6de40fe96ea498a0666a1290553fd66469 WHIRLPOOL 9d4ecfaa9030abb363f760dc31fae616a64a4987fe566a7a2c38bbe5117e98af25a190016ed65a1fa26db62b110523a2baf6c3b83dc945185fc091f6b3722bfb
+AUX gitlabhq-8.15.init 2987 SHA256 f72b2d23034a29c958d661feb9f608e138ab65e70a62929bb248e7d8d447dea4 SHA512 0b54b15e7e622e0821b8218423d2a43a8a054e971d42bc7084aaaf160dbaedec1ab224ad6a2d2b6a79e54b8dd6d40a5a3eaafffee6a6a5cf7c4a365c856273cd WHIRLPOOL 1c107c4e3b2c31cdb36a60c5a7b6ef2f54cd56aa3bef8120cfd82e0948b11a70eaa2a38a4a2c12936b2372b3b6c38b140977fdba1f6547ca659254e44309e178
+AUX gitlabhq-8.16-fix-checks-gentoo.patch 390 SHA256 60324945dfff6d236faf7959a75089a782018b048ba1cb846b91e14109673236 SHA512 0ac979616639fdd9b9534c9e7c0ad3263f39fa10e6858a6c8cf401a3234d5ef20201fd97e2a5a39071dcf98fb7ca7a48b41d18db7689103e996baf65ae9f00ea WHIRLPOOL 98c46a4b4bafeb870425f437506b202c0c836b4df8763a3716d2cf21da73b04ffd0c31a6222317cf22e550a7676b463771038b595c1b2f9d491955dd0a82885a
+AUX gitlabhq-8.16-fix-sendmail-param.patch 617 SHA256 c0b6db990f5b0fd0c588f2e35eb3aac54ce54d9b41b350e7bcd54336cdc19462 SHA512 4234563b2d8eb5814fd8d9910a50fb867e444052639feebb192bb105471eae9038a076a5288b14e3fbb997311824853bea9d9c4833b4854b7f0252b826f22358 WHIRLPOOL 06f19a23028a6b83dd6ff2f9ec406af5e5f5e2c0a5879ab66585ce7b3d070170e29407c2ab9915c4afb75a23038e178295213db99ac514d865f4c1db57b22774
+AUX gitlabhq-8.16.init 2987 SHA256 d8788979fec8a05c241fc692d586537e4715c7894b5d70fd471a701913f19166 SHA512 16922aa485c99c4e30def0fed80ce883ac2786b9714070f84b09c019314deb513b8bfba8906ff67548738c0a039996e000a730bc6ad682fac5b979ebf0132c31 WHIRLPOOL dae5bfa2c77df41afe8b60634f91661dcd48ea7bbcce81fce361d7b4e8117011008f995393a8c6401ba9601c18ba94bd0a60fe5d5ad5a7d5d45b317ca8bf5ab3
+EBUILD gitlabhq-8.16.2.ebuild 15495 SHA256 2305eb18689d924a44d76872582430b2f01e25626cccc222683e58aca84580bd SHA512 47ab0bbbf8eb03b0d37e9868e760a871bc4d75b581b85db22c64c0e503327d4015891565314a7ac9525be30ef425097c115c4e56c6b7030058cd371374ef2c19 WHIRLPOOL 8107dfa1d964fb59a390420fb37dba998f42bc4f8cb17ec73ba89e86f59dfeb3ac0a90afe580afad9d4f6bf53ff4d3ef8013ea28a42240e13bba53cc3cc202ae
diff --git a/www-apps/gitlabhq/files/config.ssh b/www-apps/gitlabhq/files/config.ssh
new file mode 100644
index 0000000..ef23718
--- /dev/null
+++ b/www-apps/gitlabhq/files/config.ssh
@@ -0,0 +1,10 @@
+Host localhost
+ StrictHostKeyChecking no
+ UserKnownHostsFile=/dev/null
+ BatchMode yes
+ CheckHostIP no
+ AddressFamily inet
+ PreferredAuthentications publickey
+ ControlMaster auto
+ ControlPath ~/.ssh/ssh-%r-%h:%p.sock
+ ControlPersist 24h
diff --git a/www-apps/gitlabhq/files/gitlab.logrotate b/www-apps/gitlabhq/files/gitlab.logrotate
new file mode 100644
index 0000000..569b297
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlab.logrotate
@@ -0,0 +1,10 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+@LOG_DIR@/*.log {
+ missingok
+ delaycompress
+ compress
+ copytruncate
+}
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.14-fix-checks-gentoo.patch b/www-apps/gitlabhq/files/gitlabhq-8.14-fix-checks-gentoo.patch
new file mode 100644
index 0000000..bbe07a9
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.14-fix-checks-gentoo.patch
@@ -0,0 +1,11 @@
+--- lib/tasks/gitlab/check.rake.orig 2015-11-13 16:46:18.044125564 +0100
++++ lib/tasks/gitlab/check.rake 2015-11-13 16:46:24.414126919 +0100
+@@ -24,8 +24,6 @@
+ check_log_writable
+ check_tmp_writable
+ check_uploads
+- check_init_script_exists
+- check_init_script_up_to_date
+ check_projects_have_namespace
+ check_redis_version
+ check_ruby_version
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.14-fix-sendmail-param.patch b/www-apps/gitlabhq/files/gitlabhq-8.14-fix-sendmail-param.patch
new file mode 100644
index 0000000..a4ff648
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.14-fix-sendmail-param.patch
@@ -0,0 +1,17 @@
+--- gitlabhq-8.7.5/config/environments/production.rb.orig 2016-05-20 17:01:56.043486847 +0200
++++ gitlabhq-8.7.5/config/environments/production.rb 2016-05-20 17:02:35.871496032 +0200
+@@ -70,10 +70,10 @@
+
+ config.action_mailer.delivery_method = :sendmail
+ # Defaults to:
+- # # config.action_mailer.sendmail_settings = {
+- # # location: '/usr/sbin/sendmail',
+- # # arguments: '-i -t'
+- # # }
++ config.action_mailer.sendmail_settings = {
++ location: '/usr/sbin/sendmail',
++ arguments: '-i'
++ }
+ config.action_mailer.perform_deliveries = true
+ config.action_mailer.raise_delivery_errors = true
+
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.14.init b/www-apps/gitlabhq/files/gitlabhq-8.14.init
new file mode 100644
index 0000000..f111e76
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.14.init
@@ -0,0 +1,92 @@
+#!/sbin/openrc-run
+
+name="GitLab"
+description="GitLab 8.14 on Unicorns"
+
+: ${gitlab_user:=git}
+: ${gitlab_group:=git}
+: ${gitlab_home:="/opt/gitlabhq-8.14"}
+: ${gitlab_log:="/var/log/gitlabhq-8.14"}
+
+: ${unicorn_pidfile:="${gitlab_home}/tmp/pids/unicorn.pid"}
+: ${unicorn_log:="${gitlab_log}/unicorn.log"}
+: ${unicorn_socket:="${gitlab_home}/tmp/sockets/gitlab.socket"}
+
+: ${sidekiq_pidfile:="${gitlab_home}/tmp/pids/sidekiq.pid"}
+: ${sidekiq_log:="${gitlab_log}/sidekiq.log"}
+: ${sidekiq_config:="${gitlab_home}/config/sidekiq_queues.yml"}
+
+: ${workhorse_pidfile:="${gitlab_home}/tmp/pids/workhorse.pid"}
+: ${workhorse_log:="${gitlab_log}/workhorse.log"}
+: ${workhorse_socket:="${gitlab_home}/tmp/sockets/gitlab-workhorse.socket"}
+: ${workhorse_command_args:="-listenUmask 0 -listenNetwork unix -listenAddr ${workhorse_socket} -authBackend http://127.0.0.1:8080 -authSocket ${unicorn_socket} -documentRoot ${gitlab_home}/public"}
+
+: ${rails_env:=production}
+
+unicorn_command="/usr/bin/bundle"
+unicorn_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
+sidekiq_command="/usr/bin/bundle"
+sidekiq_start_command_args="exec sidekiq -C ${sidekiq_config} -e ${rails_env} -d -P ${sidekiq_pidfile} -L ${sidekiq_log} $@ >> ${sidekiq_log} 2>&1"
+sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
+workhorse_command="/usr/bin/gitlab-workhorse"
+
+if [ ${rails_env} = development ]; then
+ sidekiq_command_args+=" VVERBOSE=1"
+fi
+
+depend() {
+ provide gitlab
+ need redis
+ use net mysql postgresql
+}
+
+start() {
+
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${unicorn_pidfile}")"
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
+
+ ebegin "Starting GitLab 8.14 Unicorn servers"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}" \
+ --exec ${unicorn_command} -- ${unicorn_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.14 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.14 Workhorse"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}" \
+ --make-pidfile \
+ --background -1 "${workhorse_log}" -2 "${workhorse_log}" \
+ --exec ${workhorse_command} -- ${workhorse_command_args}
+ eend $?
+}
+
+stop() {
+
+ ebegin "Stopping GitLab 8.14 Workhorse"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}"
+ eend $?
+
+ ebegin "Stopping GitLab 8.14 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
+ eend $?
+
+ ebegin "Stopping GitLab 8.14 Unicorn servers"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}"
+ eend $?
+}
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.15-fix-checks-gentoo.patch b/www-apps/gitlabhq/files/gitlabhq-8.15-fix-checks-gentoo.patch
new file mode 100644
index 0000000..bbe07a9
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.15-fix-checks-gentoo.patch
@@ -0,0 +1,11 @@
+--- lib/tasks/gitlab/check.rake.orig 2015-11-13 16:46:18.044125564 +0100
++++ lib/tasks/gitlab/check.rake 2015-11-13 16:46:24.414126919 +0100
+@@ -24,8 +24,6 @@
+ check_log_writable
+ check_tmp_writable
+ check_uploads
+- check_init_script_exists
+- check_init_script_up_to_date
+ check_projects_have_namespace
+ check_redis_version
+ check_ruby_version
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.15-fix-sendmail-param.patch b/www-apps/gitlabhq/files/gitlabhq-8.15-fix-sendmail-param.patch
new file mode 100644
index 0000000..187206a
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.15-fix-sendmail-param.patch
@@ -0,0 +1,17 @@
+--- gitlabhq-8.7.5/config/environments/production.rb.orig 2016-05-20 17:01:56.043486847 +0200
++++ gitlabhq-8.7.5/config/environments/production.rb 2016-05-20 17:02:35.8.1596032 +0200
+@@ -70,10 +70,10 @@
+
+ config.action_mailer.delivery_method = :sendmail
+ # Defaults to:
+- # # config.action_mailer.sendmail_settings = {
+- # # location: '/usr/sbin/sendmail',
+- # # arguments: '-i -t'
+- # # }
++ config.action_mailer.sendmail_settings = {
++ location: '/usr/sbin/sendmail',
++ arguments: '-i'
++ }
+ config.action_mailer.perform_deliveries = true
+ config.action_mailer.raise_delivery_errors = true
+
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.15.init b/www-apps/gitlabhq/files/gitlabhq-8.15.init
new file mode 100644
index 0000000..ba21895
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.15.init
@@ -0,0 +1,92 @@
+#!/sbin/openrc-run
+
+name="GitLab"
+description="GitLab 8.15 on Unicorns"
+
+: ${gitlab_user:=git}
+: ${gitlab_group:=git}
+: ${gitlab_home:="/opt/gitlabhq-8.15"}
+: ${gitlab_log:="/var/log/gitlabhq-8.15"}
+
+: ${unicorn_pidfile:="${gitlab_home}/tmp/pids/unicorn.pid"}
+: ${unicorn_log:="${gitlab_log}/unicorn.log"}
+: ${unicorn_socket:="${gitlab_home}/tmp/sockets/gitlab.socket"}
+
+: ${sidekiq_pidfile:="${gitlab_home}/tmp/pids/sidekiq.pid"}
+: ${sidekiq_log:="${gitlab_log}/sidekiq.log"}
+: ${sidekiq_config:="${gitlab_home}/config/sidekiq_queues.yml"}
+
+: ${workhorse_pidfile:="${gitlab_home}/tmp/pids/workhorse.pid"}
+: ${workhorse_log:="${gitlab_log}/workhorse.log"}
+: ${workhorse_socket:="${gitlab_home}/tmp/sockets/gitlab-workhorse.socket"}
+: ${workhorse_command_args:="-listenUmask 0 -listenNetwork unix -listenAddr ${workhorse_socket} -authBackend http://127.0.0.1:8080 -authSocket ${unicorn_socket} -documentRoot ${gitlab_home}/public"}
+
+: ${rails_env:=production}
+
+unicorn_command="/usr/bin/bundle"
+unicorn_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
+sidekiq_command="/usr/bin/bundle"
+sidekiq_start_command_args="exec sidekiq -C ${sidekiq_config} -e ${rails_env} -d -P ${sidekiq_pidfile} -L ${sidekiq_log} $@ >> ${sidekiq_log} 2>&1"
+sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
+workhorse_command="/usr/bin/gitlab-workhorse"
+
+if [ ${rails_env} = development ]; then
+ sidekiq_command_args+=" VVERBOSE=1"
+fi
+
+depend() {
+ provide gitlab
+ need redis
+ use net mysql postgresql
+}
+
+start() {
+
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${unicorn_pidfile}")"
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
+
+ ebegin "Starting GitLab 8.15 Unicorn servers"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}" \
+ --exec ${unicorn_command} -- ${unicorn_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.15 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.15 Workhorse"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}" \
+ --make-pidfile \
+ --background -1 "${workhorse_log}" -2 "${workhorse_log}" \
+ --exec ${workhorse_command} -- ${workhorse_command_args}
+ eend $?
+}
+
+stop() {
+
+ ebegin "Stopping GitLab 8.15 Workhorse"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}"
+ eend $?
+
+ ebegin "Stopping GitLab 8.15 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
+ eend $?
+
+ ebegin "Stopping GitLab 8.15 Unicorn servers"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}"
+ eend $?
+}
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.16-fix-checks-gentoo.patch b/www-apps/gitlabhq/files/gitlabhq-8.16-fix-checks-gentoo.patch
new file mode 100644
index 0000000..bbe07a9
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.16-fix-checks-gentoo.patch
@@ -0,0 +1,11 @@
+--- lib/tasks/gitlab/check.rake.orig 2015-11-13 16:46:18.044125564 +0100
++++ lib/tasks/gitlab/check.rake 2015-11-13 16:46:24.414126919 +0100
+@@ -24,8 +24,6 @@
+ check_log_writable
+ check_tmp_writable
+ check_uploads
+- check_init_script_exists
+- check_init_script_up_to_date
+ check_projects_have_namespace
+ check_redis_version
+ check_ruby_version
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.16-fix-sendmail-param.patch b/www-apps/gitlabhq/files/gitlabhq-8.16-fix-sendmail-param.patch
new file mode 100644
index 0000000..d905fe9
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.16-fix-sendmail-param.patch
@@ -0,0 +1,17 @@
+--- gitlabhq-8.7.5/config/environments/production.rb.orig 2016-05-20 17:01:56.043486847 +0200
++++ gitlabhq-8.7.5/config/environments/production.rb 2016-05-20 17:02:35.8.1696032 +0200
+@@ -70,10 +70,10 @@
+
+ config.action_mailer.delivery_method = :sendmail
+ # Defaults to:
+- # # config.action_mailer.sendmail_settings = {
+- # # location: '/usr/sbin/sendmail',
+- # # arguments: '-i -t'
+- # # }
++ config.action_mailer.sendmail_settings = {
++ location: '/usr/sbin/sendmail',
++ arguments: '-i'
++ }
+ config.action_mailer.perform_deliveries = true
+ config.action_mailer.raise_delivery_errors = true
+
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.16.init b/www-apps/gitlabhq/files/gitlabhq-8.16.init
new file mode 100644
index 0000000..100fd56
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.16.init
@@ -0,0 +1,92 @@
+#!/sbin/openrc-run
+
+name="GitLab"
+description="GitLab 8.16 on Unicorns"
+
+: ${gitlab_user:=git}
+: ${gitlab_group:=git}
+: ${gitlab_home:="/opt/gitlabhq-8.16"}
+: ${gitlab_log:="/var/log/gitlabhq-8.16"}
+
+: ${unicorn_pidfile:="${gitlab_home}/tmp/pids/unicorn.pid"}
+: ${unicorn_log:="${gitlab_log}/unicorn.log"}
+: ${unicorn_socket:="${gitlab_home}/tmp/sockets/gitlab.socket"}
+
+: ${sidekiq_pidfile:="${gitlab_home}/tmp/pids/sidekiq.pid"}
+: ${sidekiq_log:="${gitlab_log}/sidekiq.log"}
+: ${sidekiq_config:="${gitlab_home}/config/sidekiq_queues.yml"}
+
+: ${workhorse_pidfile:="${gitlab_home}/tmp/pids/workhorse.pid"}
+: ${workhorse_log:="${gitlab_log}/workhorse.log"}
+: ${workhorse_socket:="${gitlab_home}/tmp/sockets/gitlab-workhorse.socket"}
+: ${workhorse_command_args:="-listenUmask 0 -listenNetwork unix -listenAddr ${workhorse_socket} -authBackend http://127.0.0.1:8080 -authSocket ${unicorn_socket} -documentRoot ${gitlab_home}/public"}
+
+: ${rails_env:=production}
+
+unicorn_command="/usr/bin/bundle"
+unicorn_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
+sidekiq_command="/usr/bin/bundle"
+sidekiq_start_command_args="exec sidekiq -C ${sidekiq_config} -e ${rails_env} -d -P ${sidekiq_pidfile} -L ${sidekiq_log} $@ >> ${sidekiq_log} 2>&1"
+sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
+workhorse_command="/usr/bin/gitlab-workhorse"
+
+if [ ${rails_env} = development ]; then
+ sidekiq_command_args+=" VVERBOSE=1"
+fi
+
+depend() {
+ provide gitlab
+ need redis
+ use net mysql postgresql
+}
+
+start() {
+
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${unicorn_pidfile}")"
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
+
+ ebegin "Starting GitLab 8.16 Unicorn servers"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}" \
+ --exec ${unicorn_command} -- ${unicorn_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.16 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.16 Workhorse"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}" \
+ --make-pidfile \
+ --background -1 "${workhorse_log}" -2 "${workhorse_log}" \
+ --exec ${workhorse_command} -- ${workhorse_command_args}
+ eend $?
+}
+
+stop() {
+
+ ebegin "Stopping GitLab 8.16 Workhorse"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}"
+ eend $?
+
+ ebegin "Stopping GitLab 8.16 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
+ eend $?
+
+ ebegin "Stopping GitLab 8.16 Unicorn servers"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}"
+ eend $?
+}
diff --git a/www-apps/gitlabhq/gitlabhq-8.16.2.ebuild b/www-apps/gitlabhq/gitlabhq-8.16.2.ebuild
new file mode 100644
index 0000000..f3b0907
--- /dev/null
+++ b/www-apps/gitlabhq/gitlabhq-8.16.2.ebuild
@@ -0,0 +1,463 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# Mainteiner 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 ruby22 ruby23"
+PYTHON_DEPEND="2:2.5"
+
+EGIT_REPO_URI="https://gitlab.com/gitlab-org/gitlab-ce.git"
+EGIT_COMMIT="v${PV}"
+
+inherit eutils git-2 python ruby-ng versionator user linux-info
+
+DESCRIPTION="GitLab is a free project and repository management application"
+HOMEPAGE="https://about.gitlab.com/gitlab-ci/"
+
+LICENSE="MIT"
+SLOT=$(get_version_component_range 1-2)
+KEYWORDS="~amd64 ~x86 ~arm"
+IUSE="memcached mysql +postgres +unicorn"
+
+## Gems dependencies:
+# charlock_holmes dev-libs/icu
+# grape, capybara dev-libs/libxml2, dev-libs/libxslt
+# json dev-util/ragel
+# yajl-ruby dev-libs/yajl
+# pygments.rb python 2.5+
+# execjs net-libs/nodejs, or any other JS runtime
+# pg dev-db/postgresql-base
+# mysql virtual/mysql
+# rugged net-libs/http-parser dev-libs/libgit2
+#
+GEMS_DEPEND="
+ dev-libs/icu
+ dev-libs/libxml2
+ dev-libs/libxslt
+ dev-util/ragel
+ dev-libs/yajl
+ net-libs/nodejs
+ postgres? ( dev-db/postgresql )
+ mysql? ( virtual/mysql )
+ memcached? ( net-misc/memcached )
+ net-libs/http-parser"
+DEPEND="${GEMS_DEPEND}
+ >=dev-lang/ruby-2.1[readline,ssl]
+ >dev-vcs/git-2.2.1
+ >=dev-vcs/gitlab-shell-4.1.1
+ >=www-servers/gitlab-workhorse-1.3.0
+ net-misc/curl
+ virtual/ssh"
+RDEPEND="${DEPEND}
+ >=dev-db/redis-2.8.0
+ virtual/mta
+ virtual/krb5"
+ruby_add_bdepend "
+ virtual/rubygems
+ >=dev-ruby/bundler-1.0"
+
+RUBY_PATCHES=(
+ "${PN}-${SLOT}-fix-checks-gentoo.patch"
+ "${PN}-${SLOT}-fix-sendmail-param.patch"
+)
+
+GIT_USER="git"
+GIT_GROUP="git"
+GIT_HOME=$(getent passwd $GIT_USER | cut -d: -f6)
+DEST_DIR="/opt/${PN}-${SLOT}"
+CONF_DIR="/etc/${PN}-${SLOT}"
+
+GIT_REPOS="${GIT_HOME}/repositories"
+GIT_SATELLITES="${GIT_HOME}/gitlab-satellites"
+GITLAB_SHELL="/var/lib/gitlab-shell"
+GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks"
+
+RAILS_ENV=${RAILS_ENV:-production}
+RUBY=${RUBY:-ruby21}
+BUNDLE="${RUBY} /usr/bin/bundle"
+
+pkg_setup() {
+ enewgroup ${GIT_GROUP}
+ enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "${GIT_GROUP}"
+}
+
+all_ruby_unpack() {
+ git-2_src_unpack
+}
+
+each_ruby_prepare() {
+
+ # fix path to repo and gitlab-shell hooks
+ test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"?
+
+ sed -i \
+ -e "s|\(\s*path:\s\)/.*/gitlab-shell/|\1 ${GITLAB_SHELL}/|" \
+ -e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \
+ -e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \
+ -e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \
+ -e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \
+ config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
+
+ # modify database settings
+ sed -i \
+ -e 's|\(username:\) postgres.*|\1 gitlab|' \
+ -e 's|\(password:\).*|\1 gitlab|' \
+ -e 's|\(socket:\).*|/run/postgresql/.s.PGSQL.5432|' \
+ config/database.yml.postgresql \
+ || die "failed to filter database.yml.postgresql"
+
+ # replace "secret" token with random one
+ local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128)
+ sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \
+ config/initializers/secret_token.rb \
+ || die "failed to filter secret_token.rb"
+
+ # remove needless files
+ rm .foreman .gitignore Procfile
+ use unicorn || rm config/unicorn.rb.example
+ use postgres || rm config/database.yml.postgresql
+ use mysql || rm config/database.yml.mysql
+
+ # change cache_store
+ if use memcached; then
+ sed -i \
+ -e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \
+ config/environments/production.rb \
+ || die "failed to modify production.rb"
+ fi
+
+ # Update pathes for unicorn
+ if use unicorn; then
+ sed -i \
+ -e "s#/home/git/gitlab#${DEST_DIR}#" \
+ config/unicorn.rb.example \
+ || die "failed to modify unicorn.rb.example"
+ fi
+}
+
+each_ruby_install() {
+ local dest="${DEST_DIR}"
+ local conf="/etc/${PN}-${SLOT}"
+ local temp="/var/tmp/${PN}-${SLOT}"
+ local logs="/var/log/${PN}-${SLOT}"
+ local uploads="${DEST_DIR}/public/uploads"
+
+ ## Prepare directories ##
+
+ diropts -m750
+ keepdir "${logs}"
+ dodir "${temp}"
+
+ diropts -m755
+ dodir "${dest}"
+ dodir "${uploads}"
+
+ dosym "${temp}" "${dest}/tmp"
+ dosym "${logs}" "${dest}/log"
+
+ ## Link gitlab-shell into git home
+ dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell"
+
+ ## Install configs ##
+
+ # Note that we cannot install the config to /etc and symlink
+ # it to ${dest} since require_relative in config/application.rb
+ # seems to get confused by symlinks. So let's install the config
+ # to ${dest} and create a smylink to /etc/gitlabhq-<VERSION>
+ dosym "${dest}/config" "${conf}"
+
+ insinto "${dest}/.ssh"
+ newins "${FILESDIR}/config.ssh" config
+
+ echo "export RAILS_ENV=production" > "${D}/${dest}/.profile"
+
+ ## Install all others ##
+
+ # remove needless dirs
+ rm -Rf tmp log
+
+ insinto "${dest}"
+ doins -r ./
+
+ ## Install logrotate config ##
+
+ dodir /etc/logrotate.d
+ sed -e "s|@LOG_DIR@|${logs}|" \
+ "${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \
+ || die "failed to filter gitlab.logrotate"
+
+ ## Install gems via bundler ##
+
+ cd "${D}/${dest}"
+
+ local without="development test thin"
+ local flag; for flag in memcached mysql postgres unicorn; do
+ without+="$(use $flag || echo ' '$flag)"
+ done
+ local bundle_args="--deployment ${without:+--without ${without}}"
+
+ # Use systemlibs for nokogiri as suggested
+ ${BUNDLE} config build.nokogiri --use-system-libraries
+
+ # Fix invalid ldflags for charlock_holmes,
+ # see https://github.com/brianmario/charlock_holmes/issues/32
+ ${BUNDLE} config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc'
+
+ einfo "Running bundle install ${bundle_args} ..."
+ ${BUNDLE} install ${bundle_args} || die "bundler failed"
+
+ ## Clean ##
+
+ local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version')
+
+ # remove gems cache
+ rm -Rf ${gemsdir}/cache
+
+ # fix permissions
+ fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}"
+ fperms o+Xr "${temp}" # Let nginx access the unicorn socket
+
+ ## RC scripts ##
+ local rcscript=${PN}-${SLOT}.init
+
+ cp "${FILESDIR}/${rcscript}" "${T}" || die
+ sed -i \
+ -e "s|@GIT_USER@|${GIT_USER}|" \
+ -e "s|@GIT_GROUP@|${GIT_USER}|" \
+ -e "s|@SLOT@|${SLOT}|" \
+ -e "s|@DEST_DIR@|${dest}|" \
+ -e "s|@LOG_DIR@|${logs}|" \
+ -e "s|@RESQUE_QUEUE@|${resque_queue}|" \
+ "${T}/${rcscript}" \
+ || die "failed to filter ${rcscript}"
+
+ if use memcached; then
+ sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \
+ "${T}/${rcscript}" || die "failed to filter ${rcscript}"
+ fi
+
+ newinitd "${T}/${rcscript}" "${PN}-${SLOT}"
+}
+
+pkg_preinst() {
+ diropts -m "0750" -o "${GIT_USER}" -g "${GIT_GROUP}"
+ dodir "${GIT_SATELLITES}"
+}
+
+pkg_postinst() {
+ if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
+ einfo "Generating SSH key for git user"
+ su -l ${GIT_USER} -s /bin/sh -c "
+ ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
+ || die "failed to generate SSH key"
+ fi
+ if [ ! -e "${GIT_HOME}/.gitconfig" ]; then
+ einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to "
+ einfo "modify this file according to your needs!"
+ su -l ${GIT_USER} -s /bin/sh -c "
+ git config --global core.autocrlf 'input';
+ git config --global gc.auto 0;
+ git config --global user.email 'gitlab@localhost';
+ git config --global user.name 'GitLab'" \
+ || die "failed to setup git configuration"
+ fi
+
+ elog "If this is a new installation, proceed with the following steps:"
+ elog
+ elog " 1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
+ elog " and edit this file in order to configure your GitLab settings."
+ elog
+ elog " 2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml"
+ elog " and edit this file in order to configure your database settings"
+ elog " for \"production\" environment."
+ elog
+ elog " 3. Copy ${CONF_DIR}/initializers/rack_attack.rb.example"
+ elog " to ${CONF_DIR}/initializers/rack_attack.rb"
+ elog
+ elog " 4. Copy ${CONF_DIR}/resque.yml.example to ${CONF_DIR}/resque.yml"
+ elog " and edit this file in order to configure your Redis settings"
+ elog " for \"production\" environment."
+ elog
+
+ if use unicorn; then
+ elog " 4a. Copy ${CONF_DIR}/unicorn.rb.example to ${CONF_DIR}/unicorn.rb"
+ elog
+ fi
+
+ elog " 5. If this is a new installation, create a database for your GitLab instance."
+ 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 gitlab_production"
+ elog " Note: You should change your password to something more random..."
+ elog
+ elog " GitLab uses polymorphic associations which are not SQL-standard friendly."
+ elog " To get it work you must use this ugly workaround:"
+ elog " psql -U postgres -d gitlab"
+ elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;"
+ elog
+ fi
+ elog " 6. Execute the following command to finalize your setup:"
+ elog " emerge --config \"=${CATEGORY}/${PF}\""
+ elog " Note: Do not forget to start Redis server."
+ elog
+ elog "To update an existing instance, run the following command and choose upgrading when prompted:"
+ elog " emerge --config \"=${CATEGORY}/${PF}\""
+ elog
+ elog "Important: Do not remove the earlier version prior migration!"
+
+ if linux_config_exists; then
+ if linux_chkconfig_present PAX ; then
+ ewarn "Warning: PaX support is enabled, you must disable mprotect for ruby. Otherwise "
+ ewarn "FFI will trigger mprotect errors that are hard to trace. Please run: "
+ ewarn " paxctl -m $(which ${RUBY})"
+ fi
+ else
+ einfo "Important: Cannot find a linux kernel configuration, so cannot check for PaX support."
+ einfo " If CONFIG_PAX is set, you should disable mprotect for ruby since FFI may trigger"
+ einfo " mprotect errors."
+ fi
+}
+
+pkg_config() {
+
+ # Ask user whether this is the first installation
+ einfo "Do you want to upgrade an existing installation? [Y|n] "
+ do_upgrade=""
+ while true
+ do
+ read -r do_upgrade
+ if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break
+ elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break
+ else eerror "Please type either \"Y\" or \"N\" ... " ; fi
+ done
+
+ if [[ $do_upgrade ]] ; then
+
+ LATEST_DEST=$(test -n "${LATEST_DEST}" && echo ${LATEST_DEST} || \
+ find /opt -maxdepth 1 -iname 'gitlabhq-*' -and -type d -and -not -iname "gitlabhq-${SLOT}" | \
+ sort -r | head -n1)
+
+ if [[ -z "${LATEST_DEST}" || ! -d "${LATEST_DEST}" ]] ; then
+ einfo "Please enter the path to your latest Gitlab instance:"
+ while true
+ do
+ read -r LATEST_DEST
+ test -d ${LATEST_DEST} && break ||\
+ eerror "Please specify a valid path to your Gitlab instance!"
+ done
+ else
+ einfo "Found your latest Gitlab instance at \"${LATEST_DEST}\"."
+ fi
+
+ einfo "Please make sure that you've created a backup and stopped your running Gitlab instance: "
+ elog "\$ cd \"${LATEST_DEST}\" && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:backup:create RAILS_ENV=production"
+ elog "\$ /etc/init.d/${LATEST_DEST#*/opt/} stop"
+ elog ""
+
+ einfo "Press ENTER to continue, STRG-C to cancel"
+ read
+
+ if [[ ${LATEST_DEST} != ${DEST_DIR} ]] ;
+ then
+ einfo "Found major update, migrate data from \"$LATEST_DEST\":"
+ einfo "Migrating uploads ..."
+ einfo "This will move your uploads from \"$LATEST_DEST\" to \"${DEST_DIR}\", continue? [Y|n] "
+ migrate_uploads=""
+ while true
+ do
+ read -r migrate_uploads
+ if [[ $migrate_uploads == "n" || $migrate_uploads == "N" ]] ; then migrate_uploads="" && break
+ elif [[ $migrate_uploads == "y" || $migrate_uploads == "Y" || $migrate_uploads == "" ]] ; then migrate_uploads=1 && break
+ else eerror "Please type either \"Y\" or \"N\" ... " ; fi
+ done
+ if [[ $migrate_uploads ]] ; then
+ su -l ${GIT_USER} -s /bin/sh -c "
+ rm -rf ${DEST_DIR}/public/uploads && \
+ mv ${LATEST_DEST}/public/uploads ${DEST_DIR}/public/uploads" \
+ || die "failed to migrate uploads."
+
+ # Fix permissions
+ find "${DEST_DIR}/public/uploads/" -type d -exec chmod 0700 {} \;
+ fi
+
+ for conf in database.yml gitlab.yml resque.yml unicorn.rb secrets.yml ; do
+ einfo "Migration config file \"$conf\" ..."
+ cp -p "${LATEST_DEST}/config/${conf}" "${DEST_DIR}/config/"
+ sed -s "s#$(basename $LATEST_DEST)#${PN}-${SLOT}#g" -i "${DEST_DIR}/config/$conf"
+
+ example="${DEST_DIR}/config/${conf}.example"
+ test -f "${example}" && mv "${example}" "${DEST_DIR}/config/._cfg0000_${conf}"
+ done
+ CONFIG_PROTECT="${DEST_DIR}" dispatch-conf || die "failed to automatically migrate config, run \"CONFIG_PROTECT=${DEST_DIR} dispatch-conf\" by hand, re-run this routine and skip config migration to proceed."
+ fi
+
+ einfo "Migrating database ..."
+ su -l ${GIT_USER} -s /bin/sh -c "
+ export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
+ cd ${DEST_DIR}
+ ${BUNDLE} exec rake db:migrate RAILS_ENV=production" \
+ || die "failed to migrate database."
+
+ einfo "Clear redis cache ..."
+ su -l ${GIT_USER} -s /bin/sh -c "
+ export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
+ cd ${DEST_DIR}
+ ${BUNDLE} exec rake cache:clear RAILS_ENV=production" \
+ || die "failed to run cache:clear"
+
+ einfo "Clear and precompile assets ..."
+ su -l ${GIT_USER} -s /bin/sh -c "
+ export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
+ cd ${DEST_DIR}
+ ${BUNDLE} exec rake assets:clean RAILS_ENV=production
+ ${BUNDLE} exec rake assets:precompile RAILS_ENV=production" \
+ || die "failed to run assets:clean and assets:precompile"
+
+ else
+
+ ## Check config files existence ##
+ einfo "Checking configuration files ..."
+
+ if [ ! -r "${CONF_DIR}/database.yml" ] ; then
+ eerror "Copy \"${CONF_DIR}/database.yml.*\" to \"${CONF_DIR}/database.yml\""
+ eerror "and edit this file in order to configure your database settings for"
+ eerror "\"production\" environment."
+ die
+ fi
+ if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then
+ eerror "Copy \"${CONF_DIR}/gitlab.yml.example\" to \"${CONF_DIR}/gitlab.yml\""
+ eerror "and edit this file in order to configure your GitLab settings"
+ eerror "for \"production\" environment."
+ die
+ fi
+
+ einfo "Initializing database ..."
+ su -l ${GIT_USER} -s /bin/sh -c "
+ export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
+ cd ${DEST_DIR}
+ ${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \
+ || die "failed to run rake gitlab:setup"
+ fi
+
+ ## (Re-)Link gitlab-shell-secret into gitlab-shell
+ if test -L "${GITLAB_SHELL}/.gitlab_shell_secret"
+ then
+ rm "${GITLAB_SHELL}/.gitlab_shell_secret"
+ ln -s "${DEST_DIR}/.gitlab_shell_secret" "${GITLAB_SHELL}/.gitlab_shell_secret"
+ fi
+
+ einfo "You might want to run the following in order to check your application status:"
+ einfo "# cd ${DEST_DIR} && sudo -u ${GIT_USER} ${BUNDLE} exec rake gitlab:check RAILS_ENV=production"
+ einfo ""
+ einfo "GitLab is prepared, now you should configure your web server."
+}