typicode / hotel

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
MIT License
9.98k stars 422 forks source link

Can't launch `rails server` #31

Closed selfagency closed 8 years ago

selfagency commented 8 years ago

Here's my server json file:

{
  "cwd": "/Users/daniel/Dev/nylon/nylonmag",
  "cmd": "rails server",
  "env": {
    "PATH": "/Users/daniel/.rvm/gems/ruby-2.0.0-p481/bin:/Users/daniel/.rvm/gems/ruby-2.0.0-p481@global/bin:/Users/daniel/.rvm/rubies/ruby-2.0.0-p481/bin:/Users/daniel/.composer/vendor/bin:/usr/local/opt/php56/bin:/Users/daniel/.go/bin:/Applications/VMware:Fusion.app/Contents/Library:/usr/local/MacGPG2/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/Users/daniel/.rvm/bin",
    "PORT": 3000
  }
}

And here's the error I get:

Can't connect to server on port 3000. Server crashed or timeout of 5000ms exceeded. Retry or check logs.

sh -c rails server

/Users/daniel/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'railties' (>= 0) among 15 total gem(s) (Gem::LoadError)
    from /Users/daniel/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
    from /Users/daniel/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /Users/daniel/.rvm/gems/ruby-2.0.0-p481/bin/rails:22:in `
'
    from /Users/daniel/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
    from /Users/daniel/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `
'

I have way more than 15 gems installed, including the one it's looking for:

*** LOCAL GEMS ***

actionmailer (3.2.12)
actionpack (4.2.5, 3.2.12)
actionview (4.2.5)
active_admin_editor (1.1.0)
activeadmin (0.6.0)
activemodel (3.2.12)
activerecord (3.2.12)
activeresource (3.2.12)
activesupport (4.2.5, 3.2.12)
arbre (1.0.1)
arel (3.0.2)
awesome_print (1.6.1)
aws-s3 (0.6.3)
aws-sdk (1.19.0)
aws_cf_signer (0.1.3)
bcrypt-ruby (3.1.2)
better_errors (1.0.1)
bigdecimal (1.2.0)
binding_of_caller (0.7.2)
bourbon (3.1.8)
browser (0.2.1)
builder (3.2.2, 3.0.4)
bundler (1.6.2)
bundler-unload (1.0.2)
cachebar (1.1.1)
climate_control (0.0.3)
cloudinary (1.1.0)
cocaine (0.5.0)
coderay (1.1.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
crass (1.0.2)
daemons (1.1.9)
debug_inspector (0.0.2)
devise (2.2.4)
domain_name (0.5.24)
ejs (1.1.1)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.0.2)
executable-hooks (1.3.2)
faraday (0.8.8)
faraday_middleware (0.9.0)
fastercsv (1.5.5)
formtastic (2.2.1)
gem-wrappers (1.2.7, 1.2.4)
haml (4.0.3)
haml-rails (0.4)
has_scope (0.6.0.rc)
hashie (2.0.5)
hike (1.2.3)
http-cookie (1.0.2)
httparty (0.8.3)
i18n (0.7.0)
inherited_resources (1.4.1)
instagram (0.10.0)
io-console (0.4.2)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.8.0, 1.7.7)
just-datetime-picker (0.0.6)
kaminari (0.14.1)
loofah (2.1.0.rc2)
mail (2.4.4)
meta_search (1.1.3)
mime-types (1.25)
mini_portile2 (2.1.0)
minitest (5.8.3, 4.3.2)
multi_json (1.8.2)
multi_xml (0.5.5)
multipart-post (1.2.0)
mysql2 (0.4.2, 0.3.13)
netrc (0.10.3)
newrelic_rpm (3.11.2.286)
nokogiri (1.6.8.rc2, 1.5.11)
orm_adapter (0.4.0)
paperclip (3.4.2)
paperclip-ffmpeg (1.0.0)
paperclip-meta (0.4.3)
polyamorous (0.5.0)
polyglot (0.3.3)
psych (2.0.0)
rack (1.6.4, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.12)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-html-sanitizer (1.0.2)
railties (3.2.12)
rainbow (2.0.0)
rake (10.4.2, 0.9.6)
rdoc (4.0.0, 3.12.2)
redis (3.2.1)
redis-namespace (1.5.1)
responders (1.0.0)
rest-client (1.8.0)
retryable-rb (1.1.0)
rubygems-bundler (1.4.4)
rubypress (1.1.0)
rvm (1.11.3.9)
sass (3.4.21, 3.2.12)
sass-rails (3.2.6)
scss_lint (0.43.2)
sitemap_generator (5.0.2)
sprockets (2.2.2)
ssl_requirement (0.1.0)
test-unit (2.0.0.0)
thin (1.5.1)
thor (0.18.1)
thread_safe (0.3.5)
tilt (1.4.1)
tinymce-rails (4.0.26)
treetop (1.4.15)
tzinfo (1.2.2, 0.3.38)
uglifier (2.2.1)
unf (0.1.4)
unf_ext (0.0.7.1)
uuidtools (2.1.4)
warden (1.2.3)
typicode commented 8 years ago

Could you try this please?

hotel add 'rails server --port $PORT' -e GEM_PATH

As far as I remember, I think that rvm also modifies GEM_PATH.

-e will add GEM_PATH to the <server>.json config file.

joshuaswilcox commented 8 years ago

That didn't fix it for me, still getting an error, a different one, but another error.

Bundler::GitError: {INTERNAL COMPANY GEM} is not yet checked out. Run `bundle install` first

after doing

hotel add 'bundle exec rails server' -p 3000 -o app.log -e GEM_PATH

with a config of:

{
  "cwd": "/Users/jwilcox/webapps/appname",
  "cmd": "bundle exec rails server",
  "out": "app.log",
  "env": {
    "PATH": "/Users/jwilcox/.rvm/gems/jruby-1.7.13/bin:/Users/jwilcox/.rvm/gems/jruby-1.7.13@global/bin:/Users/jwilcox/.rvm/rubies/jruby-1.7.13/bin:/Users/jwilcox/.rvm/bin:/Users/jwilcox/.jenv/shims:/Users/jwilcox/.jenv/bin:/Users/jwilcox/bin:/usr/local/Cellar/php55/5.5.33/sbin:/Users/jwilcox/lunasa/jsp/lib:~/.cabal/bin:/Users/jwilcox/Library/Haskell/bin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jwilcox/gocode/bin:/Applications/P4Merge.app/Contents/MacOS:/usr/local/bin/elixir/bin",
    "GEM_PATH": "/Users/jwilcox/.rvm/gems/jruby-1.7.13:/Users/jwilcox/.rvm/gems/jruby-1.7.13@global",
    "PORT": 3000
  }
}%
typicode commented 8 years ago

Hi,

I'm not familiar with this error.

Does running bundle install and restarting the project from hotel.dev/localhost:2000 makes a difference?

Can I reproduce if I install Rails, JRuby and create a new Rails project or do I need to install other things?

joshuaswilcox commented 8 years ago

Running bundle install does not help, the app starts fine when manually running rails s. Interestingly it is only happening with jRuby, MRI ruby seems to work fine. You might be able to reproduce if you install jruby with RVM (i think that might be part of the problem), and Rails, shouldn't need anything else

typicode commented 8 years ago

Thank you for the feedback. Hotel does nothing special except running cmd with the provided environment env. So I guess it must be related to some environment variable. I'll give it a try.

jalada commented 8 years ago

I use RVM (and foreman, though that's less relevant) for my Ruby projects and I managed to get mine to start using the command:

hotel add 'foreman start' -e GEM_HOME

I may end up adding other environment variables, but GEM_HOME and PATH were enough for me for now.

mattvague commented 8 years ago

For anyone still stuck, the following worked for me: hotel add 'rails server --port $PORT -b 127.0.0.1'