Skip to content

Commit fd8e716

Browse files
committed
added CentOS specific scripts
1 parent 9d69ad9 commit fd8e716

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

init.d/ReadMe-CentOS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CentOS daemon scripts for gitlab service
2+
3+
## Related (kudos @4sak3n0ne):
4+
5+
* https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
6+
7+
* https://gist.github.com/3062860
8+
9+
## Notes
10+
11+
Add the service to chkconfig with:
12+
13+
chkconfig -add gitlab
14+
15+
Related services (redis, mysql, nginx) should also be added to chkconfig.
16+
17+
Check chkconfig state with
18+
19+
chkconfig -l
20+
21+
And if any of the services are not set properly, run:
22+
23+
chkconfig --levels 2345 [name] on
24+

init.d/gitlab-centos

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
#
3+
# GitLab
4+
# Maintainer: @elvanja
5+
# App Version: 2.8.2
6+
7+
# chkconfig: 2345 82 55
8+
# processname: unicorn
9+
# processname: rescue
10+
# description: Runs unicorn and resque for nginx integration.
11+
12+
# Related (kudos @4sak3n0ne):
13+
# https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
14+
# https://gist.github.com/3062860
15+
16+
# Include RedHat function library
17+
. /etc/rc.d/init.d/functions
18+
19+
# The name of the service
20+
NAME=gitlab
21+
22+
# The username and path to the gitlab source
23+
USER=$NAME
24+
APP_PATH=/home/$USER/gitlab
25+
26+
# The PID and LOCK files used by unicorn and resque
27+
UPID=$APP_PATH/tmp/pids/unicorn.pid
28+
ULOCK=/var/lock/subsys/unicorn
29+
RPID=$APP_PATH/tmp/pids/resque_worker.pid
30+
RLOCK=/var/lock/subsys/resque
31+
32+
# The options to use when running unicorn
33+
OPTS="-c $APP_PATH/config/unicorn.rb -E production -D"
34+
35+
# Ruby related path update
36+
RUBY_PATH_PATCH="PATH=$PATH:/usr/local/bin:/usr/local/lib && export PATH && "
37+
38+
start() {
39+
cd $APP_PATH
40+
41+
# Start unicorn
42+
echo -n $"Starting unicorn: "
43+
daemon --pidfile=$UPID --user=$USER "$RUBY_PATH_PATCH bundle exec unicorn_rails $OPTS"
44+
[ $? -eq 0 ] && touch $ULOCK
45+
echo
46+
47+
# Start resque
48+
echo -n $"Starting resque: "
49+
daemon --pidfile=$RPID --user=$USER "$RUBY_PATH_PATCH ./resque.sh"
50+
[ $? -eq 0 ] && touch $RLOCK
51+
echo
52+
}
53+
54+
stop() {
55+
cd $APP_PATH
56+
57+
# Stop unicorn
58+
echo -n $"Stopping unicorn: "
59+
killproc -p $UPID
60+
[ $? -eq 0 ] && rm -f $ULOCK
61+
echo
62+
63+
# Stop resque
64+
echo -n $"Stopping resque: "
65+
killproc -p $RPID
66+
[ $? -eq 0 ] && rm -f $RLOCK
67+
echo
68+
}
69+
70+
c_status() {
71+
status -p $UPID unicorn
72+
status -p $RPID resque
73+
}
74+
75+
case "$1" in
76+
start)
77+
start
78+
;;
79+
stop)
80+
stop
81+
;;
82+
status)
83+
c_status
84+
;;
85+
restart)
86+
stop
87+
start
88+
;;
89+
*)
90+
N=/etc/init.d/$NAME
91+
echo "Usage: $N {start|stop|status|restart)" >&2
92+
exit 1
93+
;;
94+
esac
95+
96+
exit 0
97+

nginx/ReadMe-CentOS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CentOS related Nginx notes
2+
3+
If nginx installed through package manager, adjust sites in conf.d instead of sites-enabled.
4+
5+
Set user gitlab in group root for user in nginx.conf:
6+
7+
#user nginx;
8+
user gitlab root;
9+

nginx/gitlab

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ server {
2424
# if a file, which is not found in the root folder is requested,
2525
# then the proxy pass the request to the upsteam (gitlab unicorn)
2626
location @gitlab {
27+
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
28+
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
2729
proxy_redirect off;
30+
2831
proxy_set_header X-Forwarded-Proto $scheme;
2932
proxy_set_header Host $http_host;
3033
proxy_set_header X-Real-IP $remote_addr;

0 commit comments

Comments
 (0)