Skip to content
Browse files

Merge pull request #6 from elvanja/centos-specific-scripts-by-elvanja

CENTOS: Added CentOS specific scripts
  • Loading branch information...
2 parents 9d69ad9 + fd8e716 commit 97fd28abe71f8f2c0e51dccacbe16da7131471fc @randx randx committed
Showing with 133 additions and 0 deletions.
  1. +24 −0 init.d/ReadMe-CentOS.md
  2. +97 −0 init.d/gitlab-centos
  3. +9 −0 nginx/ReadMe-CentOS.md
  4. +3 −0 nginx/gitlab
View
24 init.d/ReadMe-CentOS.md
@@ -0,0 +1,24 @@
+# CentOS daemon scripts for gitlab service
+
+## Related (kudos @4sak3n0ne):
+
+* https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
+
+* https://gist.github.com/3062860
+
+## Notes
+
+Add the service to chkconfig with:
+
+ chkconfig -add gitlab
+
+Related services (redis, mysql, nginx) should also be added to chkconfig.
+
+Check chkconfig state with
+
+ chkconfig -l
+
+And if any of the services are not set properly, run:
+
+ chkconfig --levels 2345 [name] on
+
View
97 init.d/gitlab-centos
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# GitLab
+# Maintainer: @elvanja
+# App Version: 2.8.2
+
+# chkconfig: 2345 82 55
+# processname: unicorn
+# processname: rescue
+# description: Runs unicorn and resque for nginx integration.
+
+# Related (kudos @4sak3n0ne):
+# https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
+# https://gist.github.com/3062860
+
+# Include RedHat function library
+. /etc/rc.d/init.d/functions
+
+# The name of the service
+NAME=gitlab
+
+# The username and path to the gitlab source
+USER=$NAME
+APP_PATH=/home/$USER/gitlab
+
+# The PID and LOCK files used by unicorn and resque
+UPID=$APP_PATH/tmp/pids/unicorn.pid
+ULOCK=/var/lock/subsys/unicorn
+RPID=$APP_PATH/tmp/pids/resque_worker.pid
+RLOCK=/var/lock/subsys/resque
+
+# The options to use when running unicorn
+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 && export PATH && "
+
+start() {
+ cd $APP_PATH
+
+ # Start unicorn
+ echo -n $"Starting unicorn: "
+ daemon --pidfile=$UPID --user=$USER "$RUBY_PATH_PATCH bundle exec unicorn_rails $OPTS"
+ [ $? -eq 0 ] && touch $ULOCK
+ echo
+
+ # Start resque
+ echo -n $"Starting resque: "
+ daemon --pidfile=$RPID --user=$USER "$RUBY_PATH_PATCH ./resque.sh"
+ [ $? -eq 0 ] && touch $RLOCK
+ echo
+}
+
+stop() {
+ cd $APP_PATH
+
+ # Stop unicorn
+ echo -n $"Stopping unicorn: "
+ killproc -p $UPID
+ [ $? -eq 0 ] && rm -f $ULOCK
+ echo
+
+ # Stop resque
+ echo -n $"Stopping resque: "
+ killproc -p $RPID
+ [ $? -eq 0 ] && rm -f $RLOCK
+ echo
+}
+
+c_status() {
+ status -p $UPID unicorn
+ status -p $RPID resque
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ c_status
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|status|restart)" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
View
9 nginx/ReadMe-CentOS.md
@@ -0,0 +1,9 @@
+# CentOS related Nginx notes
+
+If nginx installed through package manager, adjust sites in conf.d instead of sites-enabled.
+
+Set user gitlab in group root for user in nginx.conf:
+
+ #user nginx;
+ user gitlab root;
+
View
3 nginx/gitlab
@@ -24,7 +24,10 @@ server {
# 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 $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;

0 comments on commit 97fd28a

Please sign in to comment.
Something went wrong with that request. Please try again.