mirror of
https://github.com/jlengrand/gitlab-recipes.git
synced 2026-03-10 08:11:17 +00:00
Merge branch 'master' of https://github.com/gitlabhq/gitlab-recipes
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
SSLCertificateKeyFile /etc/apache2/ssl/server.key
|
||||
#SSLCertificateChainFile /etc/apache2/ssl/cacert.pem
|
||||
|
||||
# Uncomment the following line to prevent redirects to http on https only vhosts
|
||||
#RequestHeader set X-Forwarded-Proto "https"
|
||||
|
||||
ProxyPass / http://127.0.0.1:3000/
|
||||
ProxyPassReverse / http://127.0.0.1:3000/
|
||||
ProxyPreserveHost On
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# GITLAB
|
||||
# Maintainer: @randx
|
||||
# App Version: 5.0
|
||||
# App Version: 5.1
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gitlab
|
||||
@@ -16,18 +16,18 @@
|
||||
|
||||
|
||||
APP_ROOT="/home/git/gitlab"
|
||||
DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
|
||||
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb -e production"
|
||||
PID_PATH="$APP_ROOT/tmp/pids"
|
||||
UNICORN_PID="$PID_PATH/unicorn.pid"
|
||||
WEB_SERVER_PID="$PID_PATH/puma.pid"
|
||||
SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
|
||||
STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
|
||||
START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start"
|
||||
NAME="unicorn"
|
||||
NAME="gitlab"
|
||||
DESC="Gitlab service"
|
||||
|
||||
check_pid(){
|
||||
if [ -f $UNICORN_PID ]; then
|
||||
PID=`cat $UNICORN_PID`
|
||||
if [ -f $WEB_SERVER_PID ]; then
|
||||
PID=`cat $WEB_SERVER_PID`
|
||||
SPID=`cat $SIDEKIQ_PID`
|
||||
STATUS=`ps aux | grep $PID | grep -v grep | wc -l`
|
||||
else
|
||||
@@ -45,7 +45,7 @@ start() {
|
||||
exit 1
|
||||
else
|
||||
if [ `whoami` = root ]; then
|
||||
sudo -u git -H bash -l -c "nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
|
||||
sudo -u git -H bash -l -c "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
|
||||
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
|
||||
echo "$DESC started"
|
||||
fi
|
||||
@@ -57,9 +57,9 @@ stop() {
|
||||
check_pid
|
||||
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
|
||||
## Program is running, stop it.
|
||||
kill -QUIT `cat $UNICORN_PID`
|
||||
kill -QUIT `cat $WEB_SERVER_PID`
|
||||
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
|
||||
rm "$UNICORN_PID" >> /dev/null
|
||||
rm "$WEB_SERVER_PID" >> /dev/null
|
||||
echo "$DESC stopped"
|
||||
else
|
||||
## Program is not running, exit with error.
|
||||
@@ -73,7 +73,7 @@ restart() {
|
||||
check_pid
|
||||
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
|
||||
echo "Restarting $DESC..."
|
||||
kill -USR2 `cat $UNICORN_PID`
|
||||
kill -USR2 `cat $WEB_SERVER_PID`
|
||||
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
|
||||
if [ `whoami` = root ]; then
|
||||
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
|
||||
@@ -89,7 +89,7 @@ status() {
|
||||
cd $APP_ROOT
|
||||
check_pid
|
||||
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
|
||||
echo "$DESC / Unicorn with PID $PID is running."
|
||||
echo "$DESC / Puma with PID $PID is running."
|
||||
echo "$DESC / Sidekiq with PID $SPID is running."
|
||||
else
|
||||
echo "$DESC is not running."
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# GitLab
|
||||
# Maintainer: @elvanja, @troyanov, @eiyaya
|
||||
# App Version: 4.1
|
||||
# Maintainer: @elvanja, @troyanov, @eiyaya, @foyo23
|
||||
# App Version: 5.0.0
|
||||
|
||||
# chkconfig: 2345 82 55
|
||||
# processname: unicorn
|
||||
@@ -17,10 +17,10 @@
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# The name of the service
|
||||
NAME=gitlab
|
||||
NAME=git
|
||||
|
||||
# The username and path to the gitlab source
|
||||
USER=$NAME
|
||||
USER=git
|
||||
APP_PATH=/home/$USER/gitlab
|
||||
|
||||
# The PID and LOCK files used by unicorn and sidekiq
|
||||
@@ -33,7 +33,7 @@ SLOCK=/var/lock/subsys/sidekiq
|
||||
OPTS="-c $APP_PATH/config/unicorn.rb -E production -D"
|
||||
|
||||
# Ruby related path update
|
||||
RUBY_PATH_PATCH="PATH=$PATH:/usr/local/bin:/usr/local/lib:/home/gitlab/bin && export PATH && "
|
||||
RUBY_PATH_PATCH="PATH=$PATH:/usr/local/bin:/usr/local/lib:/home/git/bin && export PATH && "
|
||||
|
||||
start() {
|
||||
cd $APP_PATH
|
||||
@@ -113,4 +113,4 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
@@ -9,6 +9,7 @@ upstream gitlab {
|
||||
server {
|
||||
listen YOUR_SERVER_IP:80 default_server; # e.g., listen 192.168.1.1:80;
|
||||
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
|
||||
server_tokens off;
|
||||
root /home/git/gitlab/public;
|
||||
|
||||
# individual nginx logs for this gitlab vhost
|
||||
|
||||
61
nginx/gitlab-https
Normal file
61
nginx/gitlab-https
Normal file
@@ -0,0 +1,61 @@
|
||||
# GITLAB
|
||||
# Maintainer: @yin8086
|
||||
# App Version: 4.1
|
||||
|
||||
# Modified from nginx http version
|
||||
# Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
|
||||
|
||||
# You need from run openssl to generate the ssl certificate.
|
||||
# $ sudo openssl req -new -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
|
||||
# $ sudo chmod o-r gitlab.key
|
||||
|
||||
upstream gitlab {
|
||||
server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
|
||||
}
|
||||
|
||||
# This is a normal HTTP host which redirects all traffic to the HTTPS host.
|
||||
server {
|
||||
listen 80;
|
||||
server_name Domain_NAME;
|
||||
server_tokens off;
|
||||
root /nowhere;
|
||||
rewrite ^ https://gitlab.stardrad.com$request_uri permanent;
|
||||
}
|
||||
server {
|
||||
listen 443;
|
||||
server_name Domain_NAME;
|
||||
server_tokens off;
|
||||
root /home/gitlab/gitlab/public;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate gitlab.crt;
|
||||
ssl_certificate_key gitlab.key;
|
||||
ssl_protocols SSLv3 TLSv1 TLSv2;
|
||||
ssl_ciphers AES:HIGH:!ADH:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# individual nginx logs for this gitlab vhost
|
||||
access_log /var/log/nginx/gitlab_access.log;
|
||||
error_log /var/log/nginx/gitlab_error.log;
|
||||
|
||||
location / {
|
||||
# serve static files from defined root folder;.
|
||||
# @gitlab is a named location for the upstream fallback, see below
|
||||
try_files $uri $uri/index.html $uri.html @gitlab;
|
||||
}
|
||||
|
||||
# if a file, which is not found in the root folder is requested,
|
||||
# then the proxy pass the request to the upsteam (gitlab unicorn)
|
||||
location @gitlab {
|
||||
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
|
||||
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Ssl on;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
proxy_pass http://gitlab;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user