rvm & startup script
Created by: drutalj
I'm playing with rvm and gitlab and i installed it successfully, almost :) The problem is init.d script:
:/etc/init.d/gitlab start
bash: bundle: command not found
GitLab service started
So, I putted the line:
source /home/rubyrvm/.rvm/scripts/rvm
somewhere at the beginning of the script, and now I have:
:/etc/init.d/gitlab start
bash: bundle: command not found
GitLab service started
When I change the line:
execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
to
RAILS_ENV=production bundle exec puma $DAEMON_OPTS
i get:
:/etc/init.d/gitlab start
Puma starting in single mode...
* Version 2.3.1, codename: Delicious Thin Mints
* Min threads: 0, max threads: 16
* Environment: production
* Listening on unix:///home/git/gitlab/tmp/sockets/gitlab.socket
* Daemonizing...
GitLab service started
but when I check:
:source /home/rubyrvm/.rvm/scripts/rvm
:bundle exec rake gitlab:check RAILS_ENV=production
I get:
Running? ... no
Try fixing it:
sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production
For more information see:
doc/install/installation.md in section "Install Init Script"
see log/sidekiq.log for possible errors
Please fix the error above and rerun the checks.
When I execute:
:source /home/rubyrvm/.rvm/scripts/rvm
:bundle exec rake sidekiq:start RAILS_ENV=production
:bundle exec rake gitlab:check RAILS_ENV=production
I get:
Running? ... yes
How can I change init.d script to work properly? Is the script which uses
bundle exec rake sidekiq:start RAILS_ENV=production
and
bundle exec rake sidekiq:stop RAILS_ENV=production
completely wrong? Something like this:
#!/bin/sh
if [[ -z "$1" ]] ; then
echo "Usage: gitlab {start|stop|restart}"
exit
fi
if [[ "$1" = "restart" ]] ; then
/etc/init.d/gitlab stop
/etc/init.d/gitlab start
exit
fi
source /home/rubyrvm/.rvm/scripts/rvm
if [[ "$1" = "start" ]] ; then
echo "Starting..."
cd /home/git/gitlab
bundle exec rake sidekiq:start RAILS_ENV=production
exit
fi
if [[ "$1" = "stop" ]] ; then
echo "Stoping..."
cd /home/git/gitlab
bundle exec rake sidekiq:stop RAILS_ENV=production
exit
fi