I'm trying to start my first production rails server on DigitalOcean but after
$ rails server — binding=my_Droplet_ip_address
i get this error
Exiting
/home/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler.rb:78:in `require': cannot load such file -- rack/handler/— (LoadError)
from /home/glaux/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler.rb:78:in `try_require'
from /home/glaux/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler.rb:16:in `get'
from /home/glaux/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:290:in `server'
And so on.
App works fine locally and simple rails s on server also works fine.
I have Ubuntu 14.04 server with postgres, nginx and passenger.
I'm a complete newbie to it and I may have missed something important. So tell me if you want me to provide any other info on this matter.
Just try rails s -b 0.0.0.0
And stop previous port 3000 used by rails
To stop previous port. Try this command
Lsof wni -p 3000
If you are running on 3000 port
Related
When generating toy_app using scaffolding I can go to the root site using the local server, but when I try to go to the page /users I get the following error message: "Errno::ENOENT in UsersController#index"
The page should allow me to enter a new user.
When I try to restart the server and run rails server -b $IP -p $PORTI get the following:
sunny_dee#rails-tutorial:~/workspace/toy_app (master) $ rails server -b $IP -p $PORT
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-04-27 18:06:55] INFO WEBrick 1.3.1
[2015-04-27 18:06:55] INFO ruby 2.1.5 (2014-11-13) [x86_64-linux]
Exiting
/usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/socket.rb:206:in `bind': Address already in use - bind(2) for 0.0.0.0:8080 (Errno::EADDRINUSE)
I finally got it to work by restarting the workspace. I'm guessing that is what restarted the local server. I was trying Ctrl-C but it was not working.
The tutorial uses Cloud9 and since it's a cloud IDE closing/logging out did nothing but when I clicked on the button to the left of "Share" on the top right corner and the clicked on "Restart" the page ran correctly.
Hopefully my stupid question can help someone else as well. Thanks everyone that took the time to contribute :)
If you running this application in your local Linux system just use -
rails server
Then you can access your site using http://localhost:3000/
You can also specify which port to run on using this command -
rails s -p 3001 -P tmp/pids/server2.pid
Then you can access using 3001 port.
You are getting that error because your 8080 port is already in use by some other process.
I am using private_pub gem for live chat in my rails 3.2 application and it is working perfectly on development mode but I am stuck at how to do it on production.
I am using apache2 in production. When I ran this command on server
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production
It starts the thin server but my app keeps on waiting for response from
http://www.example.com:9292/faye.js
It doesn't do anything. I am unable to connect with faye in prodution
Thanks for help in advance
Thin and Apache need to be set up running on different ports.
The default settings for both should work, but you should double
check. Ensure apache is running under port 80 and thin is using port
9292. These numbers should be visible when the servers start up.
In the end you should be able to access faye.js at
http://yoursite.com:9292/faye.js and your site at http://yoursite.com/
Source: https://stackoverflow.com/a/6667347/539075
I'm trying to start the web server for a rails app on a Cloud9 IDE workspace and I'm receiving this error message:
`require': cannot load such file -- rack/handler/server (LoadError)
This is the code that I am running:
rails s -p $PORT -b $IP server
I'm very new to Ruby on Rails so my apologies if this pretty simple.
You're running
$ rails s -p $PORT -b $IP server
when it should just be
$ rails s -p $PORT -b $IP
You probably added an extraneous server because you're used to running rails server, but rails s is just a shorthand for the former.
It looks like the extra argument to rails is causing it to look for a file named server in rack/handler, and when it doesn't find a file it throws an error.
I am using following command for start the production server.
nohup ruby script/server webrick -e production &
My Rails applications start with port number in URL, like this one:
http://myapp.com:3000/
How to remove port no from the app URL? I think I need to install something like Passenger, If so anyone suggest me a good tutorial.
PS: My rails App hosted in http://dreamhost.com and I am using Rails 2.3r
In a production environment you probably want to use passenger instead of doing things by yourself.
"No port" for HTTP means port 80, so specify that with the -p 80 or --port=80:
nohup ruby script/server webrick -e production -p 80 &
You don't need Passenger, but using it can make things easier to manage for smaller apps and requires less babysitting.
Running Ubuntu Server 10.04 with Rails 2.3.4 and Webrick 1.3.1; our rails app runs fine when called via script/server -e production, but trying to test it as a daemon by calling it with the -d flag produces the following output:
=> Booting WEBrick
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
Nothing is produced in the logs, and other Rails applications will run detached without issue.
I assume You are running the Webrick in port 3000
>>$ sudo netstat -anp | grep 3000
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 8822/ruby
>>$ sudo kill -9 8822
I don't mean to contradict your choosing Webrick as a production server and maybe there is something I'm missing about why you are choosing Webrick, but have you considered other alternatives? I'd wager you already know all of this, but Webrick is the provided ruby server, and it is also the slowest ruby server choice.
Some of the most popular production server choices are:
Passenger
Thin
Mongrel
Unicorn
Glassfish
Passenger is likely the most popular choice for production now due to its easy configuration, speed, and features.
If there is a specific use case for Webrick that makes it better than any of the other server choices, I'd love to know.
You can add patch to enable error log here: https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/core_ext/process/daemon.rb#L16
To
unless noclose
STDIN.reopen "/dev/null" # Free file descriptors and
STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.
STDERR.reopen '/tmp/rails_daemon_err.log', 'a'
end
Now when you start rails server with -d, the error log will append to /tmp/rails_daemon.log.