diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog index 08c2bd0..85d621a 100644 --- a/www-apps/gitlab-ce/ChangeLog +++ b/www-apps/gitlab-ce/ChangeLog @@ -1,3 +1,14 @@ + 03 Nov 2016; Manuel Friedli gitlab-ce-9999.ebuild: + www-apps/gitlab-ce: updated ebuild for gitlab-9999 + +*gitlab-ce-8.13.3 (03 Nov 2016) + + 03 Nov 2016; Manuel Friedli + +files/gitlab-8.13.3-sidekiq.init, +files/gitlab-8.13.3-unicorn.init, + +gitlab-ce-8.13.3.ebuild: + www-apps/gitlab-ce: added ebuild for gitlab-ce-8.13.3, also with new init + scripts + 22 Oct 2016; Manuel Friedli gitlab-ce-9999.ebuild: www-apps/gitlab-ce: updated dependencies for gitlab-ce-9999 diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index 82da63c..3d2570d 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -7,6 +7,8 @@ AUX gitlab-8.10.6-sidekiq.service 1085 SHA256 de97287a5cb1d04dd4b6ac96e3569503cf AUX gitlab-8.13.0-sidekiq.init 1012 SHA256 3c4db0b6249036f880ec49c49601e9da4cabc3abfec79296da35df4c145180ef SHA512 7aba7a6a499b924e81528586919a9db1159df15fd91587553cc6d6f34ca273a6e7112a20bf7c6a53b2547d86d56869737f3e6701a834bf4f93916cf176a6edf9 WHIRLPOOL 01adef44f3faeede4ec8b48fb52adf4a72be320755ad9925209f187feb34d9c598fee55202473f060152c80b9932c1e3bb9442dad6400aef42e59e535cd1c8f0 AUX gitlab-8.13.0-sidekiq.service 990 SHA256 183ccbdb19a3dcc74cf1f1f865bf396466e06f7408ff7d3e92359b2a0e83f24c SHA512 c356baf65337739b08a0a4bfe24d3b68f557e9d6d95f479b39ec954ee6c2077e380f99d1e9e9390f5b038e093c0a46562f651512a6578dfa86977580159470a2 WHIRLPOOL 81d9ea9febf47d5fdb9c49a54bbc499bd796fc56bc1c16404fe4c74d00c4bb9fa9631e4cd4cf88d3c30a44c04b74b35a61cd4da9f2139a4abf61e758b4e5949a AUX gitlab-8.13.0-unicorn.init 3141 SHA256 73fc750f671cff94a32218512be07f2f7a353b31fe91f6391a85cef00a863a53 SHA512 e728dc6e2453f5124f347359e6ad592cf171a07540a54ebca68bbc95cbf8ca8c211557156e3e5f0f67df0cfa58e65e1bc6589e99c86eb32706a8dbc9972ff9c4 WHIRLPOOL 3e4a1be447bafd4a609b1f0a786774182c2c2ae01bfd67d4c1c1faa718dab3ae7958f6b8604ba6efd70ca9e8203cdd0f35376afb3775a72c3cf78a1fea112684 +AUX gitlab-8.13.3-sidekiq.init 1443 SHA256 4cde75d91cab4137b09a4800e4e9089e37d977d35388c589c5fe49a3d80a759e SHA512 5079b7df4315ad1416d055ac316525c809a8ce98050e0752021625f4732ca4069a356205b1eac91b1dc46117dee6b1dc5af358962aa76ac3daa622cbc97ea291 WHIRLPOOL 08c3f0fab34b79806acba06e4bd0cef69d9957f7b1074e488dae839c2b8d6ec2b9d9093fafc3f6a350cf691f82b9a8d4524d2170c98cafb28496144e863cb9a9 +AUX gitlab-8.13.3-unicorn.init 3546 SHA256 dbe340397b7b36275e068eb0a945352adc7b625a2f314d7cb161d8a37b764f55 SHA512 c847e21c9da5dd4f8d3c847e659c6eae16c6c3eb23823998282be44a2f50602e54b80ce4f321cd8468050ec293ebc4f39f0e03046f664875514a3255adc5bd16 WHIRLPOOL 111dcad01171fab1ba02abde97e07aa440920cd3fa6466ce45f766f46c81adba5a2dd925b1a0c05184a9e813fcee3491a2b96f8197b762ca0c413aa04688564c AUX gitlab-mailroom.service 773 SHA256 39cea460db7fc505b136a2106902d0515890180e74913bf364aa499368fc5f2e SHA512 f82c63a180add1103e2bd115e67826ad7362a844991ef16f1de7fc6c78bf1955155ecf278fc0d759e674ab85736f3ba2a6650d00e9b3ce683316875efd9efa3c WHIRLPOOL 683c67b12f9666d1c1df5ec61e0072acaecd3aff43d0ff475037e178bc58fd9036ae6d8cd45e922098c842abd057231afd4767ce229d4581356f153b48a06208 AUX gitlab-sidekiq.init 990 SHA256 cc996184ae4c1b64fc5ee9325bf3f4bc30753896f6608a2f04112d8552359c38 SHA512 9064b5a2fb1280c7fd674c613e19893b5b4f21cc48967cad1c3ff6caef2d4cdbf077359c453e5bb97226c26348475a97fb055df2bac991a7260811cb933361af WHIRLPOOL f2a298a91318ee067451e90f8b52b45c2dcf7e621bd7014917f8fadfd92949c967b45c59434eac3813fd1acd1dc96b8b481f9d9c324627580f29c0f438bf99db AUX gitlab-unicorn.init 3127 SHA256 de2f5861bec58eaac284e74baabe25288a520bc4f7da089a2c53a9494bbea884 SHA512 ae63cc6ef11eb1d3ed155c77dab413d8f7d281ac9c6362dfda12e0fafe23eb9a907a0275d14298c642ba7568119b483b1c520b322dc791f3a9ce64fbffb600f3 WHIRLPOOL de69ab338278e73637b6b1d346bb882d51c4468e71d89932718f394fb9f44725c79897eba8b0230069584ae7d8b92239bb2247c7ff8b46a99383739939a13088 @@ -16,9 +18,11 @@ AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c1 DIST gitlab-ce-8.12.0_rc6.tar.gz 26786541 SHA256 41719da8de79093accae302c0cb7082e3e4248ed2413f6cda456051fead1f05c SHA512 e5c6ea64e3fc495c41dfe405325caf3fb34e58416d6cf284805f3e9666b085f4ef58b97e0de04ded4cf658421d8e4b716781f9ce58465410a7a715e72800feaf WHIRLPOOL b29ae1c37f71e4474077f18fe42f07bca213f7cf6faa2f942b615430aa68245a43a6223e430926c1b917debff548fd6d6b8c3f5c6e4e7ddd121878e2c390e9ba DIST gitlab-ce-8.12.7.tar.gz 27110532 SHA256 003e497e23f730f4990bdb4b431109f2956b5bbf1d202a4003f5af65424157d4 SHA512 7ad53f5fe0c88cfcf5688de5d55489964a4b5e8dd763fbf7d832c199432b9532f0a75e6d803f1d03387c86b3ba0b47b1b75b97e783f7661662b656c7f9aea216 WHIRLPOOL 026d11a8adcde5312b46d626bebc6ed33bfea344042deb1fab0a40a52cfd7deccfe78ef2a544293456f08bf7acbd917233533898b54c3b9dcee9121520607ff2 DIST gitlab-ce-8.13.0.tar.gz 27763918 SHA256 0c4736ec84fe371334a0b7feca34eb6a2a371242c2ed0ba356b201de5c5e4a46 SHA512 e08ce15b6b8658d12c20cb7b522607c6c54880c1e2737f48e4a80f5d3fd8efb10f680b3a4a8c975dbc5237eea2b0f5fef185286d1ea3a7786573fa2bbca4149c WHIRLPOOL 91e4dc8732f3df17ffa81d5fa9ec6b0be8a04c956021ac95c859819643da426b5cafef2d1811cbc3507688179f2645839ae64eac6bb1941fc17076977bdff960 +DIST gitlab-ce-8.13.3.tar.gz 27773077 SHA256 040e43517e10782a0f11b3bfc9c349cec9e48e5c10cf8d46c7e468beb7677101 SHA512 3031798e0c56a7a028a544943304ac84e5a427e40d9db40fe75aba215192f493ee4508d6d99f0a5814ac11a52f8db673d03012cae052b3841c3407c6b9fb83a8 WHIRLPOOL 2a78824adda0aa4006facf0c791b6f0be930eb574a38dda6d58db3cd9331238f50caae4e2e6acb7442a3488b3b9c91239a488063377d6b34befc5a3375c94c7d EBUILD gitlab-ce-8.12.0_rc6.ebuild 11943 SHA256 62bcdc0b04fd791be8ecb48529d0c09705a6c843f245dce58f4780b3782f8195 SHA512 8f1cf916b29cc8d8b078ba19658ebd39585eb6d95ed106e8beb64ccdb17bfbe22fcf5af10baa13cc941d0d733cd0ea8f2ee4a9b960459e96c41744a35d6f2c74 WHIRLPOOL 48ce3279bf1f0c5658e726935c01020555f9d1705623ed8e12dd73670a32fa9b316a26aa7ed41786662e363e61f448ef523bb3ea0e65ed2d7653a3cf6ef67fe7 EBUILD gitlab-ce-8.12.7.ebuild 12068 SHA256 5acdce0ee5f3c6cf20a120758ad0c60ec70574d38cc2ee56037b3789d812edfd SHA512 7daf877280f4a8242fa83e1b70d5cabe99aa8bd547d0b4f9a4921c60c44228f508e39a8a4f751b987078c4d680aaff374a055c8ca5882b12f110b232c0006f4e WHIRLPOOL be51f8c53ac45db3c13f179d447665b536df4848a4c63cf5619d2620fbca7bd2701b861f636235d7e746ee7f560eb084e949288f11dceaaef826c138be321625 EBUILD gitlab-ce-8.13.0.ebuild 11859 SHA256 b90393b330f1048ea73536071793f1897d62e14773bc170600abb9ab9dc0fcc0 SHA512 31c32936dbe355dc9dae68bb5b726822a9f5222796dd11dc95b8907fbb2e316930a95568061557328a9d87b5b5eded5867a1a8d552cd9041f10054140d461426 WHIRLPOOL 2ce6cf02c5b27fe70f00795c16fa3d20f369ba820f8583c90808ac5d6c1d838425d447caaad67b76ebc64e6a3f1b6866ac2e890566dc71504056c20103b8ad97 -EBUILD gitlab-ce-9999.ebuild 12071 SHA256 6c265ee4d106ec9315c152a62b33c59c5b40decafc2b16ff0052f30d35a07810 SHA512 04533314f4f8a8b5a9e672267b47ef17020402d06399e515b2eb9a7653c5fc94349a3a4aff32bb22f666b7577a9538c1198edec15f5b026891e4ebf6ba0daffa WHIRLPOOL 9e1c4d2dbcfbd2de03f3cd6731cdd120f72d29ff7581aa40e612f946ec8d0b486d77cb2089706079eedc22792b7f1752f0554256ac9ec8b8241d4877a4fde499 -MISC ChangeLog 9413 SHA256 874a7a307dd11a3dfbcd40d98b4a2c84a72fb7242c41b592de0f35db7d5f67a2 SHA512 27b12b5b99f9a91912ca3fc471ce006ab868423b70a91e2bbd4c8999cce79f728821a77d0f74654ad979f0b7c0cd89a15dce12d81f9f9997666150bd41b1983b WHIRLPOOL e17691cf20178edba80eb75f0ddf8b324d2863f7b9aa128920c0322bc683461da91695924c66018ddef67616b44024426ec8f13c09584f38c90aee36fffc2162 +EBUILD gitlab-ce-8.13.3.ebuild 11979 SHA256 b5a243613dbca1645c70b0b76191172d823a1775372172054c653706261dd1e7 SHA512 9121a34bb8f071395f26d0dbb87fb8bae50f00b8b606c1ced4d43d7e9908c7937fc5bd3d15992b34545206bcbf138e2ab1a593df709904b409ad9041b6a62f9a WHIRLPOOL d7c84308560a28e0222da75acad82cda660770acff43b180d40b35e6395f46adc66afb40ce3ba8c73dd76251e89f72b9dff51bc602c82154a1ea974f693104fa +EBUILD gitlab-ce-9999.ebuild 11913 SHA256 59e03c337984ef9363e1e20777c3057f958c20c97a8ae553fe463933570e22ac SHA512 f681ba98c41296b50a94301a8680951a8529020efd278747ccaa27c410cd92057ea03947d2d9918aa42802843189c6b93e4d19fe04e54f3b029b5a94c3676f79 WHIRLPOOL 5641e173c055027ab1c6800dd2c95297ac2d9007d8210f4f13d1644313086e01e0449c121ce9a9d9b5349a6a91c2db870b92449fb5609e00d7bc1f9cd2bd6a9c +MISC ChangeLog 9814 SHA256 137f0e7e2b8bd9ce555f93bec7a830afbfda8bcd96b962d8aa52d53445e7ed53 SHA512 4cab13cc9abf7ee1429361346da7e539a0417571c6ef60b6c412bbf5e21cfb509dd87fb52ff5400d3e0a24b5baf2da710031c938dbdac100d1be3a18d8b40602 WHIRLPOOL 1f70871451a4a111c85e729828a364e5b8009dbf42d4f283bd206e72b5da9fea15b93575c4f26fb477a812f75a56c12252d8b0116c41e6790b05a562eee7f27a MISC metadata.xml 559 SHA256 6c3f48d3ef57c97bf27790f33ee04bd8de8b01597caa8a2a7a473d6d0a3c5759 SHA512 5aa340b5429795d84cd106ee673fd55a42fd4b0d3299d6b95c6a3e3d50812a9620820a4de5c57d5048af0c3ecec7f575d5856d2f7fadc210aadcbdd4dd040fe1 WHIRLPOOL f3d7b8c0522e09f5156e6bb446bb74e4c75f5da4495ca2ece1eb78afce59307abe01bf3c5dd5344278fcac9e334300d912031c806f51b981591c01bc3588c6f3 diff --git a/www-apps/gitlab-ce/files/gitlab-8.13.3-sidekiq.init b/www-apps/gitlab-ce/files/gitlab-8.13.3-sidekiq.init new file mode 100644 index 0000000..26e2500 --- /dev/null +++ b/www-apps/gitlab-ce/files/gitlab-8.13.3-sidekiq.init @@ -0,0 +1,62 @@ +#!/sbin/openrc-run + +extra_started_commands="check" + +name="GitLab Sidekiq" +description="Sidekiq for GitLab" +description_check="Runs sanity checks" + +: ${gitlab_user:=@USER@} +: ${gitlab_base:="@GITLAB_BASE@"} +: ${rails_env:=production} + +: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"} +: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"} +: ${sidekiq_config:="/etc/gitlab/sidekiq_queues.yml"} + +sidekiq_command="/usr/bin/bundle" +sidekiq_command_args="exec sidekiq -C ${sidekiq_config} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}" + +check_command="sudo -u ${gitlab_user} -H /usr/bin/bundle" +check_command_args1="exec rake gitlab:env:info RAILS_ENV=${rails_env}" +check_command_args2="exec rake gitlab:check RAILS_ENV=${rails_env}" + +depend() { + need redis gitlab-workhorse + 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 $? +} + +check() { + ebegin "Running sanity checks for ${name}" + + ${check_command} ${check_command_aregs1} + + eend $? + + ${check_command} ${check_command_aregs2} + + eend$? +} diff --git a/www-apps/gitlab-ce/files/gitlab-8.13.3-unicorn.init b/www-apps/gitlab-ce/files/gitlab-8.13.3-unicorn.init new file mode 100644 index 0000000..559d0e2 --- /dev/null +++ b/www-apps/gitlab-ce/files/gitlab-8.13.3-unicorn.init @@ -0,0 +1,139 @@ +#!/sbin/openrc-run + +extra_started_commands="restartsidekiq check" + +name="GitLab" +description="GitLab on Unicorns" +description_restartsidekiq="Restarts Sidekiq only" +description_check="Runs sanity checks" + +: ${gitlab_user:=@USER@} +: ${gitlab_base:="@GITLAB_BASE@"} +: ${rails_env:=production} + +: ${server_pidfile:="/run/gitlab/unicorn.pid"} + +: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"} +: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"} +: ${sidekiq_config:="/etc/gitlab/sidekiq_queues.yml"} + +: ${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 -C ${sidekiq_config} -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" + +check_command="sudo -u ${gitlab_user} -H /usr/bin/bundle" +check_command_args1="exec rake gitlab:env:info RAILS_ENV=${rails_env}" +check_command_args2="exec rake gitlab:check RAILS_ENV=${rails_env}" + +depend() { + provide gitlab + need redis gitlab-workhorse + use net +} + +start() { + ebegin "Starting ${name} - Unicorn servers" + + checkpath -d -o ${gitlab_user} -m755 "$(dirname "${server_pidfile}")" + checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")" + + start-stop-daemon --start \ + --chdir "${gitlab_base}" \ + --user=${gitlab_user} \ + --pidfile="${server_pidfile}" \ + --env RAILS_ENV=${rails_env} \ + --exec ${server_command} -- ${server_command_args} + eend $? + + 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 $? + + 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}" -m \ + --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} \ + --exec ${sidekiq_command} + eend $? + + ebegin "Stopping ${name} - Unicorn servers" + start-stop-daemon --stop \ + --signal QUIT \ + --pidfile=${server_pidfile} \ + --exec ${server_command} + eend $? +} + +restartsidekiq() { + ebegin "Restarting ${name} - Sidekiq: Stopping" + start-stop-daemon --stop \ + --pidfile=${sidekiq_pidfile} \ + --exec ${sidekiq_command} \ + --progress \ + --retry 180 + + eend $? + + 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 $? +} + +check() { + ebegin "Running sanity checks for ${name}" + + ${check_command} ${check_command_aregs1} + + eend $? + + ${check_command} ${check_command_aregs2} + + eend$? +} diff --git a/www-apps/gitlab-ce/gitlab-ce-8.13.3.ebuild b/www-apps/gitlab-ce/gitlab-ce-8.13.3.ebuild new file mode 100644 index 0000000..5225c23 --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-8.13.3.ebuild @@ -0,0 +1,391 @@ +# Copyright 1999-2016 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 ruby23" + +inherit eutils ruby-ng user systemd + +MY_PV="v${PV/_/-}" +MY_GIT_COMMIT="8d79ab3a090ee0a43659121b858692791be52cf8" + +DESCRIPTION="GitLab is a free project and repository management application" +HOMEPAGE="https://about.gitlab.com/" +SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz" +RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}" + +RESTRICT="mirror" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm ~arm64" +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" +COMMON_DEPEND=" + ${GEMS_DEPEND} + ~dev-vcs/gitlab-shell-3.6.6 + >=dev-vcs/git-2.7.4 + ~dev-vcs/gitlab-workhorse-0.8.5 + kerberos? ( !app-crypt/heimdal ) + rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )" +DEPEND=" + ${CDEPEND} + ${COMMON_DEPEND}" +RDEPEND=" + ${COMMON_DEPEND} + >=dev-db/redis-2.8 + virtual/mta + systemd? ( sys-apps/systemd:0= )" +ruby_add_bdepend " + virtual/rubygems + >=dev-ruby/bundler-1.0" + +# +# fix-sendmail-config: +# Fix default settings to work with ssmtp that doesn't know '-t' argument. +# fix-redis-config-path: +# Point to the absolute location of redis_config.rb +# +RUBY_PATCHES=( + "01-${PN}-8.7.5-fix-sendmail-config.patch" + "02-${PN}-8.11.0-fix-redis-config-path.patch" + "03-${PN}-8.12.7-database.yml.patch" + "04-${PN}-8.12.7-fix-check-task.patch" + "05-${PN}-8.12.7-replace-sys-filesystem.patch" +) + +MY_NAME="gitlab" +MY_USER="git" # should be same as in gitlab-shell + +DEST_DIR="/opt/${MY_NAME}" +CONF_DIR="/etc/${MY_NAME}" +LOGS_DIR="/var/log/${MY_NAME}" +TEMP_DIR="/var/tmp/${MY_NAME}" + +all_ruby_prepare() { + # fix paths + local satellites_path="${TEMP_DIR}/repo_satellites" + local repos_path=/var/lib/git/repositories + local shell_path=/usr/share/gitlab-shell + 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} + + 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" + + einfo "Cleaning old gems ..." + ${RUBY} /usr/bin/bundle clean + + # clean gems cache + rm -Rf vendor/bundle/ruby/*/cache + rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git + + ## RC script ## + + if use systemd ; then + ewarn "Beware: systemd support has not been tested, use at your own risk!" + systemd_newunit "${FILESDIR}/gitlab-8.13.0-sidekiq.service" "gitlab-sidekiq.service" + systemd_dounit "${FILESDIR}/gitlab-unicorn.service" + systemd_dounit "${FILESDIR}/gitlab-workhorse.service" + systemd_dounit "${FILESDIR}/gitlab-mailroom.service" + systemd_dotmpfilesd "${FILESDIR}/gitlab.conf" + else + local rcscript=gitlab-8.13.3-sidekiq.init + use unicorn && rcscript=gitlab-8.13.3-unicorn.init + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@USER@|${MY_USER}|" \ + -e "s|@GITLAB_BASE@|${dest}|" \ + -e "s|@LOGS_DIR@|${logs}|" \ + "${T}/${rcscript}" \ + || die "failed to filter ${rcscript}" + + newinitd "${T}/${rcscript}" "${MY_NAME}" + fi + + # fix permissions + fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs} +} + +pkg_postinst() { + elog "If this is an update from a previous version, stop your GitLab" + elog "instance and issue the following command to perform all required" + elog "migrations:" + elog " emerge --config \"=${CATEGORY}/${PF}\"" + elog "PLEASE NOTE: It's HIGHLY recommended to backup your database" + elog "before running the config phase. Run these commands (as root):" + elog + elog " cd /opt/gitlab" + elog " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production" + elog + elog "If this was a fresh install, follow these steps:" + elog + elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml." + elog + elog "2. Configure your database settings in ${CONF_DIR}/database.yml" + elog " for \"production\" environment." + elog + elog "3. Then you should create a database for your GitLab instance, if you" + elog " haven't done so already." + elog + if use postgres; then + elog "If you have local PostgreSQL running, just copy&run:" + elog " su postgres" + elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\" + elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" + elog " createdb -E UTF-8 -O gitlab gitlabhq_production" + elog " Note: You should change your password to something more random..." + elog + fi + elog "4. Finally execute the following command to initialize the environment:" + elog " emerge --config \"=${CATEGORY}/${PF}\"" + elog " Note: Do not forget to start Redis server first!" + elog + elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and" + elog "you can't login after the upgrade, be sure to read the section about the" + elog "verification of the CSRF token in GitLab's trouble-shooting guide at" + elog "http://goo.gl/5XGRGv." + if use postgres; then + elog "Please note: As of GitLab 8.6, users of PostgreSQL need to enable the" + elog "`pg_trgm` extension by running the following command as a PostgreSQL" + elog "super user for *every* GitLab database:" + elog " CREATE EXTENSION IF NOT EXISTS pg_trgm;" + elog "For details, see the documentation at the GitLab website." + fi +} + +pkg_config() { + einfo "Checking configuration files" + + if [ ! -r "${CONF_DIR}/database.yml" ]; then + eerror "Copy ${CONF_DIR}/database.yml.* to" + eerror "${CONF_DIR}/database.yml and edit this file in order to configure your" + eerror "database settings for \"production\" environment."; die + fi + + local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)" + local git_home="$(egethome ${MY_USER})" + + # configure Git global settings + if [ ! -e "${git_home}/.gitconfig" ]; then + einfo "Setting git user" + su -l ${MY_USER} -c " + git config --global user.email '${email_from}'; + git config --global user.name 'GitLab'" \ + || die "failed to setup git name and email" + fi + + su -l ${MY_USER} -c "git config --global repack.writeBitmaps true" + + # determine whether this is an update or a fresh install. we do this by + # checking whether the ${DEST_DIR}/.git directory exists or not + # + if [ -d "${DEST_DIR}/.git" ]; then + local update=true + else + local update=false + fi + + ## Initialize app ## + + local RAILS_ENV="production" + local RUBY=${RUBY:-/usr/bin/ruby} + local BUNDLE="${RUBY} /usr/bin/bundle" + + # FIXME: this line existed in older ebuilds, but the variable is + # never used. what was it for!? + # local dbname="$(ryaml ${CONF_DIR}/database.yml production database)" + + if [ "${update}" = 'true' ]; then + einfo "Migrating database ..." + exec_rake db:migrate + + # https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496 + einfo "Migrating iids ..." + exec_rake migrate_iids + + einfo "Cleaning old precompiled assets ..." + exec_rake assets:clean + + einfo "Cleaning cache ..." + exec_rake cache:clear + else + # create dummy git repo as workaround for + # https://github.com/bundler/bundler/issues/2039 + einfo "Initializing dummy git repository to avoid false errors from bundler" + su -l ${MY_USER} -c " + cd ${DEST_DIR} + git init + git add README.md + git commit -m 'Dummy repository'" >/dev/null + + einfo "Initializing database ..." + exec_rake gitlab:setup + 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 + elog + elog "If you want to make sure that the install/upgrade was successful, start" + elog "Gitlab now and then run these commands (as root):" + elog + elog " cd /opt/gitlab" + elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production" + elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production" + elog + if ! use systemd ; then + elog "You may also run" + elog " /etc/init.d/gitlab check" + elog " for convenience." + fi +} + +ryaml() { + ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@" +} + +exec_rake() { + local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}" + + 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 $@" +} diff --git a/www-apps/gitlab-ce/gitlab-ce-9999.ebuild b/www-apps/gitlab-ce/gitlab-ce-9999.ebuild index 83313cf..62cf978 100644 --- a/www-apps/gitlab-ce/gitlab-ce-9999.ebuild +++ b/www-apps/gitlab-ce/gitlab-ce-9999.ebuild @@ -78,7 +78,7 @@ ruby_add_bdepend " RUBY_PATCHES=( "01-${PN}-8.7.5-fix-sendmail-config.patch" "02-${PN}-8.11.0-fix-redis-config-path.patch" - "03-${PN}-8.12.7-fix-database.yml.patch" + "03-${PN}-8.12.7-database.yml.patch" "04-${PN}-8.12.7-fix-check-task.patch" "05-${PN}-8.12.7-replace-sys-filesystem.patch" ) @@ -91,10 +91,6 @@ 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/master/bin/background_jobs -SIDEKIQ_QUEUES="post_receive,mailers,archive_repo,system_hook,project_web_hook,gitlab_shell,incoming_email,runner,common,default" - all_ruby_unpack() { git-r3_fetch git-r3_checkout @@ -222,8 +218,8 @@ all_ruby_install() { systemd_dounit "${FILESDIR}/gitlab-mailroom.service" systemd_dotmpfilesd "${FILESDIR}/gitlab.conf" else - local rcscript=gitlab-8.13.0-sidekiq.init - use unicorn && rcscript=gitlab-8.13.0-unicorn.init + local rcscript=gitlab-8.13.3-sidekiq.init + use unicorn && rcscript=gitlab-8.13.3-unicorn.init cp "${FILESDIR}/${rcscript}" "${T}" || die sed -i \ @@ -375,6 +371,11 @@ pkg_config() { elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production" elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production" elog + if ! use systemd ; then + elog "You may also run" + elog " /etc/init.d/gitlab check" + elog " for convenience." + fi } ryaml() {