local rails engine running server but not console - ruby-on-rails

An application can start the Thin web server
rails s
However, launching the console
rails c
hangs and never returns to a prompt.
Obviously, I need it to run!
note 1: I believe this is a consequence of an external disk that houses the application, that lost its connection to the main computer
note 2: I had read incidentally that the spring gem has some un-robust behaviours. Could this be a motive?

run following command & it should be fix
spring stop

Related

How to quit a Ruby on Raily server?

Inside a test environment I am using the wash_out GEM within a Ruby on Rails server to run a SOAP service that serves as a Proxy between two different transfer protocols.
At the end of the test run, I would like to quit the Rails server with a dedicated SOAP request.
So I implemented such a request and called inside the request exit(0). But it seems to me that exit and abort functions are hooked away because of security or other reasons.
One might argue that terminating the service within a request is a little bit harsh, but at that point I do not care how the service gets terminated. Since it does not hold any state.
I would like to avoid to patch the Rails sources so that it is later easier to update the GEMSs.
Edit:
The server is running (unfortunately) on Windows.
You could execute shell script and kill running rails process. For example if you running service on unicorn you could do something like
def exit_app
%x(kill -9 $(cat tmp/pids/unicorn.pid))
end

Action_caching not working when using thin

I have an application running on my development machine using Aptana & Webrick.
If I turn on caching (action_caching, written to tmp/cache), it works fine, but when I deploy the application to the testserver (running thin instead of webrick) the caching does not work...i.e. there are no files written to tmp/cache.
as far as I can tell, the webserver is the only difference here (even running the development-environment on the test server.
any clues?
Okay, so I found the problem: I was running thin as a windows service, which didn't shut down or restart properly when trying to do so in "Services".
Unfortunately without notice. Therefore no changes took effect..
So after restarting the server, the caching-problem dissappeared. running thin now from the command line...

Rails server will not stop and even if it is running it is not working

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

Remote debugging Rails application in Aptana Studio 3

My Rails development IDE is Aptana Studio 3.0.5, running on Windows.
The applications runs on Apache + ModRails (Phusion Passenger) on a separate CentOS Linux machine. I have both Rails 2.x and 3.x applications.
I would like to be able to use the debugger in Aptana Studio (connect to the running application remotely). There are apparently some provisions for this, but I was unable to figure out what I need on the server side (in my Rails application configuration)
I've tried this:
Using Rack::Debug: It creates only unix socket, cannot be connected remotely.
Using ruby-debug directly:
I added this to my /config/environments/development.rb:
if File.exists?(File.join(RAILS_ROOT,'tmp', 'debug.txt'))
require 'ruby-debug'
Debugger.wait_connection = true
Debugger.start_remote("real.hostname", 5000, 5001)
File.delete(File.join(RAILS_ROOT,'tmp', 'debug.txt'))
end
Sprinking my code with debugger statements stop the execution, but I cannot connect to this instance from Aptana, not to port 5000 and not port 5001 (and I don't understand why I need two ports there).
Also, this method would be rather slow and too convoluted even if it worked, I'd like to have a more "integrated" debugging. Is it possible at all?
The old steps for Netbeans are relatively close since Aptana/RadRails and Netbeans share the same debugger core: http://blogs.oracle.com/martink/entry/remote_debugging_debug_whatever_ruby
Basically, run the ruby app using rdebug-ide -p 7000 (or whatever port you want), then inside the IDE, go to Run > Debug configurations. On the left hand side, select "Remote Ruby Debug Session" and then add a new configuration there (the plus icon above the list). Enter the proper host IP/name and port you entered on the command line.

How can I start up a ruby server script when I start up my rails app?

I'd like for a ruby server script that lives in my rails app root folder to accept connections from clients (the clients are not browsers--not that this really matters i guess) and update the db of my rails app while my rails app is running. Therefore, I'd like for it to be told somehow to start running whenever my web server starts serving up my rails app and stop running whenever my web server stops serving my rails app. How can I do this? Is this as simple as putting the name/path of my ruby server script somewhere?
You should look into Foreman, a gem specifically for launching multiple processes in your server environment.

Resources