Merge branch 'master' into feature/rename-gitlabhq-to-gitlab-ce

This commit is contained in:
Manuel Friedli 2015-10-23 15:01:52 +02:00
commit 1ecc48e02e
6 changed files with 493 additions and 2 deletions

View File

@ -1,12 +1,14 @@
AUX gitlab-ce-7.13.1-fix-gemfile.patch 1478 SHA256 99050e17841670f03e9430e1f0409cb0194b49ef3235b90c13a4bd66a2648ad6 SHA512 9b0ef71867d4049970295f1ac015e3a4917a24c61edab3452f75f9652e21b94f3dd859247bb28622cd032fe33d4ebcec7b262488841540b48e387f11399c9a8b WHIRLPOOL 9db14e3339e1038dbaff9344f3472c6e23209fa6edbeca35c3108723fd39cb93420361ffdade21fc7019a1e873283524db6e38868ee247ca11a5814832083aa0
AUX gitlab-ce-8.0.2-fix-gemfile.patch 1586 SHA256 c91945e0e639b1297519d7165a3aa03fe203a29cde1d195f277be6cba71c67e1 SHA512 6eb15935292902b3090e856e00a972ee2e442eadbf2e42fbde1e4727d75d65e0e06c6be54be8fcd7aeebb5e0616c8d5123f60ebabebd7e02531f0fbc7b03d760 WHIRLPOOL 985e86c5bcb1ea059b41f1f08d3528afd3ab31d71eb81df79a2b454a0e2fb24dbf08b4a1c9197e56864550842baa60599db631bbd2a3603caaea9b7d6743e3d1
AUX gitlab-ce-8.1.0-fix-gemfile.patch 1585 SHA256 5e5a17fe241547f79e9992a43dc87c2be09ef5021072002c5172f9bc84858ab6 SHA512 f7de8760a1da1d8829b8b481fe0dafe0c379476406d2e0eac92b3085d4a95bbaa75124e592e724dd78add6cc603c3622ddffed6a337ac93ed510ec96045d7345 WHIRLPOOL 3dde3a4aad28d70cfcc3f379e6c3e29aa86fb508e18e01722877cb1d842ee8580d1a74ed6d2325f8790e27e38bb7b5ffc50adc265337e1557156c9806314a750
AUX gitlab-ce-9999-fix-gemfile.patch 1585 SHA256 5e5a17fe241547f79e9992a43dc87c2be09ef5021072002c5172f9bc84858ab6 SHA512 f7de8760a1da1d8829b8b481fe0dafe0c379476406d2e0eac92b3085d4a95bbaa75124e592e724dd78add6cc603c3622ddffed6a337ac93ed510ec96045d7345 WHIRLPOOL 3dde3a4aad28d70cfcc3f379e6c3e29aa86fb508e18e01722877cb1d842ee8580d1a74ed6d2325f8790e27e38bb7b5ffc50adc265337e1557156c9806314a750
AUX gitlab-ce-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
AUX gitlab-git-http.service 972 SHA256 752e1b62a6c182d69b097788d4c21672655af92f150aa5ee416efab67c869f28 SHA512 ba6feefd2741fe97c176e00fbbb802fb4bfc9fc71b2d584c3ad44a312f2b01c9fe92d268d26ab18cb9372ad8616a5ca1554f2895297a17d35f6818bd27b8244b WHIRLPOOL c7c7fa598f2bae6f736a5f84aa3e737dd3b3bce8803128b0b17a8375e4e0c528b95bcd88b959c5bb9bd5ca1fd73330170be6fe2680c1a14702073d3c1c15f265
AUX gitlab-mailroom.service 773 SHA256 39cea460db7fc505b136a2106902d0515890180e74913bf364aa499368fc5f2e SHA512 f82c63a180add1103e2bd115e67826ad7362a844991ef16f1de7fc6c78bf1955155ecf278fc0d759e674ab85736f3ba2a6650d00e9b3ce683316875efd9efa3c WHIRLPOOL 683c67b12f9666d1c1df5ec61e0072acaecd3aff43d0ff475037e178bc58fd9036ae6d8cd45e922098c842abd057231afd4767ce229d4581356f153b48a06208
AUX gitlab-sidekiq-8.init 995 SHA256 179f8f9267f8358827c4c70697bf27dac728451ac7b9dbe0637d397850260fc2 SHA512 fca6c3b86788113f50120ada81859535bcdd3524ebf79e495c532049a5e1cb09b44499268b22610707ea4763bd6b380fe8abfad10520cd17b03802264c34f0bc WHIRLPOOL edc9c083447662bebdde5b0bbb97816f15a3122aa5cae966d1df805aac5a81e51a608cb5447283bda222af3bd28519b653a6ca6b34d1eef84abc37fd719e5955
AUX gitlab-sidekiq.init 972 SHA256 614b405d16e2042d013dae510796620d42461512705fad2a90a7f558e0051c33 SHA512 afd3837ae660d47297c6d65180ae5f3ec6a15c1c8ea23aa5b715ca2fc5b628f3d868adf265c16521e940e5aeb53e4a70a2ec6c0acfacb6b39a1fb5bc669672fd WHIRLPOOL 434ae6e789fc8894a9c83bd538de804784c23072129c79fe0c209848e0c8e1a3d607ce9f7f9da617a25c874ce81d276d010d5ae2d3bf95e25034e9048cbd747a
AUX gitlab-sidekiq.service 1066 SHA256 b9a15ee7498cc5ebecfd51a037ab1e32e66723a1612d5ce9365eefd890b5670e SHA512 33ece22389637b7b4591f4dceedb488fb43a92ca47facb19432f87772bbbf1774d4fb737ace52a6d55533c9e291e343dc56971c6f70fed285a10429d6d97d318 WHIRLPOOL b5a81751b8317bb9244018f9ed82f9793734adbad9983c244429a33d710169eeeed25cdf868d724032866d83bb9676ccbbf616b53363491e15a80e474443f331
AUX gitlab-unicorn-8.init 1680 SHA256 c74c6db7c7bbce85df66648e20c11215917041577733454c6590dff3aacf7362 SHA512 44461e070b19abb1ddfa297aa995b04412cd367fb252591a7faf871f958e78c92955c78ba51137fcd1933dce896a9d05efdf06cabbf2cbe86e138fb12ead1bdb WHIRLPOOL 313548a006a3431e8116edbf3d0ce8613a9e65e3725ba4fb3683e95ebf2b2afac3801900d372839e6dc9a0004d805b98889c47292e8622e918c73a3a5e2fc0de
AUX gitlab-unicorn-8.init 2556 SHA256 60c9e22f50641020702a8945b5d86ab016b567acd7343aa4ab0f8c97b26b5ca0 SHA512 83bd97aba27ee06bd179a76be565116ab794de029278d1e3cb749b9e3d49d38413a668c12c5972362cc87413d87840d026801fc6717241117f9a54abb16444d1 WHIRLPOOL 78e02983ec8ec7f2e37366910e1d1d813bd90f3c32c43dddd12b78442ba3e584463d019347bde99e6e57814e9af631cc1c20e1333a5bbc876037f10e3bef8b64
AUX gitlab-unicorn.init 1657 SHA256 5fe794938b27d25488affc174e4761f5a3a1f9b15489a05f3839b13e4fd5b5ef SHA512 5e005ec26151afb4cdc8eb83592fad6814bb2a3ac8e9f642de83e70cd8615bdf969803a2479f8f72a70e0ae5ab5559da205965b55b3b4cdfdc9aa74055eef6fe WHIRLPOOL 6c61db597311ac618822fb22d7f51c830e5c011ce8e4c790338b3203a4483f3dd121bbd9cc33d7e1f92a2b0527e59816742f8ef0fd531c4c28c36d886fc94196
AUX gitlab-unicorn.service 773 SHA256 010c9e223a30400d9155b39499eb0d7efad23b66baab9fcd9e365c689086b9bd SHA512 0bf9630aa91ed8f590a7bfa42d09b7ba33f6342b43b3d191c792c11157f8926c2a2ac2390eebd8179637e29b5bf68233d4699d62463497a0fd45b9bdbdd9167b WHIRLPOOL fbc709a5550dcc548a35c22c812dafe52ee507f5678b57c22c709ee89a399ae9109e2f56b7a13135d4140f1e024ebc4effe4aa4de13e0f36691da2a0737d9792
AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c101f43ca263 SHA512 909c49fee6d050c1e94b2559ff2a9d54c5c346492be0e2920b50d56d69eaddbed67e3ac12e012d2a9601b5596640ebf33c8dc68fc588a03ca370d963294be37f WHIRLPOOL fa436e8d7d2643d450259d26b6e7b24dae69df47ed22e5ef2a567f37aa785fbf3b0eb1129ae7c8bf8986c29559fc3b744a34064375e5245dce2b10053cd715d9
@ -15,11 +17,13 @@ DIST gitlab-ce-8.0.2.tar.gz 8238940 SHA256 e17a889f33c85b86744ea7be7cabb69feb340
DIST gitlab-ce-8.0.3.tar.gz 8238927 SHA256 b299b100f8963f86aaeab01ad4ba49ac034cf77e803cff0fa710065e3464a049 SHA512 e247b3677ca86f43e665623c3a2602ab33843860537813fa64e3cd33b408698f0482e1ce437a4a30976b0656977f86890173ca044b7d07bfdfda3d269d311802 WHIRLPOOL 710f473d8b6c06fff9e72258102653f24035d5533f257d2d6d842ae0598fb048c6e76f9706e3662a93a9d1ec34ef67a67686fdee7439fb776de686eae19120ea
DIST gitlab-ce-8.0.4.tar.gz 8238901 SHA256 644b4bc98907bb171a1281ae73ac510f1bc6d379d39020f61e1697bb73547ae8 SHA512 41d4e8088221beb4aab731cf0ddccba0be2e4746ece0e33f92ec5488a4ed759f1e18788efed2351f5a643c31f47b4138a33077313b27e4e4567c9e9ad8dc79e5 WHIRLPOOL 08157b0f82150a5245cb2985b704026dab5f6342ab9e080c3149850ea37be5482d2dfc330a8d441957c1d8383528d3e65eb41c70ccfbb4a49e4a442f6f24a56e
DIST gitlab-ce-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d31449136e76029daa77e89086539d30c6 SHA512 af9d11f0ed744d0c92c9329ba94fe51534996f18dbb2c110d70912cd3ce9e60c3a127b7c8597c95b010b0e2251f98aabdddc314ddae53ab26a44c19b4ba7a7d7 WHIRLPOOL 6e4bc8c43cbfe215efd21a87a5d0395abde4f9998564fc0295d946ffa6a7021d2b5bc2ea625482fb400088bcc57431b3969a6c9dfa0f2121420356d153d297f0
DIST gitlab-ce-8.1.0.tar.gz 8503954 SHA256 f02e599436737b803482f4554abedd743e2f53c8c610e46115f71682da46276a SHA512 40f984a95f679f7695663e1118b119883a466ef0c65ee5aa4eac5053945a4111243c3aecc6181e0b1acf33c4df446ed7169a2e760a2b48596f314967bb3bff5b WHIRLPOOL ef2d418f167623cd17d2b4773d6cdab5f94d693ae4c785b7a621461b330908a680fb2bb4d720ef6ed1de3d80b1aea2e6a612146f9719f248c38e5588132d52dc
EBUILD gitlab-ce-7.14.3.ebuild 11065 SHA256 7467db73bb02a797716ee404a2c0ea8cf64b1839ec322c2f07f668ba5702da4c SHA512 d1884e08c7cd3013b4962a2453a6120391bbc3dc44fc24bb83134e2d99a5fadfbfa3942fb74c64efa617f7480de1674a3c82aaab8fe4ab7a8fbb7016188d29c1 WHIRLPOOL 5027632c4bd2f4ba4c6d55bd222aa1322751d245571b6b8b6f9bc394fcc7e7f42ac5455cf3d7a2b6a0bbc624f9c7e286e94b101686ff4e1656dc79169d750f9c
EBUILD gitlab-ce-8.0.2.ebuild 11138 SHA256 818e9255e49d922368e4d34b384a1d67825c59de5c7fa3ae453f4932b1107e15 SHA512 d2bcbc3cfca80042b178ca59ed5c73c3361f2e9dc0a23b76f6356c1d412b279df207a86ea06b25ef677918361429e8fb02779ec5f9399ca7c2a7fa9c39d26bae WHIRLPOOL a7812739fef390dec2583acc0c1cc50b0d32d105c0e490b59cc2b7a6878fdadc179895a16eb4642c8dd466cbe1ecbe986fc2e4c85d254501515c3355f450ebdc
EBUILD gitlab-ce-8.0.3.ebuild 11145 SHA256 74baf14d65ff3a898f033356d2b1877a85c275ca0a46fe1fb5ac02e64aa923d7 SHA512 167cdf0189e1654f40db128f460286e20af2f55baa566b13ef97ba0c9bb2e2fc0edf694468e18320306e3e85d14831e11def094f0d9eff4e3c28e50a8dd3c508 WHIRLPOOL 1179dc8bd4e092156d46e9d489777ad71da803da760100526908e80e17b66004832f77ac287aa610e05047d7702f2c1ccf2803ce4b360f88340358415e1f7e79
EBUILD gitlab-ce-8.0.4-r1.ebuild 11221 SHA256 af33dfb570403c56fc940e8f8eb74ef7def9f8ef52d74ae313a79498fe4fcc30 SHA512 38f6cb2b4cb309ddcec73373f41b456a3175c2a5112a818d6bce5c7f1e7e0982adfb53c67d24a6f38f562f6ed247b51a4a9b567ef3a5450d6a47c5011afc104f WHIRLPOOL b6177fde2402cd5525a2f7daa72ada600054bc2816acbf05b4b9d25176d04388bb8ca89ca793d55e52103b0ae38fa9d35024fb3448c115997e45526c09eee5ac
EBUILD gitlab-ce-8.0.4.ebuild 11145 SHA256 74baf14d65ff3a898f033356d2b1877a85c275ca0a46fe1fb5ac02e64aa923d7 SHA512 167cdf0189e1654f40db128f460286e20af2f55baa566b13ef97ba0c9bb2e2fc0edf694468e18320306e3e85d14831e11def094f0d9eff4e3c28e50a8dd3c508 WHIRLPOOL 1179dc8bd4e092156d46e9d489777ad71da803da760100526908e80e17b66004832f77ac287aa610e05047d7702f2c1ccf2803ce4b360f88340358415e1f7e79
EBUILD gitlab-ce-8.0.5.ebuild 11208 SHA256 41cc56507cf3ecc386f397738c4ebe5cac13b6f1e099e00985b9a7959ee08586 SHA512 ffb6c749309c35aae8e04ad553815d9dda324da4d6bc9678e08936f255601658d3977235a815fbea12bcb9c269be98a807f22f32d4bae9e85a2d500f6b771982 WHIRLPOOL 2c7964e82bad883e0ce7f08eea6dc9d84c63a6b5b9a76b412dab78ce1726992812c6376bf02541c02728817a42c71167869595fb73370e914b303faad1ab1568
EBUILD gitlab-ce-8.0.5.ebuild 11263 SHA256 003c0febc6086e3eab7c9434269f3993d4d7d25aa88073e27ad9012c0af3094d SHA512 23ef13e579f977ae5dcc283a026cfa1df7e47a36911480aa7e50e1a23d3c73977e4409cfe0aff8859e4eebe38c8ff28b46b5b23491136ba384c0c51b086a900d WHIRLPOOL 7f8ef16ac184699f4cb83258e1b0b304b648c7f15250e8832b9b6efd423a78ab5752ae331e6c611179b9d8b90aece0730e3e103635a0c486cf72150df5c7e0ef
EBUILD gitlab-ce-8.1.0.ebuild 11179 SHA256 f26d0655d2b69866961c8dbb25fdf0b7963073de7c93a8852cf6f683b03a1f03 SHA512 887e450adef7000219926fd3d5653a279faeb1c2f48227db652fc3f0b0cb30d337ab64a39f3d8e0154e5d5d3fb354ab8ba7c14942805042c467385d64e5d9299 WHIRLPOOL eb00cf64fd51a7f6e9df11da335c85894bcb95d4c33b034b31356834d9404708d1d78e9b84cced88f4e1bbe2e4c92144d66b597f31fe3c63483b05f89bb57889
EBUILD gitlab-ce-9999.ebuild 11080 SHA256 f20e17e6f5edc646d6773dea7d303007c4461a9aad82e58e7db0a0d17675037e SHA512 4272e495637acca385055c8aa5b685d6e35fd1b560bb4cf2385dc87a71236150ac567da3a601ff85aad1c7f949096c4bada2493027e1cec44127b84da92bdd8b WHIRLPOOL a9b4d67c55968e2755b04ed55d56e212a81ccdfc676b764ca328c7ee56f5309cb2ffeeff01a42cde617da51e6b0d691efcfc33102953be489a093e2a612e22ff
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View File

@ -0,0 +1,56 @@
diff --git a/Gemfile b/Gemfile
index 9254ce2..94acb3d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -174,6 +174,9 @@ gem "underscore-rails", "~> 1.4.4"
# Sanitize user input
gem "sanitize", '~> 2.0'
+# The newer revision of charlock_holmes that is finally fixed to be compatible with Gentoo
+gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
+
# Protect against bruteforcing
gem "rack-attack", '~> 4.3.0'
@@ -183,9 +186,6 @@ gem 'ace-rails-ap', '~> 2.0.1'
# Keyboard shortcuts
gem 'mousetrap-rails', '~> 1.4.6'
-# Detect and convert string character encoding
-gem 'charlock_holmes', '~> 0.6.9.4'
-
gem "sass-rails", '~> 4.0.5'
gem "coffee-rails", '~> 4.1.0'
gem "uglifier", '~> 2.7.2'
diff --git a/Gemfile.lock b/Gemfile.lock
index 5312289..586bd90 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,10 @@
+GIT
+ remote: https://github.com/brianmario/charlock_holmes.git
+ revision: dde194609b3513b0d2369ce8f916ae52566154b4
+ ref: dde194609b3513b0d2369ce8f916ae52566154b4
+ specs:
+ charlock_holmes (0.6.9.4)
+
GEM
remote: https://rubygems.org/
specs:
@@ -108,7 +115,6 @@ GEM
json (>= 1.7)
celluloid (0.16.0)
timers (~> 4.0.0)
- charlock_holmes (0.6.9.4)
chunky_png (1.3.4)
cliver (0.3.2)
coderay (1.1.0)
@@ -800,7 +806,7 @@ DEPENDENCIES
capybara (~> 2.4.0)
capybara-screenshot (~> 1.0.0)
carrierwave (~> 0.9.0)
- charlock_holmes (~> 0.6.9.4)
+ charlock_holmes!
coffee-rails (~> 4.1.0)
colored (~> 1.2)
colorize (~> 0.5.8)

View File

@ -0,0 +1,28 @@
#####################################################
#
# GitLab version : 8.x - 8.x
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
#
####################################################
[Unit]
Description=Gitlab mailroom Worker
Requires=gitlab-unicorn.service
Wants=gitlab-unicorn.service
After=gitlab-unicorn.service
[Service]
User=git
Environment=RAILS_ENV=production
WorkingDirectory=/opt/gitlab
SyslogIdentifier=gitlab-mailroom
PIDFile=/run/gitlab/gitlab-mailroom.pid
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/gitlab/bin/mail_room start
ExecStop=/opt/gitlab/bin/mail_room stop
[Install]
WantedBy=multi-user.target

View File

@ -13,12 +13,19 @@ description="GitLab on Unicorns"
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
: ${sidekiq_queues:="@QUEUES@"}
: ${mail_room_pidfile:="/run/gitlab/mail_room.pid"}
: ${mail_room_logfile:="/var/log/gitlab/mail_room.log"}
: ${mail_room_config:="/etc/gitlab/mail_room.yml"}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_command_args="exec sidekiq -q ${sidekiq_queues//,/ -q } -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
mail_room_command="/usr/bin/bundle"
mail_room_command_args="exec mail_room -q -c ${mail_room_config} >> ${mail_room_logfile} 2>&1"
depend() {
provide gitlab
need redis
@ -49,9 +56,32 @@ start() {
--env RAILS_ENV=${rails_env} \
--exec ${sidekiq_command} -- ${sidekiq_command_args}
eend $?
if [ -e /etc/default/gitlab ]; then
. /etc/default/gitlab
if [ "${mail_room_enabled}" == "true" ]; then
ebegin "Starting ${name} - mail_room"
start-stop-daemon --start \
--background --quiet \
--chdir "${gitlab_base}" \
--user=${gitlab_user} \
--pidfile="${mail_room_pidfile}" \
--env RAILS_ENV=${rails_env} \
--exec ${mail_room_command} -- ${mail_room_command_args}
eend $?
fi
fi
}
stop() {
ebegin "Stopping ${name} - mail_room"
start-stop-daemon --stop \
--signal QUIT \
--pidfile=${mail_room_pidfile} \
--exec ${mail_room_command}
eend $?
ebegin "Stopping ${name} - Sidekiq"
start-stop-daemon --stop \
--pidfile=${sidekiq_pidfile} \

View File

@ -211,6 +211,7 @@ all_ruby_install() {
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dounit "${FILESDIR}/gitlab-git-http.service"
systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-8.init

View File

@ -0,0 +1,372 @@
# 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
MY_PKGNAME="gitlabhq"
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://about.gitlab.com/"
SRC_URI="https://github.com/${MY_PKGNAME}/${MY_PKGNAME}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RUBY_S="${MY_PKGNAME}-${PV}"
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.3.0
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=(
"${P}-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_dounit "${FILESDIR}/gitlab-mailroom.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 $@"
}