I am working on M.Hartl's rails tutorial and I opted out for using the cloud9 IDE instead of the local server in order to focus on learning rails and not worry about working on the server.
This is the crash error that I am getting:
thermobee:~/workspace/sample_app (filling-in-layout) $ rails s -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-12-15 05:19:02] INFO WEBrick 1.3.1
[2015-12-15 05:19:02] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
[2015-12-15 05:19:02] INFO WEBrick::HTTPServer#start: pid=14300 port=8080
Started GET "/" for 174.113.76.61 at 2015-12-15 05:19:25 +0000
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.erb within layouts/application (192.2ms)
Killed
It kept happening throughout the day. I would add code and it would sometimes get stuck saving the file and sometimes it the server would get killed as I try to view the work I've done so far. Every time I would get stuck at a different point as I kept deleting the git branch I was working on.
I apologize for the long winded question, but I did not know how to formulate this properly as there has been a lot going on. I can provide any files that would help solve this and I can also give you read access to the IDE files as well.
Related
I'm relatively new the coding world so apologies upfront if this is vague or i'm mis using some jargon...
I am trying to create a new application using Ruby on Rails. Having created the app, I went to run it on my local machine by typing rails server but it seems as though the server won't complete..any thoughts? I only get as far as the below and then nothing else materialises to indicate the server has successfully completed... I've tried shutting down the server and trying again but no luck
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2017-04-29 15:58:45] INFO WEBrick 1.3.1
[2017-04-29 15:58:45] INFO ruby 2.3.1 (2016-04-26) [x86_64-darwin16]
[2017-04-29 15:58:45] INFO WEBrick::HTTPServer#start: pid=1493 port=3000
after running "rails server" on my mac to start my application, my terminal does not allow me to write commands in the terminal. All I get is the following, with the problem that I can not write any commands.
Last login: Mon Jan 2 13:19:07 on ttys001
Nicholass-MacBook-Pro:~ nicholaswenzel$ cd last_test
Nicholass-MacBook-Pro:last_test nicholaswenzel$ cd nofuckingidea
Nicholass-MacBook-Pro:nofuckingidea nicholaswenzel$ rails s
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2017-01-02 13:23:18] INFO WEBrick 1.3.1
[2017-01-02 13:23:18] INFO ruby 2.2.3 (2015-08-18) [x86_64-darwin15]
[2017-01-02 13:23:18] INFO WEBrick::HTTPServer#start: pid=8743 port=3000
Can anyone help?
You can start your server in a background:
rails server &
But, usually, this problem can be resolving by starting an additional terminal process (open new terminal window or tab). In this case, you'll be able to see server logs in runtime.
Before you mark this as a duplicate, know that the difference between this question and the other questions is there are no errors in the console or logs for me!
=> Booting WEBrick
=> Rails 5.0.0.alpha application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-10-25 17:32:22] INFO WEBrick 1.3.1
[2015-10-25 17:32:22] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin14]
[2015-10-25 17:32:22] INFO WEBrick::HTTPServer#start: pid=33823 port=3000
Started GET "/" for 127.0.0.1 at 2015-10-25 17:32:35 -040
Produces a 500 internal server error: "We're sorry but something went wrong. If you are the application owner check the logs for more information."
I've tried:
changing the rack version to 1.6.2 (ruby requires >2.0)
using a different port
binding the rails server to localhost
hitting 127.0.0.1:3000, 0.0.0.1:3000, etc
Any ideas?
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.
In trying to debug another problem, I've tried starting up my Heroku Rails app from the command line using heroku run rails server. The output seems fine, as follows, but attempts to connect to it from the browser fail. If I don't specify a port number, I get the generic "application error" page from Heroku. If I try to connect on port 3000, the browser tells me it cannot connect.
Here's the output to the console after starting up the server:
Running `rails server` attached to terminal... up, run.9912
=> Booting WEBrick
=> Rails 4.0.1 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-11-18 01:52:55] INFO WEBrick 1.3.1
[2013-11-18 01:52:55] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux]
[2013-11-18 01:52:55] INFO WEBrick::HTTPServer#start: pid=2 port=3000
I did note the all zeros IP address.
I am unaware of any ability to run Heroku in the fashion you describe. In my experience, you deploy when you push your code the the Git remote on Heroku, and the code runs according to the Procfile you provide in the codebase. Then Heroku configures all kinds of environment settings to enable your app to run properly.
Once there, you can also do a heroku restart for whatever reason.
Incidentally, you probably would be better off ditching WEBrick for Unicorn or Thin.
If seems you're running your app like a localhost process from Heroku...If I'm not mistaken.
Why don't you just run through
heroku run ps:scale web=1