FreeBSD Bugzilla – Attachment 169394 Details for
Bug 208793
www/gitlab: gitlab did not start on boot
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix boot problem
gitlab.in.diff (text/plain), 6.17 KB, created by
Johannes Jost Meixner
on 2016-04-17 10:09:34 UTC
(
hide
)
Description:
Fix boot problem
Filename:
MIME Type:
Creator:
Johannes Jost Meixner
Created:
2016-04-17 10:09:34 UTC
Size:
6.17 KB
patch
obsolete
>Index: files/gitlab.in >=================================================================== >--- files/gitlab.in (revision 412517) >+++ files/gitlab.in (working copy) >@@ -1,23 +1,10 @@ > #! /bin/sh > >-# $FreeBSD$ >- >-### BEGIN INIT INFO >-# Provides: gitlab >-# Required-Start: $local_fs $remote_fs $network $syslog redis-server >-# Required-Stop: $local_fs $remote_fs $network $syslog >-# Default-Start: 2 3 4 5 >-# Default-Stop: 0 1 6 >-# Short-Description: GitLab git repository management >-# Description: GitLab git repository management >-# chkconfig: - 85 14 >-### END INIT INFO >- > # Maintainer: Torsten Zuehlsdorff <ports@toco-domains.de> > # Based on work of: @charlienewey, rovanion.luckey@gmail.com, @randx > > # PROVIDE: gitlab >-# REQUIRE: LOGIN >+# REQUIRE: redis nginx LOGIN > # KEYWORD: shutdown > # > # Add the following line to /etc/rc.conf to enable GitLab: >@@ -32,21 +19,25 @@ > rcvar=gitlab_enable > extra_commands=status > >-status_cmd="print_status" >-start_cmd="start_gitlab" >-stop_cmd="stop_gitlab" >-restart_cmd="restart_gitlab" >+: ${gitlab_user="git"} >+: ${gitlab_railsenv="production"} > >+status_cmd="${name}_status" >+start_cmd="${name}_start" >+stop_cmd="${name}_stop" >+#restart_cmd="${name}_restart" >+ >+extra_commands="status reload" >+ > gitlab_enable=${gitlab_enable:-"NO"} > > load_rc_config $name > > ### Environment variables >-RAILS_ENV="production" > > # Script variable names should be lower-case not to conflict with > # internal /bin/sh variables such as PATH, EDITOR or SHELL. >-app_user="git" >+app_user=${gitlab_user} > app_root="/usr/local/www/gitlab" > pid_path="$app_root/tmp/pids" > socket_path="$app_root/tmp/sockets" >@@ -61,14 +52,6 @@ > gitlab_workhorse_log="$app_root/log/gitlab-workhorse.log" > shell_path="/bin/bash" > >-# Read configuration variable file if it is present >-test -f /etc/default/gitlab && . /etc/default/gitlab >- >-# Switch to the app_user if it is not he/she who is running the script. >-if [ "$USER" != "$app_user" ]; then >- eval su - "$app_user" -c $(echo \")$0 "$@"$(echo \"); exit; >-fi >- > # Switch to the gitlab path, exit on failure. > if ! cd "$app_root" ; then > echo "Failed to cd into $app_root, exiting!"; exit 1 >@@ -215,7 +198,7 @@ > } > > ## Starts Unicorn and Sidekiq if they're not running. >-start_gitlab() { >+gitlab_start() { > check_stale_pids > > if [ "$web_status" != "0" ]; then >@@ -238,7 +221,7 @@ > # Remove old socket if it exists > rm -f "$socket_path"/gitlab.socket 2>/dev/null > # Start the web server >- RAILS_ENV=$RAILS_ENV bin/web start >+ RAILS_ENV=$gitlab_railsenv bin/web start > fi > > # If sidekiq is already running, don't start it again. >@@ -245,7 +228,7 @@ > if [ "$sidekiq_status" = "0" ]; then > echo "The Sidekiq job dispatcher is already running with pid $spid, not restarting" > else >- RAILS_ENV=$RAILS_ENV bin/background_jobs start & >+ RAILS_ENV=$gitlab_railsenv bin/background_jobs start & > fi > > if [ "$gitlab_workhorse_status" = "0" ]; then >@@ -265,7 +248,7 @@ > if [ "$mail_room_status" = "0" ]; then > echo "The MailRoom email processor is already running with pid $mpid, not restarting" > else >- RAILS_ENV=$RAILS_ENV bin/mail_room start & >+ RAILS_ENV=$gitlab_railsenv bin/mail_room start & > fi > fi > >@@ -272,20 +255,20 @@ > # Wait for the pids to be planted > wait_for_pids > # Finally check the status to tell wether or not GitLab is running >- print_status >+ gitlab_status > } > > ## Asks Unicorn, Sidekiq and MailRoom if they would be so kind as to stop, if not kills them. >-stop_gitlab() { >+gitlab_stop() { > exit_if_not_running > > if [ "$web_status" = "0" ]; then > echo "Shutting down GitLab Unicorn" >- RAILS_ENV=$RAILS_ENV bin/web stop >+ RAILS_ENV=$gitlab_railsenv bin/web stop > fi > if [ "$sidekiq_status" = "0" ]; then > echo "Shutting down GitLab Sidekiq" >- RAILS_ENV=$RAILS_ENV bin/background_jobs stop >+ RAILS_ENV=$gitlab_railsenv bin/background_jobs stop > fi > if [ "$gitlab_workhorse_status" = "0" ]; then > echo "Shutting down gitlab-workhorse" >@@ -293,7 +276,7 @@ > fi > if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; then > echo "Shutting down GitLab MailRoom" >- RAILS_ENV=$RAILS_ENV bin/mail_room stop >+ RAILS_ENV=$gitlab_railsenv bin/mail_room stop > fi > > # If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script. >@@ -316,11 +299,11 @@ > rm "$mail_room_pid_path" 2>/dev/null > fi > >- print_status >+ gitlab_status > } > > ## Prints the status of GitLab and its components. >-print_status() { >+gitlab_status() { > check_status > if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && [ "$gitlab_workhorse_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then > echo "GitLab is not running." >@@ -361,54 +344,28 @@ > exit 1 > fi > printf "Reloading GitLab Unicorn configuration... " >- RAILS_ENV=$RAILS_ENV bin/web reload >+ RAILS_ENV=$gitlab_railsenv bin/web reload > echo "Done." > > echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." >- RAILS_ENV=$RAILS_ENV bin/background_jobs restart >+ RAILS_ENV=$gitlab_railsenv bin/background_jobs restart > > if [ "$mail_room_enabled" != true ]; then > echo "Restarting GitLab MailRoom since it isn't capable of reloading its config..." >- RAILS_ENV=$RAILS_ENV bin/mail_room restart >+ RAILS_ENV=$gitlab_railsenv bin/mail_room restart > fi > > wait_for_pids >- print_status >+ gitlab_status > } > > ## Restarts Sidekiq and Unicorn. >-restart_gitlab(){ >+gitlab_restart(){ > check_status > if [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || [ "$gitlab_workhorse" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; }; then >- stop_gitlab >+ gitlab_stop > fi >- start_gitlab >+ gitlab_start > } > >- >-### Finally the input handling. >- >-case "$1" in >- start) >- start_gitlab >- ;; >- stop) >- stop_gitlab >- ;; >- restart) >- restart_gitlab >- ;; >- reload|force-reload) >- reload_gitlab >- ;; >- status) >- print_status >- exit $gitlab_status >- ;; >- *) >- echo "Usage: service gitlab {start|stop|restart|reload|status}" >- exit 1 >- ;; >-esac >- >-exit >+run_rc_command "$1"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208793
:
169394
|
171708
|
173348
|
173478
|
178224