ysbaddaden / prax

Rack proxy server for development
http://ysbaddaden.github.io/prax/
Other
475 stars 49 forks source link

Applications won't start using RVM #91

Closed catphish closed 10 years ago

catphish commented 10 years ago

I am using RVM and prax will not start any of my applications automatically. The log file only shows the command being run:

bundle exec ruby /opt/prax/bin/../lib/racker/command.rb --server /home/charlie/.prax/_sockets/identity.sock bundle exec ruby /opt/prax/bin/../lib/racker/command.rb --server /home/charlie/.prax/_sockets/identity.sock

Running this command manually in my shell causes the application to start successfully.

I suspect the problem relates to RVM's environment not being loaded, but I am unsure how to fix this.

Thanks!

ysbaddaden commented 10 years ago

Please have a look to #77

catphish commented 10 years ago

Thank you, I fixed this with a fairly simple .praxconfig

rvm_path="$HOME/.rvm/"
source "$rvm_path/scripts/rvm"
cd $PWD

It seems necessary to re-run the CWD after RVM has been loaded.

ysbaddaden commented 10 years ago

It looks like a nice snippet for a wiki page.

victorhazbun commented 10 years ago

After you created the .praxconfig in your home directory, what you did next? what means "CWD"? Thanks @catphish

catphish commented 10 years ago

@victorhazbun87 I followed the normal installation procedure for prax. The only change I had to make was to create the .praxconfig as above and make it executable: chmod +x .praxconfig

CWD means "change working directory" and my script above handles this with the "cd $PWD" command after RVM has been initialized.

ysbaddaden commented 10 years ago

It seems necessary to re-run the CWD after RVM has been loaded.

I understand RVM aliases many shell commands, so it's very likely that the .ruby-version file won't be loaded until cd is executed (ie. it selected the default ruby).