Skip to content

Commit 162fcd5

Browse files
committed
2 parents be7abca + 24c43c3 commit 162fcd5

File tree

5 files changed

+82
-17
lines changed

5 files changed

+82
-17
lines changed

apache/gitlab

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
SSLCertificateKeyFile /etc/apache2/ssl/server.key
2525
#SSLCertificateChainFile /etc/apache2/ssl/cacert.pem
2626

27+
# Uncomment the following line to prevent redirects to http on https only vhosts
28+
#RequestHeader set X-Forwarded-Proto "https"
29+
2730
ProxyPass / http://127.0.0.1:3000/
2831
ProxyPassReverse / http://127.0.0.1:3000/
2932
ProxyPreserveHost On

init.d/gitlab

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# GITLAB
44
# Maintainer: @randx
5-
# App Version: 5.0
5+
# App Version: 5.1
66

77
### BEGIN INIT INFO
88
# Provides: gitlab
@@ -16,18 +16,18 @@
1616

1717

1818
APP_ROOT="/home/git/gitlab"
19-
DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
19+
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb -e production"
2020
PID_PATH="$APP_ROOT/tmp/pids"
21-
UNICORN_PID="$PID_PATH/unicorn.pid"
21+
WEB_SERVER_PID="$PID_PATH/puma.pid"
2222
SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
2323
STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
2424
START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start"
25-
NAME="unicorn"
25+
NAME="gitlab"
2626
DESC="Gitlab service"
2727

2828
check_pid(){
29-
if [ -f $UNICORN_PID ]; then
30-
PID=`cat $UNICORN_PID`
29+
if [ -f $WEB_SERVER_PID ]; then
30+
PID=`cat $WEB_SERVER_PID`
3131
SPID=`cat $SIDEKIQ_PID`
3232
STATUS=`ps aux | grep $PID | grep -v grep | wc -l`
3333
else
@@ -45,7 +45,7 @@ start() {
4545
exit 1
4646
else
4747
if [ `whoami` = root ]; then
48-
sudo -u git -H bash -l -c "nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
48+
sudo -u git -H bash -l -c "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
4949
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
5050
echo "$DESC started"
5151
fi
@@ -57,9 +57,9 @@ stop() {
5757
check_pid
5858
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
5959
## Program is running, stop it.
60-
kill -QUIT `cat $UNICORN_PID`
60+
kill -QUIT `cat $WEB_SERVER_PID`
6161
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
62-
rm "$UNICORN_PID" >> /dev/null
62+
rm "$WEB_SERVER_PID" >> /dev/null
6363
echo "$DESC stopped"
6464
else
6565
## Program is not running, exit with error.
@@ -73,7 +73,7 @@ restart() {
7373
check_pid
7474
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
7575
echo "Restarting $DESC..."
76-
kill -USR2 `cat $UNICORN_PID`
76+
kill -USR2 `cat $WEB_SERVER_PID`
7777
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
7878
if [ `whoami` = root ]; then
7979
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
@@ -89,7 +89,7 @@ status() {
8989
cd $APP_ROOT
9090
check_pid
9191
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
92-
echo "$DESC / Unicorn with PID $PID is running."
92+
echo "$DESC / Puma with PID $PID is running."
9393
echo "$DESC / Sidekiq with PID $SPID is running."
9494
else
9595
echo "$DESC is not running."

init.d/gitlab-centos

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
#
33
# GitLab
4-
# Maintainer: @elvanja, @troyanov, @eiyaya
5-
# App Version: 4.1
4+
# Maintainer: @elvanja, @troyanov, @eiyaya, @foyo23
5+
# App Version: 5.0.0
66

77
# chkconfig: 2345 82 55
88
# processname: unicorn
@@ -17,10 +17,10 @@
1717
. /etc/rc.d/init.d/functions
1818

1919
# The name of the service
20-
NAME=gitlab
20+
NAME=git
2121

2222
# The username and path to the gitlab source
23-
USER=$NAME
23+
USER=git
2424
APP_PATH=/home/$USER/gitlab
2525

2626
# The PID and LOCK files used by unicorn and sidekiq
@@ -33,7 +33,7 @@ SLOCK=/var/lock/subsys/sidekiq
3333
OPTS="-c $APP_PATH/config/unicorn.rb -E production -D"
3434

3535
# Ruby related path update
36-
RUBY_PATH_PATCH="PATH=$PATH:/usr/local/bin:/usr/local/lib:/home/gitlab/bin && export PATH && "
36+
RUBY_PATH_PATCH="PATH=$PATH:/usr/local/bin:/usr/local/lib:/home/git/bin && export PATH && "
3737

3838
start() {
3939
cd $APP_PATH
@@ -113,4 +113,4 @@ case "$1" in
113113
;;
114114
esac
115115

116-
exit 0
116+
exit 0

nginx/gitlab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ upstream gitlab {
99
server {
1010
listen YOUR_SERVER_IP:80 default_server; # e.g., listen 192.168.1.1:80;
1111
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
12+
server_tokens off;
1213
root /home/git/gitlab/public;
1314

1415
# individual nginx logs for this gitlab vhost

nginx/gitlab-https

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GITLAB
2+
# Maintainer: @yin8086
3+
# App Version: 4.1
4+
5+
# Modified from nginx http version
6+
# Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
7+
8+
# You need from run openssl to generate the ssl certificate.
9+
# $ sudo openssl req -new -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
10+
# $ sudo chmod o-r gitlab.key
11+
12+
upstream gitlab {
13+
server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
14+
}
15+
16+
# This is a normal HTTP host which redirects all traffic to the HTTPS host.
17+
server {
18+
listen 80;
19+
server_name Domain_NAME;
20+
server_tokens off;
21+
root /nowhere;
22+
rewrite ^ https://gitlab.stardrad.com$request_uri permanent;
23+
}
24+
server {
25+
listen 443;
26+
server_name Domain_NAME;
27+
server_tokens off;
28+
root /home/gitlab/gitlab/public;
29+
30+
ssl on;
31+
ssl_certificate gitlab.crt;
32+
ssl_certificate_key gitlab.key;
33+
ssl_protocols SSLv3 TLSv1 TLSv2;
34+
ssl_ciphers AES:HIGH:!ADH:!MD5;
35+
ssl_prefer_server_ciphers on;
36+
37+
# individual nginx logs for this gitlab vhost
38+
access_log /var/log/nginx/gitlab_access.log;
39+
error_log /var/log/nginx/gitlab_error.log;
40+
41+
location / {
42+
# serve static files from defined root folder;.
43+
# @gitlab is a named location for the upstream fallback, see below
44+
try_files $uri $uri/index.html $uri.html @gitlab;
45+
}
46+
47+
# if a file, which is not found in the root folder is requested,
48+
# then the proxy pass the request to the upsteam (gitlab unicorn)
49+
location @gitlab {
50+
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
51+
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
52+
proxy_redirect off;
53+
54+
proxy_set_header X-Forwarded-Proto https;
55+
proxy_set_header X-Forwarded-Ssl on;
56+
proxy_set_header Host $http_host;
57+
proxy_set_header X-Real-IP $remote_addr;
58+
59+
proxy_pass http://gitlab;
60+
}
61+
}

0 commit comments

Comments
 (0)