Im usuing standart WEBrick server in my development environment
1) I run server via rails s
2) Then I do ctrl-C to shut it down
3) Use rails s one more time and following error appears
Therefore, each time I have to restart server, I kill process from /tmp/pids/server.pid and delete .pid file, which is an pain...
Any ideas why this might happens?
Since you are in RubyMine (RM), my suggestion would be to (slightly) alter how you use/control your server.
Instead of opening a Terminal and typing rails s, use the available server configuration from RM.
When chosen, it will start your server and give you a new panel just for controlling your server:
The cool thing here is that there is a start/restart button (showing the restart icon in my screen shot since I just started the server). When you're ready to restart the server for any reason, just open this panel and click that restart button (or click the stop button and then click the start icon if you prefer).
I've had a few little, niggling issue with RM's implementation of a Terminal but never had issues with my server management from RM using this approach.
I did notice in your original screenshot that you do have two Terminal windows open (Local and Local(1)). If you stick with the Terminal approach to server management in RubyMine, that may be part of the issue (I recall getting myself into 'trouble' in particular when I opened multiple Terminal shells in RM)
Related
Recently I migrated my workspace from the old Cloud9 to AWS Cloud9. Now I can no longer run my application. I'm hoping somebody on Stack Overflow might have an idea what the problem is because AWS' help forums and documentations skip past the parts I'm missing.
The "Run" button tries run the last file that I was viewing and editing, rather than my application as a whole.
So I try to start it running in the terminal with "rails s -b $IP -p $PORT". I get this line:
Listening on tcp://127.0.0.1:8080
So the program should be running, right? But the green "Run" button is now disabled, and I don't get the spinning icon in my terminal window that I used to get with old Cloud9.
Next I try getting the application's url from the "Share" menu, which is:
18.212.63.5
When I try to navigate to this url in another window, I get an error
ERR_CONNECTION_TIMED_OUT
When I try to "Preview Running Application" with the IDE, I get the error
66af0558a4b44f8bb019cb5628f6b28f.vfs.cloud9.us-east-1.amazonaws.com refused to connect.
In related news, I'm highly frustrated with AWS for a lot of other reasons. Should I consider switching to a different IDE? Or keep trying to learn this one?
Thank you in advance for any insight.
See also https://forums.aws.amazon.com/thread.jspa?messageID=899522, which provides a set of diagnostic commands that you can run from a terminal session in the AWS Cloud9 IDE for your development environment that can output the incoming traffic rules for the environment's associated Amazon EC2 instance's security group and network ACL. These traffic rules need to allow incoming traffic for the correct protocol and port.
I had what I believe was a similar problem. The preview won't show if the app is being served over http, rather than https:
https://docs.aws.amazon.com/cloud9/latest/user-guide/troubleshooting.html#troubleshooting-app-preview-http
A simple workaround here is just to remove the 's' from the amazonaws.com URL listed in the 'refused to connect' error, and then press the button to preview the application in a browser tab.
Also note that on AWS C9 you shouldn't need
rails s -b $IP -p $PORT
It should usually be enough to do
rails server
(though check that, for example, your puma.rb file is set to run on port 8080 rather than 3000)
How do I close the old server even though I can't see its terminal anymore so I can access my project?
I tried exiting out of the program then exiting back in but nothing would work.
keeps bringing up this error:
A server is already running. Check C:/Users/Nathan/Documents/Aptana Studio 3 Workspace/Nathans First project/tmp/pids/server.pid.
Exiting
Use netstat to find the process id running on the port the server has bound to. Then kill that process.
run cmd.exe as administrator.
To list process
C:\> netstat -a -b
Find the process id that is bound to the port your server runs on
C:\> Taskkill /PID <the process id (pid) of the server> /F
can you visit your app from the url 127.0.0.1:3000, 3000 is the port your app suppose to be running.
Case 1. if you can visit at the location, then use the activity monitor or something like that , find the ruby process and kill it.
Case 2. if you can not visit, then just delete the file C:/Users/Nathan/Documents/Aptana Studio 3 Workspace/Nathans First project/tmp/pids/server.pid will be fixed this problem. It is cause by a abnormal server exist like you shutdown your computer without shutdown the server normally.
Check you tmp/pids/server.pid file under your app which wil have the process id of other instance of rails server currently running. First kill that process using kill -9 process_id in your linux terminal. Check how to kill a process for your particular version
Delete the server.pid file in the C:/Users/Nathan/Documents/Aptana Studio 3 Workspace/Nathans First project/tmp/pids/ directory and restart the server.
Make sure you close the command prompt window and open it again before restarting the server.
Hope this helps!
I am new to Ruby on Rails, but I managed to install it using the RailsInstaller and I am using Aptana Studio 3 as a text editor. I am on a Windows 7 x64.
Last week I managed to create a simple Hello world project, and it worked as it should when starting and stopping the rails server. To start the server I used the command rails server and to stop it I used CTRL+C.
Somehow, this week, when I'm trying to start the server it says "A server is already running". But, when I go to the correct page in a web browser it doesn't work. I get the error "Google Chrome could not connect to localhost:3010". So, this makes it seem like the server is not working, even though it supposedly is running.
So, I then try to stop the server from running, but CTRL+C doesn't seem to do anything. It doesn't give any kind of message at all when I input that, it just skips to a new line in the terminal window.
the standard port is 3000.
You can kill the server in the task manager and start it from new..
There is probably a rails process still running but bugged out/crashed. Try looking at the processes in the windows task manager to for a rails process, and cancel it. Additionally you can start a rails process on a different port with rails server -p PORT
I have a rails app running in 2 different locations. The first is a developer VM. When I run the app on a thin server there, I can visit it from my desktop PC. I also have the app running with (as far as I can tell) an identical configuration on another VM. I am unable to view the site from my desktop when I try to connect there. Can anybody think of a reason? I do have an Apache server running on the 2nd VM, is that an issue?
The exact nature of the failure is that when trying to connect from another location, the browser just never responds. It doesn't display an error message or give a 404. The loading graphic on the tab just continues to spin.
Thanks.
I'm very new with Rails and I've installed Vagrant to run the Rails server. I've started the server and am able to load localhost:3000, now I don't know where to go. The command line is blank and I read that I should type in "script/console", but all I can really do is ctrl-C or -d.
When I tried to run Vagrant in a separate Window with "vagrant up" it says I need to do "Vagrant init"
Where do I go from here so that I can start going through my tutorials/start developing?
This screencast from RailsCasts should get you started. Some of the suggestions are a bit out-dated but by reading the show notes and comments, you should be able to get up and running. From there you can modify.
While getting Rails set up initially with Vagrant will be work, it's an incredibly handy tool to have experience with. It becomes even more useful when you incorporate a provisioning tool like Puppet.
In your terminal if you are running the webrick server via rails server you either need to background it or open a new terminal to get your shell prompt back. If you ctrl-C out of it you will kill the server. Keep in mind, the webrick server should only be used for local development. It's not a production level web server. See the Rails Getting Started guide for more details.
If you are going to run your rails server in a Vagrant VM, you'll need to configure the port forward in your Vagrantfile so you can access from your host machine.
config.vm.forward_port 3000, 9080
There error you are seeing would be from you running vagrant up in a directory that doesn't contain a Vagrantfile.