0
votes

I trying to start ROR when machine starts.following this link

but when I test my_program script under /etc/init, I got this error message: /home/usr/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)

I googled,and try delete rack 1.5.2 ...it wont work,error message say it cant find rack 1.5.2.Then when I try delete rack 1.5.2 ..some other place got error need rack 1.5.2.

I know in terminal it can be solved by use:bundle exec start but when I put bundle exec in my upstart script it seems cant recognize.

Attached is my upstart script for thin auto start:

env LANG=en_US.UTF-8
env APP_HOME=/home/usr/Trail/testapp-v2


start on runlevel [2345] and started networking
stop on runlevel [!2345] and stopped networking

chdir /home/usr/Trail/testapp-v2
exec /home/usr/.rvm/wrappers/testapp-v2/thin start >> /home/testapp/log/thin.log 2>&1
respawn
respawn limit 1 10

How to modify this

Or what settings I need to make it start thin? Im using ubuntu 12.04

Thanks in advance

1

1 Answers

0
votes

About the "not recognising bundle command" part, I had similar issues with setting RAILS ENV before the actual command, what I did to solve that is forcing it to execute the full command in bash:

exec bash -c '/home/usr/.rvm/wrappers/testapp-v2/bundle exec thin start >> /home/testapp/log/thin.log 2>&1'

or

exec bash -c 'bundle exec /home/usr/.rvm/wrappers/testapp-v2/thin start >> /home/testapp/log/thin.log 2>&1'

Not sure which is the right syntax