Commit 6ea3cad5 authored by Matthias Kaeppler's avatar Matthias Kaeppler

Fix init.d script to correctly set web server PID

This was still writing to unicorn.pid even after switching to puma.
parent bf8f8b14
---
title: Fix init.d script to correctly set web server PID
merge_request: 29164
author:
type: fixed
......@@ -966,7 +966,7 @@ If you want to switch back to Unicorn, follow these steps:
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
```
1. Edit the system `init.d` script to set the `USE_UNICORN=1` flag. If you have `/etc/default/gitlab`, then you should edit it instead.
1. Edit the system `init.d` script and set `USE_WEB_SERVER="unicorn"`. If you have `/etc/default/gitlab`, then you should edit it instead.
1. Restart GitLab.
### Using Sidekiq instead of Sidekiq Cluster
......
......@@ -23,11 +23,20 @@
# An example defaults file can be found in lib/support/init.d/gitlab.default.example
###
### Environment variables
RAILS_ENV="production"
USE_UNICORN=""
SIDEKIQ_WORKERS=1
RAILS_ENV=${RAILS_ENV:-'production'}
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
# internal /bin/sh variables such as PATH, EDITOR or SHELL.
......@@ -36,7 +45,7 @@ app_root="/home/$app_user/gitlab"
pid_path="$app_root/tmp/pids"
socket_path="$app_root/tmp/sockets"
rails_socket="$socket_path/gitlab.socket"
web_server_pid_path="$pid_path/unicorn.pid"
web_server_pid_path="$pid_path/$use_web_server.pid"
mail_room_enabled=false
mail_room_pid_path="$pid_path/mail_room.pid"
gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse 2> /dev/null && pwd)
......@@ -67,13 +76,6 @@ if ! cd "$app_root" ; then
echo "Failed to cd into $app_root, exiting!"; exit 1
fi
# Select the web server to use
if [ -z "$USE_UNICORN" ]; then
use_web_server="puma"
else
use_web_server="unicorn"
fi
if [ -z "$SIDEKIQ_WORKERS" ]; then
sidekiq_pid_path="$pid_path/sidekiq.pid"
else
......
......@@ -6,7 +6,7 @@
RAILS_ENV="production"
# Uncomment the line below to enable the Unicorn web server instead of Puma.
# USE_UNICORN=1
# use_web_server="unicorn"
# app_user defines the user that GitLab is run as.
# The default is "git".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment