Question

i created ruby environment for user gitlab (rvm ruby python) using this guide: http://wiki.gentoo.org/wiki/GitLab

cat /etc/init.d/gitlab

GITLAB_BASE=/home/gitlab/gitlab
GITLAB_USER=gitlab

depend() {
        need net redis
}

start() {
        ebegin "Starting gitlab unicorn server"
    start-stop-daemon --start \
            --chdir "${GITLAB_BASE}" \
            --user "${GITLAB_USER}" \
            --pidfile "${GITLAB_BASE}/tmp/pids/unicorn.pid" \
            --exec bundle -- exec unicorn_rails -c "${GITLAB_BASE}/config/unicorn.rb" -E                     production -D
    eend $?
    ebegin "Starting gitlab sidekiq"
    start-stop-daemon --start \
            --chdir "${GITLAB_BASE}" \
            --user "${GITLAB_USER}" \
            --pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid" \
            --exec bundle -- exec rake sidekiq:start RAILS_ENV=production
    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}" \
            --pidfile "${GITLAB_BASE}/tmp/pids/unicorn.pid"
    eend $?
}%                                                                        

when i'm starting it i see:

 * Starting gitlab unicorn server ...
 * start-stop-daemon: bundle does not exist                                                                                                                                                          
 * Starting gitlab sidekiq ...
 * start-stop-daemon: bundle does not exist                                                                                                                                                          
 * ERROR: gitlab failed to start

i have got bundle for user gitlab. what i'm doing wrong?

Was it helpful?

Solution

There are two problems here. Firstly, rvm is normally only loaded by the user's shell and that shell isn't being invoked here. Secondly, bundle won't be in the PATH either. To fix both problems, assuming this is a per-user rvm installation, try this...

... --exec /home/gitlab/.rvm/bin/rvm -- default do bundle exec ...

As a side note, you shouldn't use unicorn_rails with Rails 3 applications. Just use plain unicorn instead.

OTHER TIPS

Also, change GITLAB_BASE=/home/gitlab/gitlab to GITLAB_BASE=/home/git/gitlab. This init script is from GitLab 4.2. In 5.0 onwards the user changed from gitlab to git.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top