aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/gitlabhq/files/gitlabhq-8.14.init')
-rw-r--r--www-apps/gitlabhq/files/gitlabhq-8.14.init92
1 files changed, 92 insertions, 0 deletions
diff --git a/www-apps/gitlabhq/files/gitlabhq-8.14.init b/www-apps/gitlabhq/files/gitlabhq-8.14.init
new file mode 100644
index 0000000..f111e76
--- /dev/null
+++ b/www-apps/gitlabhq/files/gitlabhq-8.14.init
@@ -0,0 +1,92 @@
+#!/sbin/openrc-run
+
+name="GitLab"
+description="GitLab 8.14 on Unicorns"
+
+: ${gitlab_user:=git}
+: ${gitlab_group:=git}
+: ${gitlab_home:="/opt/gitlabhq-8.14"}
+: ${gitlab_log:="/var/log/gitlabhq-8.14"}
+
+: ${unicorn_pidfile:="${gitlab_home}/tmp/pids/unicorn.pid"}
+: ${unicorn_log:="${gitlab_log}/unicorn.log"}
+: ${unicorn_socket:="${gitlab_home}/tmp/sockets/gitlab.socket"}
+
+: ${sidekiq_pidfile:="${gitlab_home}/tmp/pids/sidekiq.pid"}
+: ${sidekiq_log:="${gitlab_log}/sidekiq.log"}
+: ${sidekiq_config:="${gitlab_home}/config/sidekiq_queues.yml"}
+
+: ${workhorse_pidfile:="${gitlab_home}/tmp/pids/workhorse.pid"}
+: ${workhorse_log:="${gitlab_log}/workhorse.log"}
+: ${workhorse_socket:="${gitlab_home}/tmp/sockets/gitlab-workhorse.socket"}
+: ${workhorse_command_args:="-listenUmask 0 -listenNetwork unix -listenAddr ${workhorse_socket} -authBackend http://127.0.0.1:8080 -authSocket ${unicorn_socket} -documentRoot ${gitlab_home}/public"}
+
+: ${rails_env:=production}
+
+unicorn_command="/usr/bin/bundle"
+unicorn_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
+sidekiq_command="/usr/bin/bundle"
+sidekiq_start_command_args="exec sidekiq -C ${sidekiq_config} -e ${rails_env} -d -P ${sidekiq_pidfile} -L ${sidekiq_log} $@ >> ${sidekiq_log} 2>&1"
+sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
+workhorse_command="/usr/bin/gitlab-workhorse"
+
+if [ ${rails_env} = development ]; then
+ sidekiq_command_args+=" VVERBOSE=1"
+fi
+
+depend() {
+ provide gitlab
+ need redis
+ use net mysql postgresql
+}
+
+start() {
+
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${unicorn_pidfile}")"
+ checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
+
+ ebegin "Starting GitLab 8.14 Unicorn servers"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}" \
+ --exec ${unicorn_command} -- ${unicorn_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.14 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
+ eend $?
+
+ ebegin "Starting GitLab 8.14 Workhorse"
+ start-stop-daemon --start \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}" \
+ --make-pidfile \
+ --background -1 "${workhorse_log}" -2 "${workhorse_log}" \
+ --exec ${workhorse_command} -- ${workhorse_command_args}
+ eend $?
+}
+
+stop() {
+
+ ebegin "Stopping GitLab 8.14 Workhorse"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${workhorse_pidfile}"
+ eend $?
+
+ ebegin "Stopping GitLab 8.14 Sidekiq"
+ cd "${gitlab_home}"
+ sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
+ eend $?
+
+ ebegin "Stopping GitLab 8.14 Unicorn servers"
+ start-stop-daemon --stop \
+ --chdir "${gitlab_home}" \
+ --user="${gitlab_user}:${gitlab_group}" \
+ --pidfile="${unicorn_pidfile}"
+ eend $?
+}