Closed terlar closed 10 years ago
Maybe it fails because of 55d49a0c0611c9fdaa2c7ab37f2e9e239e9a3d01 —bundle being ruby may need a shell environment for the ruby version manager to work correctly, or something.
I moved the bundle exec logic from Prax::Application to the racker script in branch bug/62. Does it fix the problem?
Nope, issue is still present, now I also had to add a .praxrc
file to the ruby project to get the ruby version-switch working. Worked without that before.
When I debug the Prax::Application#spawn
now and log PATH
from env
. Now it shows my default ruby version. Before it used the one done by my ruby switcher.
That's not such a big issue though, but unfortunally the bundler
/gem
error persists.
Any tip on how I can help solve/debug this?
This test passes for me with rbenv —bundler requires sinatra 1.0 while the globally installed one is 1.4.
The point of the spawn + shell script is to reset the environment, so ruby switchers can do their job for each application. Sourcing both chruby.sh
and auto.sh
in ~/.praxconfig
should do the trick globally.
I tested with various applications with various ruby versions and bundler packages, and they all run great using rbenv.
Yeah, I'm using my own switcher fry
which is written in fish-shell, so guess that could be the cause. Running the test suite; all tests pass except that last one. Will do some more debugging to see what's going on.
I tried not using any ruby switcher and still got the same error.
I manually set this in my .praxrc
in the project directory.
export PATH="/home/terje/.rubies/1.9.3-p392/bin:$PATH"
And I switched my shell to bash
to rule out fish-shell
troubles.
I tried to do the same: I disabled rbenv and started a clean bash shell, with exported GEM_HOME
and PATH
to point to my installation of ruby and the test suite passes.
Did you bundle install
in test/hosts/bundler
?
Here is my environment:
What's your GEM_HOME
?
It still fails for me.
My environment:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /home/terje/.rubies/1.9.3-p392/bin/ruby
- EXECUTABLE DIRECTORY: /home/terje/.rubies/1.9.3-p392/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1
- /home/terje/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
$ echo $PATH
/home/terje/.rubies/1.9.3-p392/bin:/home/terje/.local/bin:/home/terje/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/core_perl
Running test:
$ cd .prax-dist
$ bundle exec rake test
/home/terje/.rubies/1.9.3-p392/bin/ruby -I"lib:test" -I"/home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib" "/home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "test/failure_test.rb" "test/microserver_test.rb" "test/microworker_test.rb" "test/proxy_test.rb"
Run options: --seed 52779
# Running:
........F
Finished in 37.072899s, 0.2428 runs/s, 0.7283 assertions/s.
1) Failure:
Proxy#test_0006_supports bundler with special gems [/home/terje/.prax-dist/test/proxy_test.rb:65]:
--- expected
+++ actual
@@ -1 +1,10 @@
-"1.0"
+"<html>
+ <head>
+ <title>Can't start application bundler</title>
+ </head>
+ <body>
+ <h1>Can't start application <q>bundler</q></h1>
+ <p>Please look at <code>/home/terje/.prax-dist/test/hosts/_logs/bundler.log</code> for details</p>
+ </body>
+</html>
+"
9 runs, 27 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:test" -I"/home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib" "/home/terje/.rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "test/failure_test.rb" "test/microserver_test.rb" "test/microworker_test.rb" "test/proxy_test.rb" ]
Tasks: TOP => test
Thanks for testing. We do have the same configuration (GEM_HOME, PATH, etc).
Is there an error reported in /home/terje/.prax-dist/test/hosts/_logs/bundler.log
?
I have found a way to reproduce it and also get it working. The current implementation is dependant on all gems being installed in the same place. I am however using the following config for bundler:
~/.bundle/config
BUNDLE_PATH: vendor/bundle
BUNDLE_BIN: ./bin
Which means gems are locally installed per project. Somehow when the bundle exec is run through prax it doesn't respect this setting.
Would still be nice to run prax with this bundler setting, since I don't like to litter the global gem-folder with projects specific gems and versions.
I merged #68 yesterday from @suan which I think should fix your problem: I'm resetting the ENV before spawning applications, so version managers aren't influenced by the ruby version Prax is running with.
The problem is that I'm resetting it so hard that not even HOME
was set. Maybe that's the reason why the global bundler configuration is discarded: it's not found.
I guess more environment variables should be kept, like UID
, USER
, HOSTNAME
, LANG
, ...
Yes, it actually seems to work now. Thank you! :bow:
I am running the
unstable
branch and this was working in the master one.The debug output says the following:
In the application specific log:
Inside the project directory:
So bascially what happens is that it tries to look for the bundled
gem
, but outside of the bundle. If I install that gem version globally, then it works.I am willing to debug and fix this if you can point me in the right direction where to look.
Right now I'm mostly looking in the
lib/prax/application.rb
which I figured made most of this work.Edit: If I run this command manually from that directory it works.