www-apps/gitlab-ce: Add ebuild for version 10.4.4.

Package-Manager: Portage-2.3.19, Repoman-2.3.6
This commit is contained in:
Manuel Friedli 2018-02-19 02:41:50 +01:00
parent 0774052be8
commit b351ca733a
6 changed files with 760 additions and 1 deletions

View File

@ -1,3 +1,11 @@
*gitlab-ce-10.4.4 (19 Feb 2018)
19 Feb 2018; Manuel Friedli <manuel@fritteli.ch>
+files/08-gitlab-ce-10.4.4-general-config.patch,
+files/gitlab-10.4.4-sidekiq.init, +files/gitlab-10.4.4-unicorn.init,
+gitlab-ce-10.4.4.ebuild:
www-apps/gitlab-ce: Add ebuild for version 10.4.4.
*gitlab-ce-10.3.7 (17 Feb 2018)
17 Feb 2018; Manuel Friedli <manuel@fritteli.ch> +gitlab-ce-10.3.7.ebuild:

View File

@ -9,6 +9,9 @@ AUX 04-gitlab-ce-9.3.0-fix-check-task.patch 1090 SHA256 51ade91e5e7ef67e6d3c0e6e
AUX 05-gitlab-ce-9.0.0-replace-sys-filesystem.patch 2436 SHA256 53fcd9fc123a0fcb671a8cbcb3b2dc61765e32be6836206ae0edea8cf0ae8203 SHA512 21636f298df7e762f59595f39fb50266f8737311f37aa2b9ba96bc29190b8a67eea01b09e3b589d0885da6b27beaa136fa66c7d98408a8e3ecb3ac6baf20d891 WHIRLPOOL e0c709dfc5f72e33207fd7d62a7db5a85c0ed4b6064d5d6a13bcce7d660d9ba144fe09d0985c16c313f06a4e02911729be132086735eac47ddff981874f31acc
AUX 06-gitlab-ce-8.17.0-fix-webpack-config.patch 614 SHA256 0c1cdc25032322eff6c279435ba5f3fc349b30de0d55d86fad2616bd2bb7fef4 SHA512 f5ccb4d1849ab395ba4ec3c80735a1fedd9fa7f790c8b114d8dc8d1fc2c431d7b9e5645247485f0b8c1061a00ed61c21a5e50f49af0d76e232182c68868a163f WHIRLPOOL 6968ddefed74607c36cc66dc133dbf4942979d2ae867f819cf2e7e5c9701fe8dd86b266d923e6343971e6904f0ad1f35200971660df139edabcc9e0790fc107c
AUX 07-gitlab-ce-10.0.7-yarn.patch 36442 SHA256 b45cfd739ca94058987c55458c89dba4cdbb1b9b9fc2e486d02e67e275044855 SHA512 931edab62e1218f84f08db72cc2f4ff95e53c6f88d755224de5e9dd19c230bb4b4c808accebd14c7bb06e6c57e4f101f7b4fb1843abb9a908d7f9f2b901d4e5f WHIRLPOOL 0f0ba8a1dfb38355bedebb17a8d174fa33a695be9da364bfebf3ffc5629eff5f462a9b66af65ad0fcc3b35f93c67c4b15a93e1962ae32225dbed45c87b30c5b1
AUX 08-gitlab-ce-10.4.4-general-config.patch 4074 SHA256 f020ebd86ad81a35ed8a39d2072a7cdb9bd0f121c80a3e01b94a9343dccfb1c3 SHA512 58e267ba55d3db89f88a7a47e871eaa97ec14aca2fb1a5140d1debbad5929551a2c1dd7c5a7b5e8b983fea56a636e504df30d253b6ab68dc4b457419734561b6 WHIRLPOOL c43cef9d469d3a6b1219fbc856bfa34a081707fc80cd73ea2936850aebe3249bf924f00da6bcbacee4bbc612f9bdc2b959d75478ec55202927517a276837567e
AUX gitlab-10.4.4-sidekiq.init 1461 SHA256 99fd95716abde96f9a031cb22e04371c7dfe6bf53440154dcf94be9477d1a6f8 SHA512 8d536a3db5af3bdf04b92e0c1e9e9d65aacb3dff244729d32f28b8dd66f586cbd5a2e60b3e2f58c2be96c0c09708dc21275adca3f89fbdfa20e000e9563ee880 WHIRLPOOL e47f69b06fd0d60837fc7cab03eb4c4cf9111597b7b3e81c3c35b7fc83be12f85ac26ad6693ff30c95b91a998b0685128b303df5aa97ab7835f575ce199f141b
AUX gitlab-10.4.4-unicorn.init 4068 SHA256 a29c2741626fae15156117786d7ab63f4c68c5357d28c257a9da8e6d92ce71d7 SHA512 0dce3a14f113776bacb86eac602726a70ba3f71ee1a9310c7a2f427a658622b94e0550564360339b044a58c2db52ed6782de7675aa622b2ab9016ed93261b22a WHIRLPOOL 58a4c3328665dffcf9f96a2eeee495b9dcd550a41c26d8e256b44ca6ad247a84c909838e31f8de8673f94d767c077bb253c20f3a4321abe7d5de937f680ec215
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
@ -36,6 +39,7 @@ EBUILD gitlab-ce-10.0.7.ebuild 13568 SHA256 c164db3f0af93824bb97992b20b0bc5415bb
EBUILD gitlab-ce-10.1.7.ebuild 13679 SHA256 9c1bec7e86d46422f87baecaece80197c506b758eab28fd85fc214512ff67e3c SHA512 6958f3f67b7d8729519175337b5e411b9d32fa3e7348105870d5f35c938e905cc60e7af23802b1b5835610c72e9a76ca50c229f5d862403ffd5065e82ee39d25 WHIRLPOOL 6caf644203291c7903f7c67a93e3f11a3f8d632e01384390742bc8b1fc4068e494f750c44817f0143a0f6eeaadbb4a7243c4194397fded59956363b49bd32ae4
EBUILD gitlab-ce-10.2.8.ebuild 13681 SHA256 0e02e1a51f335872facce2751aa23d8ff5b9cd8aa7359fed1cd0f5a3ed5bd1e7 SHA512 805d6a717b0dcdc6551f549722abb8322a51d6cee1eb807dabac1fe4b98ffd32fcf3667d1de7f845a08e9dfb72afa257c51c6382cbc48f5f23fe15b027724dde WHIRLPOOL 1c48b8ea54d65d1d2ea001c6af45c0a76f0587d815353675ce36245c721f4b2d9c5b48c608fe632743863f5db859c5ee0c96b95fe6b429fcdd7053d4e8fb86e8
EBUILD gitlab-ce-10.3.7.ebuild 14085 SHA256 cbff8442516b815e386974191d48464202b3b4f93e5d4688a71de08fadaeb89c SHA512 311e256f675c6cbb8e374448858e0adcfecd6a5432c4384a5d9c302a3c82dcab0aab0eb9a79d90f8f770dba0d1d984f0b7e3d53ce1e3b2c4c915aaa2facdbdd7 WHIRLPOOL 29674dc1a54311518047df70ecd21971b642bc7b8511d8c6ba3f754b7beae3de10c289704dcd214c7c5cf76f60772117c2649daac4d691b13387d758d2fb3f36
EBUILD gitlab-ce-10.4.4.ebuild 13152 SHA256 6b226f67a85d25131a9acef87447a357ea67cc3f48e6aab927735de62fdbcaed SHA512 b8b43172d6b37ca3bbf84b7d2598ff558cebf84157a87957316d5f7168b52e8c91f87db853cf7a9c0843ab83540d811a4ad98da9c69343e87a0633b44f72b37b WHIRLPOOL d39bc072986261de7ddc35d58ee570eedfe8f01532dea8fa1423cfb40a5352453a1ba2647023032194ef44a87dfa7f0b4ca0dc96472c609ea3a49a1a5a339153
EBUILD gitlab-ce-9.0.13.ebuild 13139 SHA256 ecdcd1d6ca3999eb4b299628bac4c97a231cfcf682569cc1a0c11241cfcb6099 SHA512 8a6b8f3f05f54a752d57651b34ba4f6310e6695ea6eea1bbebe4a1dd38aa9ea0e9030bd59448a886918e20ea81f1b167236712e21fb6c43b7fb50b79565e2d87 WHIRLPOOL 0873a646dcb208e8c006e0e587fc03003594fd00e790e22d89839c9ffb8b7403a2df7b306ddfb817ea10a32e58d095d97989591de18ca78782bd468ae1fb8bc7
EBUILD gitlab-ce-9.1.10.ebuild 13295 SHA256 a69c179d072e76597091d825956bc308a25757a95406444a95a4ccbe9fe8ee9e SHA512 cc01ae887bce9e838eb020c7b414de4f80c5cc94762bd7c65fc5f6ab732b3ac7447f3f136b054557a5a93d09ed946b821d027fe29d7fdeea6eaaa6fc336cf394 WHIRLPOOL 1778e46da386704fbecc9e62769b9ab6ccdb40ee1028ef33607b4668e3fafbd0996ff4397128d8320098e3bf5c8f1d47a227e3c61a73a26a63663223790c8107
EBUILD gitlab-ce-9.2.10.ebuild 13040 SHA256 ace7b7561f499e43c19284153358b718275ac55792650391f39fa4ab89941c20 SHA512 22c8723251fefd50739ac082f04c377543f659720346cd29680d4956a2d6a37bb27b2c6beb723c09f49d7e478375e6679940f63f43c644564155a0eaffe300ed WHIRLPOOL 9601c5fcdc9b8d753a58ea4b4606957f3d09e63834335703896f55b16c41df7b81ef00b64e57f4409322789dcaa3745d60b31a973950c99037895d71a38ddaf2
@ -43,5 +47,5 @@ EBUILD gitlab-ce-9.3.11.ebuild 13699 SHA256 e56490b1f59cf32e84d65ba3c91231c07a41
EBUILD gitlab-ce-9.4.7.ebuild 13526 SHA256 5078d51dcca18d9c5380bff25d494437506482beb4e586727b577f1c475363ec SHA512 244e178828910739018fa794c9f03c8f3b0411e45298800eaf828099f9d468b01d73102c9183ce6552d4ba208c086e5b4de85b4e0427e5502b9a54d56cb6a636 WHIRLPOOL 0306b7fc67f570d2ece6cc321461604c2be4fe886122750a481c6573800bbb4164c4cecee54a29a408b1eee17aa479a54271b395575d2d606dbd2ec3ddc4a1ae
EBUILD gitlab-ce-9.5.10.ebuild 13526 SHA256 6e7c361f31989dd608eff4c8dd01b7301b142b4d38acdf38e61e2eecb2d4b285 SHA512 e33e56c8e49bd2ef03dd9af508b186f7908b8502960cbdb95ca9166631b84d5357c4965c0919e432ee5de9b9eeb33f68773ac405c24430568f9abb0d8e7354a6 WHIRLPOOL 3e866d785e8018096a92a223a2f6cedf4398cc07726a183d805005b3cd718fed2296edd63f5bc9d2b8849fe2298e9a61bf998a2241de2cd5ab4527f8ddaed325
EBUILD gitlab-ce-9999.ebuild 13468 SHA256 ab13060918b09a67f3f0c653a3836c1077933c606e5ea4e3416fde204aa530af SHA512 f14bc61622929dc57460fd7e4b3d965437fdc44706c52608a6b278021960bb70b62f81a6dd38beeb134c0f40ef29a81e07ea5a49c9a7a8e7ab63f55529231cb8 WHIRLPOOL 204d2f97890f2868b9f890fcc9b03d3c47c6916e52af341cf946e197acd8c2287409a5a1e525183a62fec9588eaa21b9d3ad30bba3b12267aa4c9e1163ca7fb0
MISC ChangeLog 26064 SHA256 8820edb5b622f84bedd3dc859312642a9efc672eda16f3d6517424a0af71e118 SHA512 269983d651bf8c7e1e67d9a32d29da88b7f01754b58380e18dabded57374a49b4be4651659026373d14b51d8d3d3ea2441aeab5e274dc236eb0a02d584e0e72f WHIRLPOOL 22267d14138614165b9c5cb4407cb46ed7be44ffaa2f5346b6dbffe9b684fe7b733191d344771d89c2fd059ec58ecfe9724d616bdad366a6b616fde929ae0580
MISC ChangeLog 26353 SHA256 9674027692dcf3201003c9272a5c98eef023a1c2c8e46f73fcaa02e98509dfe1 SHA512 782d1773d13ad96e24495030936d3b1d6df036e5294979e7acda747cb6881ab4820a39dd4f148a5aa2c624ca539ad96d7763d2b4ac6d20da508f5a8a38b0e445 WHIRLPOOL 7f5424d2571f68f92d92e67ecab94ef0ea864ef6ea2519f0267b6ffdfb9ea0db23c22c806d73867cccac58c0dff7889926c0d9de13c683191795ae38f9ed5745
MISC metadata.xml 801 SHA256 3dc7486a12903f47f65968d524c93500ba30a4a09fa57e5a9dacf356509b44bb SHA512 e132754b72e64246531fa883400a0cf1a473ac5a6a49623db58ccf118a038b7cf37df03d9550f37b4a25f9ddbb1dcc5652ec9a4f2259d8e3ce202692c4025f41 WHIRLPOOL e9d961681fd790008eaf80fa07ce2c55a00a58f2e920d759793783ca8c8f508602a777e94c0cb65fe87c7dbef0cabdf26e4f4082584421097d939cbab20c4ac6

View File

@ -0,0 +1,96 @@
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index f2f05b3..0670112 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -502,7 +502,7 @@ production: &base
# Gitaly settings
gitaly:
# Path to the directory containing Gitaly client executables.
- client_path: /home/git/gitaly/bin
+ client_path: /usr/bin
# Default Gitaly authentication token. Can be overriden per storage. Can
# be left blank when Gitaly is running locally on a Unix socket, which
# is the normal way to deploy Gitaly.
@@ -520,8 +520,8 @@ production: &base
# real path not the symlink.
storages: # You must have at least a `default` storage path.
default:
- path: /home/git/repositories/
- gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket # TCP connections are supported too (e.g. tcp://host:port)
+ path: /var/lib/git/repositories/
+ gitaly_address: unix:/run/gitlab/gitaly.socket # TCP connections are supported too (e.g. tcp://host:port)
# gitaly_token: 'special token' # Optional: override global gitaly.token for this storage.
## Backup settings
@@ -549,12 +549,12 @@ production: &base
## GitLab Shell settings
gitlab_shell:
- path: /home/git/gitlab-shell/
- hooks_path: /home/git/gitlab-shell/hooks/
+ path: /usr/share/gitlab-shell/
+ hooks_path: /usr/share/gitlab-shell/hooks/
# File that contains the secret key for verifying access for gitlab-shell.
# Default is '.gitlab_shell_secret' relative to Rails.root (i.e. root of the GitLab app).
- # secret_file: /home/git/gitlab/.gitlab_shell_secret
+ secret_file: /opt/gitlab/.gitlab_shell_secret
# Git over HTTP
upload_pack: true
@@ -569,7 +569,7 @@ production: &base
workhorse:
# File that contains the secret key for verifying access for gitlab-workhorse.
# Default is '.gitlab_workhorse_secret' relative to Rails.root (i.e. root of the GitLab app).
- # secret_file: /home/git/gitlab/.gitlab_workhorse_secret
+ # secret_file: /opt/gitlab/.gitlab_workhorse_secret
## Git settings
# CAUTION!
@@ -667,8 +667,8 @@ test:
backup:
path: tmp/tests/backups
gitlab_shell:
- path: tmp/tests/gitlab-shell/
- hooks_path: tmp/tests/gitlab-shell/hooks/
+ path: /usr/share/gitlab-shell/
+ hooks_path: /usr/share/gitlab-shell/hooks/
issues_tracker:
redmine:
title: "Redmine"
diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example
index cc10da2..3c80d44 100644
--- a/config/unicorn.rb.example
+++ b/config/unicorn.rb.example
@@ -33,12 +33,12 @@ worker_processes 3
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
-working_directory "/home/git/gitlab" # available in 0.94.0+
+working_directory "/opt/gitlab" # available in 0.94.0+
# Listen on both a Unix domain socket and a TCP port.
# If you are load-balancing multiple Unicorn masters, lower the backlog
# setting to e.g. 64 for faster failover.
-listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
+listen "/run/gitlab/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true
# nuke workers after 30 seconds instead of 60 seconds (the default)
@@ -59,13 +59,13 @@ listen "127.0.0.1:8080", :tcp_nopush => true
timeout 60
# feel free to point this anywhere accessible on the filesystem
-pid "/home/git/gitlab/tmp/pids/unicorn.pid"
+pid "/run/gitlab/pids/unicorn.pid"
# By default, the Unicorn logger will write to stderr.
# Additionally, some applications/frameworks log to stderr or stdout,
# so prevent them from going to /dev/null when daemonized here:
-stderr_path "/home/git/gitlab/log/unicorn.stderr.log"
-stdout_path "/home/git/gitlab/log/unicorn.stdout.log"
+stderr_path "/var/log/gitlab/unicorn.stderr.log"
+stdout_path "/var/log/gitlab/unicorn.stdout.log"
# combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow

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/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,157 @@
#!/sbin/openrc-run
extra_started_commands="restartsidekiq check"
extra_stopped_commands="backup"
name="GitLab"
description="GitLab on Unicorns"
description_restartsidekiq="Restarts Sidekiq only"
description_check="Runs sanity checks"
description_backup="Creates a backup of your Gitlab database and files"
: ${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:="@LOGS_DIR@/mail_room.log"}
: ${mail_room_config:="/etc/gitlab/mail_room.yml"}
socket_dir="/run/gitlab"
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}"
backup_command="sudo -u ${gitlab:user} -H /usr/bin/bundle"
backup_args=" exec rake gitlab:backup:create 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 $?
}
backup() {
ebegin "Creating backup of ${name}"
cd /opt/gitlab
${backup_command} ${backup_args}
eend $?
}

View File

@ -0,0 +1,430 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
# 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"
EGIT_REPO_URI="https://gitlab.com/gitlab-org/${PN}.git"
EGIT_COMMIT="v${PV}"
EGIT_CHECKOUT_DIR="${WORKDIR}/all"
inherit eutils git-r3 ruby-ng user systemd
GITLAB_GITALY_VERSION="0.66.0"
GITLAB_PAGES_VERSION="0.6.0"
GITLAB_SHELL_VERSION="5.11.0"
GITLAB_WORKHORSE_VERSION="3.3.1"
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://about.gitlab.com/"
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-libs/re2
dev-util/ragel
>=net-libs/nodejs-4.3.0
>=sys-apps/yarn-0.17.0
postgres? ( >=dev-db/postgresql-9.6:* )
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/26 )
pages? ( ~www-servers/gitlab-pages-${GITLAB_PAGES_VERSION} )
~www-servers/gitlab-gitaly-${GITLAB_GITALY_VERSION}"
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.15.4"
#
# 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
#
PATCHES=(
"${FILESDIR}/01-${PN}-8.7.5-fix-sendmail-config.patch"
"${FILESDIR}/02-${PN}-9.0.0-fix-redis-config-path.patch"
"${FILESDIR}/03-${PN}-10.2.8-database.yml.patch"
"${FILESDIR}/04-${PN}-9.3.0-fix-check-task.patch"
"${FILESDIR}/05-${PN}-9.0.0-replace-sys-filesystem.patch"
"${FILESDIR}/06-${PN}-8.17.0-fix-webpack-config.patch"
"${FILESDIR}/08-${PN}-10.4.4-general-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_unpack() {
git-r3_fetch
git-r3_checkout
}
all_ruby_prepare() {
# fix paths
sed -i \
-e "s|/home/git/gitlab/tmp|/run/${MY_NAME}|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-10.4.4-sidekiq.init
use unicorn && rcscript=gitlab-10.4.4-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 you're using OpenRC, you can use the following command:"
elog
elog " /etc/init.d/gitlab backup"
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 "You must grant the GitLab user permissions the following on the database:"
ewarn " mysql -u root -p -e \\"
ewarn " \"GRANT TRIGGER ON \`gitlab\`.* TO 'gitlab'@'localhost';\""
ewarn "PLEASE also read this document about needed migrations on MySQL:"
ewarn
ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md"
ewarn
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
if use mysql ; then
ewarn "Please only proceed if you've read and understood the following page:"
ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md"
if [ "${update}" = 'true' ]; then
ewarn "Failing to follow those instructions may cause the upgrade to fail"
fi
ewarn
fi
ewarn "Now is a good time to create a backup of your Gitlab installation, just in case."
ewarn "To do so, abort this configuration with Ctrl+C and type the following commands:"
ewarn " cd /opt/gitlab"
ewarn " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production"
ewarn
ewarn "Press Ctrl+C to abort now or any key to continue."
read
## Initialize app ##
local RAILS_ENV="production"
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
if [ "${update}" = 'true' ]; then
einfo "Migrating database ..."
exec_rake db:migrate
einfo "Compiling GetText PO files ..."
exec_rake gettext:compile
# 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 "Compiling GetText PO files ..."
exec_rake gettext:pack
exec_rake gettext:po_to_json
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 $@"
}