added ebuild for gitlabhq-7.8.2 and cleaned up a little

This commit is contained in:
Manuel Friedli 2015-03-05 10:18:36 +01:00
parent 06ebed093d
commit 3e27e54e76
5 changed files with 443 additions and 82 deletions

View file

@ -1,11 +1,11 @@
AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214
AUX gitlab-sidekiq-7.service 1192 SHA256 3d1bdb5e653448a46ff2530321090ac5c8897121f6361c09c4714b0387c3d42d SHA512 45e8fd0092ba45af62019b5a4f073cfaa050320d208e0ce9ebfe881024e7a9123283fb16635373d898827e156806738bba42a736b5d2ba5c5228167fedaf367d WHIRLPOOL 892911ffd089d13877481ee2589c016b1f67874f209d1757e67d42b5f7c0aa1d5f2010576a35becf7966dfcadbd00b68654067e00bc17b75e30cfc64a43bcf21
AUX gitlab-sidekiq-noslot.init 972 SHA256 614b405d16e2042d013dae510796620d42461512705fad2a90a7f558e0051c33 SHA512 afd3837ae660d47297c6d65180ae5f3ec6a15c1c8ea23aa5b715ca2fc5b628f3d868adf265c16521e940e5aeb53e4a70a2ec6c0acfacb6b39a1fb5bc669672fd WHIRLPOOL 434ae6e789fc8894a9c83bd538de804784c23072129c79fe0c209848e0c8e1a3d607ce9f7f9da617a25c874ce81d276d010d5ae2d3bf95e25034e9048cbd747a
AUX gitlab-sidekiq.init 979 SHA256 f9bc02031b0418e4c765fae37bb40cd9e16dbe5b1a7f5c105a2d7ba3568b0195 SHA512 e3311f1110fca02a378a9f74704d9241884a1973e90be1dbd663809b524528eda25e3ad0ac5d20737f6ccd78343582557ac579adb976473f8aabc0320172921f WHIRLPOOL 365d539cceacb5ff9171aa7316ac061ef4b4a8d63e6d4a26395afb841878a08bdd1b9bf2709602dc90f15a1ed5ff8566a0e8239e8ab9184e84814a16993f3aeb
AUX gitlab-sidekiq.service 1174 SHA256 f1c2ba4de65ce317d55543e6327214a0f309e980e26fc97da0931530d2e66e93 SHA512 2a563133d917e075d231decefb0241679d3cbc0ac648ddf9eff0fe07ce7a136badf8fca62c34143235819dc9be7f3a202e59b3dec9fa4446dff0473f87ee2361 WHIRLPOOL 70b701c98c5e8947f8f886d45160109239fd6ed6d20fb860b38309c7edf71c90c84388f876d6e129daad85e0265f116e41b978a00b8ea0905836ce9addcfa34b
AUX gitlab-support.init 1188 SHA256 09059c391a5d5a8856030b4a50a9c8bb7d8fdb8f7ab75c1a869015bbff6a3a32 SHA512 25fe623e1d506a750897b4e100fcaddc654997a7cf23b7f1a6b4c3b77907cbe8af669cc38da86753696861e4fd14415ea7bc1decb0fdb500de1ef8a3e845860c WHIRLPOOL 169fab28b013762d3eaac4d8a37ded0ba6dedd9ebcd9fdd55347409f279d332a8d0326ec6eb66255c6f1d488c856c7135c60f3069972a7a07e55453e55bbe969
AUX gitlab-unicorn-6.init 1663 SHA256 ba211c63d559cbca510483d5536d28131e08f67dc8914444a2c85b27c7a92b60 SHA512 a574b3bb5b9af3e3a707045ac6d783bab73bab1db033d07999b3d06789da0853bc3de0bba39a3c154e5b1ab385926ee3ec4487f4c797708a318fa5df22827069 WHIRLPOOL 497cf52ebb4b33cc6bbd81e53d4961878b2ea9dc42bacabf7a32686e52a54c22eed73836705e80714d7b759cfd2ee1929e6aa12083435f265c472270e158f72a
AUX gitlab-unicorn-7.init 1671 SHA256 714d5ba2fdba3287357120ff82b3fececc2baff1d037366ace4ccd4bc46eed9d SHA512 ca62bd581b03af2b4d8fa7429193f6075d1c286b672c184aca91d5d1ea9f0de1980a3c6e3cde73e6b0a79655c511eb0c19fd36083a4d9544db1ae78234ef3aeb WHIRLPOOL b6ba697eac3dab059a1199cc801baa60f5b3eb911b0bbe59478c105b1976a1e8fb49bb66f12a53d20b67a25e1fc8487d14b4d474650ef3259999ca8c5503eabf
AUX gitlab-unicorn.init 1874 SHA256 8bede14eb7beaba955e64d0ff2928324992522e22e777aab33bf51d743c7ba4e SHA512 a8595a623cd724a3d2e3b95ea7216e2574d0beea75369a46dfd6c5483310675a827d08cda516dec0df7ccbff399d27e3dde0e0fae07d11eed6412b0d3f9ca8d9 WHIRLPOOL c619180431ee27b5fe724aaf6ed31bb9fcf8db3779d7879e79c7a04927ea7d4efcd363d5cc44184917bd4de8292267e93136de849e8892ffc1e2891aacb5f51c
AUX gitlab-unicorn.init 1657 SHA256 5fe794938b27d25488affc174e4761f5a3a1f9b15489a05f3839b13e4fd5b5ef SHA512 5e005ec26151afb4cdc8eb83592fad6814bb2a3ac8e9f642de83e70cd8615bdf969803a2479f8f72a70e0ae5ab5559da205965b55b3b4cdfdc9aa74055eef6fe WHIRLPOOL 6c61db597311ac618822fb22d7f51c830e5c011ce8e4c790338b3203a4483f3dd121bbd9cc33d7e1f92a2b0527e59816742f8ef0fd531c4c28c36d886fc94196
AUX gitlab-unicorn.service 917 SHA256 282c1b08ec13b8670018985278a25d013d6336ab23b0ee815cb36b34ba678391 SHA512 6288c7c096fb38976c5b6218e46b7da53dfea73e834d1902876d0b15e1173fc56600c511e5941c2f6f61e2f5ef50a7cca476ee14a19b516599d6eb0594e2b8e7 WHIRLPOOL 33de53ae81af49d02d8e8a4e2e741bbccfa5e657939f433515ee7fe81aa55a706e094062ebcb67b7dbf19d21bd37070f4294e095cd955c2f94dc2c3842a008d5
AUX gitlab.conf 137 SHA256 e0cceea29f2c3e1f7c94a9ab37640a31d4966b106cc01f47fc77b5c721aa9489 SHA512 7d41510eb288e47676d1bf60e92cedd04ec07e1af12cfcfcb5b75d4eed5ee320f41d3369831f9a2361c570289b885f4f00cb365e418a0d66bee6a5a78060582d WHIRLPOOL 27ea7e1109ed34367664c0e4d7cc968d300e6e2bdc3a66f0eba87023a1659f14115cf25535f438f7947a19b1c51c1452d3bb23db120442ba3be20b310a87317f
AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee
@ -66,6 +66,7 @@ DIST gitlabhq-7.7.1.tar.gz 4438938 SHA256 b3399006bb7b89c1622bee52562bff4ab9681f
DIST gitlabhq-7.7.2.tar.gz 4439065 SHA256 7c99367be815d231ba4b349a7f0a3d2470ae13ac2910d01d085f46890961b714 SHA512 5853d7989e75c03b7f8df24378bf25d9b49ffc858f6421f809bfcc11177905d9706307d048b880316331c74c79914a3ebdd032682414c76ac6b082e3813be074 WHIRLPOOL eb56dadcda422cfccf263f838ec225359ed9490a3c34df8a3d4a9b1f08ad98900374d81214217f27132b29d104b5102ec3d95f0c6bc10a8eca7088f9e5c9bbbd
DIST gitlabhq-7.8.0.tar.gz 5303213 SHA256 a7b3836b1071ee58f986197b08c3d91fc85524a5ce3050f7ef6697088850a242 SHA512 fff5240f8286a3d084ac158a262ab1c285c1b685769e1a707e0317e67fd0c27205970c51338589a59c8192eb4a87c7e43b2ecbbaa5da8f5f243024f364285983 WHIRLPOOL bd8ed138b888ab46ecfa172045e79520db5f48ce95b119a1af752db4988ee62c73be753773d4cc5dea4fd029d4bf6a78293291e050a7b1e2776b0a84deff2357
DIST gitlabhq-7.8.1.tar.gz 5302130 SHA256 4308a945b605caa369c0cafc22fbf7aa9f6cf9143ab200cde86c9c9308849153 SHA512 ac789c6264e599f44e50edf4ff09187293f1d2a7f4fc9460b3f28d5753a4d868247fe68a443e50c2bcbd75871ed7a124f1d49e84565da954c83f36154b4cc302 WHIRLPOOL ceb7f82f86d31264321fec76b5344d908327546ba9c2ceec7ad81cd8eaba7832450459251cd3e52825ae00f926f8d74205681abc8e867f97d44eea195dca4652
DIST gitlabhq-7.8.2.tar.gz 5303178 SHA256 78e6538dae391b035c1177dd700feaaa01036f692a2ed66c55703c7fd68771ec SHA512 ce4463887a09c185087d0145d01f048b2953c15966e18c7991ce305a1119a64e87c628504d0147f2dba4417609d64be62813ca860394bb428241a9b36aac45fa WHIRLPOOL c63459c5e93dfcf732b3308b24a67cae874193275bcf1f01af52cf6f558f640754e2d3b791e81d81ac785e400ad3fd2422e691c108f9df63744bdacf64e74b52
EBUILD gitlabhq-6.7.5.ebuild 10973 SHA256 d74d454bd9972f15d21a3454e39a78ab042ccb3444cbbedb25da01d40335361b SHA512 b5494ee857055022da0803277d6a8b84d1fa1d9af66a853eedafdd3fa4993dfe4a66962581234333b16f41b6d605cfe6a207a4d2706c90d921fbc54474deb296 WHIRLPOOL 03026c7b7029c8bc7d5e5ad05c38e4b507be6c4f36b488753120d7d0849522a9e557c5b04adcac4c22eced0fbc1432fd16e7447198092b6691ccc529147d9dcf
EBUILD gitlabhq-6.8.2.ebuild 10595 SHA256 24317d99bb9d0e220c11a37709b1b701b9cd7bf7b9fe3adead666c531569dcf0 SHA512 2f3f5e38b33edfdff35f3888e694984e97d897d7c64c0aa6cc35149d253e7211560dbd918b12e891c0d1d009241e53e255a2a3be91beb5a3954d148c4554315e WHIRLPOOL 4dca44d6e271ec14252e3a4690e6736d64133d3d115ec19b77d37cb5a2a3d3a46e9820dae48df5d7fa79dd0ca9c6b178b9dca85811bc0e78b7964580b0696b59
EBUILD gitlabhq-6.9.2.ebuild 10616 SHA256 4221acadb5ac65ca3d662a2a560ff6343e04e0ca14dbd1b5bdd8f6a07812f7be SHA512 161c587d219c0dfd54b92805f7378aa7b1750bb25e632a16b67e3d24b28fab95f8f4272d685dfc70f1d7bfb15449a208fbb8b343dd8f902d8855034ed7f855d1 WHIRLPOOL effe560de13a29de88bf42aa927ddc2781373722a0e9a83ebef8942b0128208e35658a6b43d1bdc2d6e2b80c43b836dc8cc431f5d38912c201c789f70076e245
@ -87,3 +88,4 @@ EBUILD gitlabhq-7.7.1.ebuild 10923 SHA256 c92d84d7c2a8a65b5876c39aa80d5c76eac8a2
EBUILD gitlabhq-7.7.2.ebuild 10938 SHA256 4c4336138456d9efe0cc7d6827c6c19be0edfeb874847202e566225e991e5991 SHA512 29d42285a1fdb55813d2811251ccdfd65b9a4eb62055191d038b0d1a2848476f68e639e4fa777260d200f36a8a7ab187b71339eff136126fd41a4478f31ff117 WHIRLPOOL c1657a6bc4d6af99d12ae562edcd84553b68b7996c7088b865c177cdb12236abd8e450e12755713ab42fb4d4418651da4ecaf8415d604de52546da208da93861
EBUILD gitlabhq-7.8.0.ebuild 10952 SHA256 5da8b8804b2bc89755c6be45aa057da0c34af34ac8b01e1a8fc4a95820fb8330 SHA512 cfd53fb5c9f07dc174b4985c66ba781f15eae514e153cf2a5d53e4ae753a23d086ed303b118e750ec4e6cf29a71f4fe486f091f301a06a8863b28d79fb9e5918 WHIRLPOOL 52fa14e9b6bbfacaa23f9629e0aee7c1557f0c913e9ed6ea10fb82fdc6dd3b43a406a05b104729b46448fe491e4d17cc05e12b3a7318f314263415231e687edf
EBUILD gitlabhq-7.8.1.ebuild 10966 SHA256 b5d3b822a4ce401b50909f0663bef4dacf7c9673c51bbbe2f600533f3bf7c365 SHA512 630b0b2bcda6fb7c5b407b4c094e35ad9de74ea9e6fd959f914f9944cd543ced2c3f9b1e8d3f98c6d3f1e0a3f6873e4ca64817ae3fe2aed61c4e656995e8ef62 WHIRLPOOL 3cede9b536a86cce0cc024a957d7b29c472cf60223ba9321bbe9e4b885cb9a58c3438d07708280a76dafb811551c3576559c4e6ec71b2050c3e81e88f460bce4
EBUILD gitlabhq-7.8.2.ebuild 10919 SHA256 b728435d57def228c29850314d91cf82dc92a3410bd58b077987a1bb0f30179e SHA512 80ecf01c80740dc443d6a45362484a9a7e08d5e28db02d29ebecd95aae88d75b7652252a9afe2af99ae8d00ea623d8f453e809992dc8817848dcf30c53668a98 WHIRLPOOL 23552b0df3b664e99b79d04adbd8609eed09bc4d6cf674b9862852afe1853e6e3e6b53900e04b323f88a85a4d61f3f54b023c723efe3469ec1cfe7fe120b5c73

View file

@ -0,0 +1,43 @@
#!/sbin/runscript
name="GitLab Sidekiq"
description="Sidekiq for GitLab"
: ${gitlab_user:=@USER@}
: ${gitlab_base:="@GITLAB_BASE@"}
: ${rails_env:=production}
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
: ${sidekiq_queues:="@QUEUES@"}
sidekiq_command="/usr/bin/bundle"
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
depend() {
need redis
use net
}
start() {
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
ebegin "Starting ${name} - Sidekiq"
start-stop-daemon --start \
--background --quiet \
--chdir "${gitlab_base}" \
--user=${gitlab_user} \
--pidfile="${sidekiq_pidfile}" \
--env RAILS_ENV=${rails_env} \
--exec ${sidekiq_command} -- ${sidekiq_command_args}
eend $?
}
stop() {
ebegin "Stopping ${name} - Sidekiq"
start-stop-daemon --stop \
--pidfile=${sidekiq_pidfile} \
--exec ${sidekiq_command}
eend $?
}

View file

@ -1,50 +0,0 @@
#!/sbin/runscript
name="GitLab support"
description="Support for GitLab @SLOT@"
: ${gitlab_user:=@USER@}
: ${gitlab_group:=@GROUP@}
: ${gitlab_home:="@GITLAB_HOME@"}
: ${resque_pidfile:="/run/gitlab/resque_worker.pid"}
: ${resque_log:="@LOG_DIR@/resque.log"}
: ${resque_queue:="@RESQUE_QUEUE@"}
: ${rails_env:=production}
resque_command="/usr/bin/bundle"
resque_command_args="exec rake environment resque:work QUEUE=${resque_queue} RAILS_ENV=${rails_env}"
if [ ${rails_env} = development ]; then
resque_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab @SLOT@ Resque worker"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${resque_pidfile}")"
start-stop-daemon --start \
--background --quiet \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--make-pidfile --pidfile=${resque_pidfile} \
--stdout "${resque_log}" --stderr "${resque_log}" \
--exec ${resque_command} -- ${resque_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab @SLOT@ Resque worker"
start-stop-daemon --stop \
--pidfile=${resque_pidfile} \
--exec ${resque_command}
eend $?
}

View file

@ -1,27 +1,23 @@
#!/sbin/runscript
name="GitLab"
description="GitLab @SLOT@ on Unicorns"
description="GitLab on Unicorns"
: ${gitlab_user:=@USER@}
: ${gitlab_group:=@GROUP@}
: ${gitlab_home:="@GITLAB_HOME@"}
: ${server_pidfile:="/run/gitlab/unicorn.pid"}
: ${gitlab_base:="@GITLAB_BASE@"}
: ${rails_env:=production}
: ${resque_pidfile:="/run/gitlab/resque_worker.pid"}
: ${resque_log:="/var/log/gitlab-4.0/resque.log"}
: ${resque_queue:=@RESQUE_QUEUE@}
: ${server_pidfile:="/run/gitlab/unicorn.pid"}
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
: ${sidekiq_queues:="@QUEUES@"}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
resque_command="/usr/bin/bundle"
resque_command_args="exec rake environment resque:work QUEUE=${resque_queue} RAILS_ENV=${rails_env}"
server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D"
if [ ${rails_env} = development ]; then
resque_command_args+=" VVERBOSE=1"
fi
sidekiq_command="/usr/bin/bundle"
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues//,/ -q } -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
depend() {
provide gitlab
@ -30,40 +26,42 @@ depend() {
}
start() {
ebegin "Starting GitLab @SLOT@ Unicorn servers"
ebegin "Starting ${name} - Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${resque_pidfile}")"
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${server_pidfile}")"
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--chdir "${gitlab_base}" \
--user=${gitlab_user} \
--pidfile="${server_pidfile}" \
--env RAILS_ENV=${rails_env} \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab @SLOT@ Resque worker"
ebegin "Starting ${name} - Sidekiq"
start-stop-daemon --start \
--background --quiet \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--make-pidfile --pidfile=${resque_pidfile} \
--stdout "${resque_log}" --stderr "${resque_log}" \
--exec ${resque_command} -- ${resque_command_args}
--chdir "${gitlab_base}" \
--user=${gitlab_user} \
--pidfile="${sidekiq_pidfile}" \
--env RAILS_ENV=${rails_env} \
--exec ${sidekiq_command} -- ${sidekiq_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab @SLOT@ Resque worker"
ebegin "Stopping ${name} - Sidekiq"
start-stop-daemon --stop \
--pidfile=${resque_pidfile} \
--exec ${resque_command}
--pidfile=${sidekiq_pidfile} \
--exec ${sidekiq_command}
eend $?
ebegin "Stopping GitLab @SLOT@ Unicorn servers"
ebegin "Stopping ${name} - Unicorn servers"
start-stop-daemon --stop \
--signal QUIT \
--pidfile=${server_pidfile} \
--exec ${server_command} -- ${server_command_args}
--exec ${server_command}
eend $?
}

View file

@ -0,0 +1,368 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
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="ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python 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"
#RUBY_S="${PN}-7.4.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres +unicorn systemd"
## 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/cmake
dev-util/ragel
net-libs/nodejs
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )
virtual/krb5
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.5.4
dev-vcs/git
!app-crypt/heimdal"
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-project-name-regex:
# Allow project name to contain non-ASCII characters.
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.8.0-fix-gemfile.patch"
"${PN}-7.7.1-fix-project-name-regex.patch"
"${PN}-6.0.2-fix-sendmail-config.patch"
"${PN}-7.8.0-email-custom-reply_to.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,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:).*|/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; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
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
# 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_newunit "${FILESDIR}/gitlab-sidekiq-7.service" "gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-noslot.init
use unicorn && rcscript=gitlab-unicorn.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 $@"
}