Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-05-22 03:10:39 +00:00
parent 5ef38f2a1d
commit 729d26fafc
5 changed files with 60 additions and 147 deletions

61
bin/web
View File

@ -3,18 +3,61 @@
set -e set -e
cd $(dirname $0)/.. cd $(dirname $0)/..
app_root=$(pwd)
case "$USE_WEB_SERVER" in puma_pidfile="$app_root/tmp/pids/puma.pid"
puma|"") # and the "" defines default puma_config="$app_root/config/puma.rb"
exec bin/web_puma "$@"
;;
unicorn) spawn_puma()
exec bin/web_unicorn "$@" {
;; exec bundle exec puma --config "${puma_config}" --environment "$RAILS_ENV" "$@"
}
*) get_puma_pid()
echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER." {
pid=$(cat "${puma_pidfile}")
if [ -z "$pid" ] ; then
echo "Could not find a PID in $puma_pidfile"
exit 1 exit 1
fi
echo "${pid}"
}
start()
{
spawn_puma &
}
start_foreground()
{
spawn_puma
}
stop()
{
get_puma_pid
kill -INT "$(get_puma_pid)"
}
reload()
{
kill -USR2 "$(get_puma_pid)"
}
case "$1" in
start)
start
;;
start_foreground)
start_foreground
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;; ;;
esac esac

View File

@ -1,63 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)/..
app_root=$(pwd)
puma_pidfile="$app_root/tmp/pids/puma.pid"
puma_config="$app_root/config/puma.rb"
spawn_puma()
{
exec bundle exec puma --config "${puma_config}" --environment "$RAILS_ENV" "$@"
}
get_puma_pid()
{
pid=$(cat "${puma_pidfile}")
if [ -z "$pid" ] ; then
echo "Could not find a PID in $puma_pidfile"
exit 1
fi
echo "${pid}"
}
start()
{
spawn_puma &
}
start_foreground()
{
spawn_puma
}
stop()
{
get_puma_pid
kill -INT "$(get_puma_pid)"
}
reload()
{
kill -USR2 "$(get_puma_pid)"
}
case "$1" in
start)
start
;;
start_foreground)
start_foreground
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;;
esac

View File

@ -1,59 +0,0 @@
#!/bin/sh
cd $(dirname $0)/.. || exit 1
app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
get_unicorn_pid()
{
local pid
pid=$(cat $unicorn_pidfile)
if [ -z "$pid" ] ; then
echo "Could not find a PID in $unicorn_pidfile"
exit 1
fi
unicorn_pid=$pid
}
start()
{
exec $unicorn_cmd -D
}
start_foreground()
{
exec $unicorn_cmd
}
stop()
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
reload()
{
get_unicorn_pid
kill -USR2 $unicorn_pid
}
case "$1" in
start)
start
;;
start_foreground)
start_foreground
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;;
esac

View File

@ -26,17 +26,6 @@
### Environment variables ### Environment variables
RAILS_ENV=${RAILS_ENV:-'production'} RAILS_ENV=${RAILS_ENV:-'production'}
SIDEKIQ_WORKERS=${SIDEKIQ_WORKERS:-1} SIDEKIQ_WORKERS=${SIDEKIQ_WORKERS:-1}
USE_WEB_SERVER=${USE_WEB_SERVER:-'puma'}
case "${USE_WEB_SERVER}" in
puma|unicorn)
use_web_server="$USE_WEB_SERVER"
;;
*)
echo "Unsupported web server '${USE_WEB_SERVER}' (Allowed: 'puma', 'unicorn')" 1>&2
exit 1
;;
esac
# Script variable names should be lower-case not to conflict with # Script variable names should be lower-case not to conflict with
# internal /bin/sh variables such as PATH, EDITOR or SHELL. # internal /bin/sh variables such as PATH, EDITOR or SHELL.
@ -45,7 +34,7 @@ app_root="/home/$app_user/gitlab"
pid_path="$app_root/tmp/pids" pid_path="$app_root/tmp/pids"
socket_path="$app_root/tmp/sockets" socket_path="$app_root/tmp/sockets"
rails_socket="$socket_path/gitlab.socket" rails_socket="$socket_path/gitlab.socket"
web_server_pid_path="$pid_path/$use_web_server.pid" web_server_pid_path="$pid_path/puma.pid"
mail_room_enabled=false mail_room_enabled=false
mail_room_pid_path="$pid_path/mail_room.pid" mail_room_pid_path="$pid_path/mail_room.pid"
gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse 2> /dev/null && pwd) gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse 2> /dev/null && pwd)
@ -270,7 +259,7 @@ start_gitlab() {
check_stale_pids check_stale_pids
if [ "$web_status" != "0" ]; then if [ "$web_status" != "0" ]; then
echo "Starting GitLab web server ($use_web_server)" echo "Starting GitLab web server"
fi fi
if [ "$sidekiq_status" != "0" ]; then if [ "$sidekiq_status" != "0" ]; then
echo "Starting GitLab Sidekiq" echo "Starting GitLab Sidekiq"
@ -295,7 +284,7 @@ start_gitlab() {
# Remove old socket if it exists # Remove old socket if it exists
rm -f "$rails_socket" 2>/dev/null rm -f "$rails_socket" 2>/dev/null
# Start the web server # Start the web server
RAILS_ENV=$RAILS_ENV USE_WEB_SERVER=$use_web_server bin/web start RAILS_ENV=$RAILS_ENV bin/web start
fi fi
# If sidekiq is already running, don't start it again. # If sidekiq is already running, don't start it again.
@ -357,7 +346,7 @@ stop_gitlab() {
if [ "$web_status" = "0" ]; then if [ "$web_status" = "0" ]; then
echo "Shutting down GitLab web server" echo "Shutting down GitLab web server"
RAILS_ENV=$RAILS_ENV USE_WEB_SERVER=$use_web_server bin/web stop RAILS_ENV=$RAILS_ENV bin/web stop
fi fi
if [ "$sidekiq_status" = "0" ]; then if [ "$sidekiq_status" = "0" ]; then
echo "Shutting down GitLab Sidekiq" echo "Shutting down GitLab Sidekiq"
@ -461,7 +450,7 @@ reload_gitlab(){
exit 1 exit 1
fi fi
printf "Reloading GitLab web server configuration... " printf "Reloading GitLab web server configuration... "
RAILS_ENV=$RAILS_ENV USE_WEB_SERVER=$use_web_server bin/web reload RAILS_ENV=$RAILS_ENV bin/web reload
echo "Done." echo "Done."
echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..."

View File

@ -11579,6 +11579,9 @@ msgstr ""
msgid "DiscordService|Send notifications about project events to a Discord channel." msgid "DiscordService|Send notifications about project events to a Discord channel."
msgstr "" msgstr ""
msgid "Discover"
msgstr ""
msgid "Discover GitLab Geo" msgid "Discover GitLab Geo"
msgstr "" msgstr ""