Skip to content

Instantly share code, notes, and snippets.

@limansky
Last active December 21, 2015 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save limansky/6330226 to your computer and use it in GitHub Desktop.
Save limansky/6330226 to your computer and use it in GitHub Desktop.
GitLab initscript for 6-0
#!/sbin/runscript
# GitLab 5.2 and 5.3 init script for Gentoo Linux
# see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md
GITLAB_BASE=/mnt/data/gitlab/gitlab
GITLAB_USER=gitlab
depend() {
need net redis
}
start() {
ebegin "Starting gitlab unicorn server"
[[ -d ${GITLAB_BASE}/tmp/pids ]] || su $GITLAB_USER -c "mkdir -p ${GITLAB_BASE}/tmp/pids"
start-stop-daemon --start \
--chdir "${GITLAB_BASE}" \
--user "${GITLAB_USER}" \
--background \
--env RAILS_ENV=production \
--exec bundle -- exec unicorn_rails -c ${GITLAB_BASE}/config/unicorn.rb -E production
eend $?
ebegin "Starting gitlab sidekiq"
start-stop-daemon --start \
--chdir "${GITLAB_BASE}" \
--user "${GITLAB_USER}" \
--pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid" \
--background \
--env RAILS_ENV=production \
--exec bundle -- exec rake sidekiq:start
eend $?
}
stop() {
ebegin "Stopping gitlab sidekiq"
start-stop-daemon --stop \
--chdir "${GITLAB_BASE}" \
--user "${GITLAB_USER}" \
--pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid"
eend $?
ebegin "Stopping gitlab unicorn server"
start-stop-daemon --stop \
--chdir "${GITLAB_BASE}" \
--user "${GITLAB_USER}" \
--signal QUIT \
--pidfile "${GITLAB_BASE}/tmp/pids/unicorn.pid"
eend $?
}
@nheine
Copy link

nheine commented Aug 25, 2013

Thanks for this init script. I just installed but have trouble starting and stopping gitlab. Looks like the PIDFILE for unicorn start is missing. I added that and still get crashed reports when I do

rc-status

don't know why, but I think its due to not properly stopping gitlab in the first place. If I do a complete reboot it starts all fine though

@nheine
Copy link

nheine commented Oct 23, 2013

I have put an init script together for gitlab 6.2: https://gist.github.com/nheine/7110844

@miguelitosd
Copy link

I forked and made a version that supports CE-8 and the new gitlab-git-http-server piece.
https://gist.github.com/miguelitosd/dea48b1262f341135b4b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment