www-apps/gitlab-ce:

Add ebuild for gitlab-ce-9.3.5

Package-Manager: Portage-2.3.6, Repoman-2.3.1
This commit is contained in:
Manuel Friedli 2017-07-08 17:28:13 +02:00
parent 8efa7d7d6f
commit f75090e5da
5 changed files with 634 additions and 1 deletions

View file

@ -1,3 +1,10 @@
*gitlab-ce-9.3.5 (08 Jul 2017)
08 Jul 2017; Manuel Friedli <manuel@fritteli.ch>
+files/gitlab-9.3.5-sidekiq.init, +files/gitlab-9.3.5-unicorn.init,
+gitlab-ce-9.3.5.ebuild:
www-apps/gitlab-ce: Add ebuild for gitlab-ce-9.3.5
*gitlab-ce-9.2.7 (08 Jul 2017)
08 Jul 2017; Manuel Friedli <manuel@fritteli.ch> +gitlab-ce-9.2.7.ebuild,

View file

@ -13,6 +13,8 @@ AUX 06-gitlab-ce-8.17.0-fix-webpack-config.patch 614 SHA256 0c1cdc25032322eff6c2
AUX gitlab-8.13.0-sidekiq.service 990 SHA256 183ccbdb19a3dcc74cf1f1f865bf396466e06f7408ff7d3e92359b2a0e83f24c SHA512 c356baf65337739b08a0a4bfe24d3b68f557e9d6d95f479b39ec954ee6c2077e380f99d1e9e9390f5b038e093c0a46562f651512a6578dfa86977580159470a2 WHIRLPOOL 81d9ea9febf47d5fdb9c49a54bbc499bd796fc56bc1c16404fe4c74d00c4bb9fa9631e4cd4cf88d3c30a44c04b74b35a61cd4da9f2139a4abf61e758b4e5949a
AUX gitlab-8.13.3-sidekiq.init 1459 SHA256 fdf808f9c0a92d7a77ae8be27c8fc11cec571ec6b5b94e31639028eec19546f1 SHA512 ec2130483b603f2be423c288fd0d55615c831ce995a8a5509f0240f149b3464d8f0a75cade1c736d085fb5f898d109368af62d8fdfb280aa00c4df8c06abb1e9 WHIRLPOOL d3493ac268257386e22c677337c8f9b1050212fce4aa855119b2ccd5f56850a5288d0cdd74e3c2f34552f59f9431c9ab5080e372766b88de003cad5dab015100
AUX gitlab-8.13.3-unicorn.init 3562 SHA256 f4ae5b785d61fb2c463b2405533d5e9a2209bbff7a085106b463f59505123287 SHA512 4af87415da7e482725a6f97f5e2ffafe0d16784cdcf3f877c99b5f646832c14dd1b3e875ec00e57560060bf3c049dd7fd0aeb7452db1100740e6b17dc29fdfb6 WHIRLPOOL a63d236a76bcbbd6e39268c76a7fbb75f4b9e5488d0cbc0bb2973ae09753f11d1863e477fe88f6c652370c19c3a0f037f99cc681b91679eb4da992db5e2eff20
AUX gitlab-9.3.5-sidekiq.init 1464 SHA256 dc1d9a58845a699d5b797f476597e7d7a7171eb842b05639cd2e235c70a26edf SHA512 fe00243c815b0e4f826aada4f02c70659872673a36fe92ea1b72a94a21bacfb097260ac1623cc1fc9c74566fe5c6068a456c9dc6e1e1c02f42e86fd162573713 WHIRLPOOL 6d8618e1e0a14030c73840f58d6dd5f7ef221f448799c92978c42d6bd71bfd072f15508df931f408ede91158079cef7039e9e725cb217629a8b7e19f6c706978
AUX gitlab-9.3.5-unicorn.init 3748 SHA256 2fb8d62e52b2e59bed92de55834421b3858ca385c20ed7532f78a3c4cd6ba2c9 SHA512 6f7a6cded598f3f8174a4d39f06f1994aa77b22cb90fa7f1bb6f82919c9856c3eae1623f57636f2ee564b2bf6c660c82dd104e3c59455946db42e6cf44079ccb WHIRLPOOL f39d37b2f83046234616d056d046c844e24ccf434c96bc298acd0f53fcf0be57fc64352bfd66e45083f87e6be0ed817c89630309deee5f142c9343a46014a166
AUX gitlab-mailroom.service 773 SHA256 39cea460db7fc505b136a2106902d0515890180e74913bf364aa499368fc5f2e SHA512 f82c63a180add1103e2bd115e67826ad7362a844991ef16f1de7fc6c78bf1955155ecf278fc0d759e674ab85736f3ba2a6650d00e9b3ce683316875efd9efa3c WHIRLPOOL 683c67b12f9666d1c1df5ec61e0072acaecd3aff43d0ff475037e178bc58fd9036ae6d8cd45e922098c842abd057231afd4767ce229d4581356f153b48a06208
AUX gitlab-unicorn.service 773 SHA256 010c9e223a30400d9155b39499eb0d7efad23b66baab9fcd9e365c689086b9bd SHA512 0bf9630aa91ed8f590a7bfa42d09b7ba33f6342b43b3d191c792c11157f8926c2a2ac2390eebd8179637e29b5bf68233d4699d62463497a0fd45b9bdbdd9167b WHIRLPOOL fbc709a5550dcc548a35c22c812dafe52ee507f5678b57c22c709ee89a399ae9109e2f56b7a13135d4140f1e024ebc4effe4aa4de13e0f36691da2a0737d9792
AUX gitlab-workhorse.service 930 SHA256 09348a52fec333b4b19828752e0484400c1efa9dfb644723fcf8e80537e294b6 SHA512 6332024fe0049287899cf482b6e4439e9dd90da14e489d08aa8e5e79cb7872efcc517d99b69fa23b011b382acb1e5926496a78f08af5d2d64daa515b869a0c6a WHIRLPOOL 3749c6719b2a35c7de29763cd616e1e9cc30a85aa1630ffc46440334459b5922503d52629556c125a6dd6574bdc5f23f1b2a7f2a85e2270a415b22246e0b6bae
@ -24,6 +26,7 @@ DIST gitlab-ce-9.0.10.tar.gz 26364880 SHA256 4034125e6be2bd43bfab5e5d16074f6df0f
DIST gitlab-ce-9.1.7.tar.gz 30517778 SHA256 24506445bb484fe568b357d8d8ac32f54f54f543ae623609bb720381d96e6358 SHA512 454e0afcde9a613d780e2031632d424bb316e68472329303080eecf1876fe7b5bd964ecd623bb5ed2e2be4666ebb90f17e790406a5622f81e8c52e320e4e5c81 WHIRLPOOL e0e5b89754a86bdf7cc472cfbe7ec91a5f752f836f5de34b6db4bb4315ddd2a337768b7af7a3e0b86f1a2bd8b9bd95692fab434b8aa98ca96b962a3bfffe82be
DIST gitlab-ce-9.2.7.tar.gz 30988513 SHA256 c9a7beeb63569f9e22e330418772464179f734b201e44114851407e552705527 SHA512 2dc3a09baeff0ef3e9a2103c1eb468ae3936e2858b9c7462b95ced1f705ee8f00e3d4996298df0b14bc51f1c3c002b1da56ea6b636821c4e5916077dd3a9cb0a WHIRLPOOL 3f6ddba36a8b99227df8c3519ef306b8338956bf14adba5c08d06bd1df689966739f4a03eaaaf9d69076a636085ee829e2fd0f0c6b6ee90bc2a6e7e8db5ccb6b
DIST gitlab-ce-9.3.0_rc2.tar.gz 31567867 SHA256 fbd93af8281b2460a9600a84b24b007e4557da49f8d118387724c8166236220c SHA512 942e3e1ec856b0ff3dedcfcb7b8cdee51e7d44779024acaa69ce7d415d08bb1ee785bcd265d1f9f08790c8e9508779b7f9cc8a40acf417cbc0e94f3a98f1fb64 WHIRLPOOL 1f210495ac3632f88c663ae9dd936bea5e556012a5b5dfe598425046f845d0467c17b92abd24924dc720c3877f8b6ef65e6b551ad9b2c3486dc27eee430a6a0e
DIST gitlab-ce-9.3.5.tar.gz 31759466 SHA256 fbc19d97602ceb819364f72af61ed93524df9d2cafabf5a0b44072c656a51809 SHA512 c2d44f6eabc9d4083ffbdf07380b506a258ae484698637cb448f4ede5a22881b3bef3d91cd13db63fc28f2672edd059e31dca06b67f9077704d6b37b9bb15332 WHIRLPOOL f4f224c3ae26030d3d1f776771a0e78262b9b7e321c696d53b75c4ae93d16de30b296253399dd0ed2a9c58bf397ff7422e9d38b25519458556669d7f18cbe000
EBUILD gitlab-ce-8.15.8.ebuild 11986 SHA256 6c86e66d4b568b88dd44ec52401e25c33b2d5e61d9a76e77180320d40ef57132 SHA512 91e1dc1cd8b9b77ea039e7e194b06c44900511b9e7787a714faec14746f96da6d00aa66bd16763732c468d8a46815e29fe761349a0a0d712db21bd4a12d31e06 WHIRLPOOL 50923df1fdda85abf7c7984a49d73d6486628439612de18ec3914274f3a053ce98ffbffec0f6ca9f2f9ba1ca9491467de0762d2d4a31ea480f32eb68222c79f9
EBUILD gitlab-ce-8.16.9.ebuild 11986 SHA256 21a0d7336a0a022db75ded6f29fe12d64012bd20a46e538ce0940a3c7e402a11 SHA512 c8e3ff6de9d97e25300315e967b7bcfc7d4aa5bc3e78aa45564e12bb673fbf79c9ba454174fe4f362d9d58575611debf797b52685b2061ac3053113390401a5c WHIRLPOOL 4644465cfcaf81184c62acf888ced3f16ccffc9de84fac7774a5463a778684c051580dd1f273546b9be8a0ace83243abc06e1e5ba042b18a10f7d352783a995f
EBUILD gitlab-ce-8.17.6.ebuild 12932 SHA256 e5f7cc94653a6c55627264e02116d43febdcc58bd60ccf9f7c5fecf9476d1b0a SHA512 65fc18401842e1c1176d8178acff3ca48f1fe80ee8869b7263cd1819ced46bb8d1c2771226d9f7c9c5507ef120d69d66114605d8ed7b3923e5f9a61e2cc0125d WHIRLPOOL 3c979ba2e30fbb3c628063f71e3a8b12183632413f4342b81298e4fd4847e8a583adab16c202340d89fde010097f140005ae564c0d52fefb0fcb57b67ede398d
@ -31,6 +34,7 @@ EBUILD gitlab-ce-9.0.10.ebuild 13094 SHA256 3095dbce78328f513eaf599486af63ae3836
EBUILD gitlab-ce-9.1.7.ebuild 13250 SHA256 be342467f79215ec736c6d1f4d9d26bb679116f422585cceeac90bdf15dedfec SHA512 eca7584067d438b1feeeb56d7ef765af1f96f3fce8098d32e70e4f706c9572a52ffd7d4594c949234a1d25e9f52b220892d656afce4b30ca32ebe51665d0326c WHIRLPOOL 27d89d8d86c583da924bdac4f6db7216be151a55d5b14f7a78dd77417cd643c506c1c2ec652e234df7763472a0cad21794645dd85cfb404276179721649d4077
EBUILD gitlab-ce-9.2.7.ebuild 12995 SHA256 93cb032967c0388d706be2dda0cfca2ca4765c0774e283ab0d61769cf43ddea6 SHA512 b8ecb0a4cc893786d4cd2dd94d53a21c6a8fbec5d181843286584914363f1160361dccfe2f61487f6744f7fb4d42a5efc4085e64bca7b29dea7e4672788c49cf WHIRLPOOL 2d8ada573da9e209e7a0bf3f05aef83e2419c18f4406b3abdbb24a90b488acdbdf7d4406b665a92356b457d100dd46c2a39084f87ba90b23da87392f2f98beb4
EBUILD gitlab-ce-9.3.0_rc2.ebuild 12829 SHA256 6951949f8d98f867746a0128e99ce3baabddecdaa45952565f38a913b2868058 SHA512 3337e413db8680d0d177099425a71c2410afdec9130d57f9c910770aeb12dd7a13c410782f41f8a0cd24d243534d513b66ec4d93eb09c7e15896716863682eb0 WHIRLPOOL 6b9d03912224808065b3bc301f9ce7b82925293db2916cdeb3184b28c0d58fc034b06dda6b43109b251c942d3b4bebd0c4e6bde7c644630baaece585c35ae6d3
EBUILD gitlab-ce-9.3.5.ebuild 12828 SHA256 88e5bbb069524fa1cb38dce77bd6338f0c7e9474cf733051953340ab25ee6692 SHA512 a15e5d2ba38ae7438978030c52cc91e41cb1ac3bf7a805b97c8e3a17d49c15bd784c8f0024ddd68074f371501e73469b6c5f974741764775b0614736e3e8253b WHIRLPOOL b56a2815557ff59234596fdbd2e20d75c8ea6441eb8d51e5da7dcc92e05b4e56576a74f930d3aa008358389dc06e00efd15ffabb273fb9c87d878a7ebe64bd19
EBUILD gitlab-ce-9999.ebuild 12789 SHA256 27db871b7d51cae37b6802043c82887bb810c1183682ce6c7efe0dc546d9b29e SHA512 99ca91ab0b8045d8bc2cd9d4208ecd4e8eb96c3d01afe49d119bb5677ee88f5f700042f502ab0c446f7acaaaeb7b9758c6d721a91f256eea335eb744a05a4b27 WHIRLPOOL a1e812d1d9562e7febee89e5c847ea0febec360aee38efc5cf779e45b92bb73eff3f066eb90fb96c292e8cfdc2a322bc9222a786796ac0470a221e44369a3270
MISC ChangeLog 19200 SHA256 db9f337205efe14e3f1eaf70b0969c373f4c8c3373157147472a3c12ba9610cd SHA512 1aa815fb7827127f7f99d0e3b27d7be6334865a1313a5fc87ea13e7aec06447f24d9ba2b4ddab84eb200cb4ec06db49d0546956e49b2b051d5bd54b920a4ad63 WHIRLPOOL a6a9f04d0d930a515cb2c0a6ab594f94ed67b4ffef97bca09f282aea2c4663cbc05ad91a570dfbe0f88d3126759c9f810cb642dfa998b6204c3456ab9907e519
MISC ChangeLog 19435 SHA256 c81d395d1c8f83931097bc34df25dcbda8e6351186baf397df8eb4051bbc1616 SHA512 1524cbe46461c1a9672213f54dbbf4243a7b5379253401fe87aba17e23eae7a6f2b0709a49afcc24f963d4591637a7fc969406b98fb3e80200440de95a1b2390 WHIRLPOOL 94d7ba2ae1aad389da9142d3cca03e1853223fd564d17af643dc0bc336975237e11536f74a278815c59e027950cd35a2122b1244f2a3e598d11ebbedee5958b9
MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6

View file

@ -0,0 +1,64 @@
#!/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/pids/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}"
cd /opt/gitlab
${check_command} ${check_command_args1}
eend $?
${check_command} ${check_command_args2}
eend $?
}

View file

@ -0,0 +1,145 @@
#!/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/pids/unicorn.pid"}
: ${sidekiq_pidfile:="/run/gitlab/pids/sidekiq.pid"}
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
: ${sidekiq_config:="/etc/gitlab/sidekiq_queues.yml"}
: ${mail_room_pidfile:="/run/gitlab/pids/mail_room.pid"}
: ${mail_room_logfile:="@LOGS_DIR@/mail_room.log"}
: ${mail_room_config:="/etc/gitlab/mail_room.yml"}
socket_dir="/run/gitlab/sockets"
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 gitlab-gitaly
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}")"
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${mail_room_pidfile}")"
checkpath -d -o ${gitlab_user} -m700 "${socket_dir}"
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}"
cd /opt/gitlab
${check_command} ${check_command_args1}
eend $?
${check_command} ${check_command_args2}
eend $?
}

View file

@ -0,0 +1,413 @@
# Copyright 1999-2017 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="ruby23"
inherit eutils ruby-ng user systemd
MY_PV="v${PV/_/-}"
MY_GIT_COMMIT="0c9ceb3fd6094077cc5068970dedd4435db80000"
GITALY_VERSION="0.11.2"
GITLAB_PAGES_VERSION="0.4.3"
GITLAB_SHELL_VERSION="5.1.1"
GITLAB_WORKHORSE_VERSION="2.1.1"
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 ~arm64"
IUSE="kerberos mysql +postgres +unicorn systemd pages 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-4.3.0
>=sys-apps/yarn-0.17.0
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-${GITLAB_SHELL_VERSION}
>=dev-vcs/git-2.8.4
~www-servers/gitlab-workhorse-${GITLAB_WORKHORSE_VERSION}
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )
pages? ( ~www-servers/gitlab-pages-${GITLAB_PAGES_VERSION} )
~www-servers/gitlab-gitaly-${GITALY_VERSION}"
DEPEND="
${CDEPEND}
${COMMON_DEPEND}"
RDEPEND="
${COMMON_DEPEND}
>=dev-db/redis-2.8
virtual/mta
systemd? ( sys-apps/systemd:0= )"
# required bundler >= 1.15.0
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.13.7"
#
# 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}-9.0.0-fix-redis-config-path.patch"
"03-${PN}-9.2.2-database.yml.patch"
"04-${PN}-9.3.0-fix-check-task.patch"
"05-${PN}-9.0.0-replace-sys-filesystem.patch"
"06-${PN}-8.17.0-fix-webpack-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}"
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|${run_path}|g" \
-e "s|/home/git/gitlab/log|${LOGS_DIR}|g" \
-e "s|/home/git/gitlab|${DEST_DIR}|g" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/git/gitlab/tmp|${run_path}|g" \
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}"/
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-9.3.5-sidekiq.init
use unicorn && rcscript=gitlab-9.3.5-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|g" \
-e "s|@GITLAB_BASE@|${dest}|g" \
-e "s|@LOGS_DIR@|${logs}|g" \
"${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
if use mysql ; then
ewarn "PLEASE also read this document about needed migrations on MySQL:"
ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md"
ewarn "Failing to follow those instructions may make the config phase fail!"
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 "Installing npm modules ..."
exec_rake yarn:install
einfo "Cleaning old precompiled assets ..."
exec_rake gitlab: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
einfo "Installing npm modules ..."
exec_rake yarn:install
fi
einfo "Precompiling assests ..."
exec_rake gitlab:assets:compile
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} NODE_ENV=${RAILS_ENV}"
echo " ${command}"
su -l ${MY_USER} -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; export NODE_PATH=${DEST_DIR}/node_modules
cd ${DEST_DIR}
${command}" \
|| die "failed to run rake $@"
}