Any way to run byebug under passenger + nginx? - ruby-on-rails

I developed a simple rails app which works in development environment under WEBrick. However, when I move to production environment it doesn't work. I fixed trivial errors relating to assets and things. However, some things just don't work. It would be extremely helpful to be able to see what is going on interactively with debugger.
I can insert byebug in the code, and it pauses code from running, but since neither passenger nor nginx logs to STDOUT (by default) I can't get to the byebug prompt. (and neither read STDIN)
Is there a way to run byebug under passenger + nginx?
Edit
This time my issue was related to https.

Passenger author here. Byebug integration is available in Passenger Enterprise: https://www.phusionpassenger.com/library/admin/nginx/debugging_console/ruby/

You can use https://github.com/davejamesmiller/ruby-debug-passenger
This adds a rake task, just run 'rake debug' and you'll be connected to your code at the point where it hits byebug

Related

Running byebug with Heroku Local

I'm trying to run byebug so that it works with Heroku Local.
By default, the breakpoints don't give me access to an irb console like they might if I was using rails s. I tried byebug's remote debugging as described here but something about running the byebug server slows my local server down to a crawl and it's unusable. Is there anyway to get byebug to work with Heroku Local? Is there any alternative debugging solution that works well for Rails and Heroku Local?

Curl::Err::HostResolutionError (Couldn't resolve host name)

I'm running Rails 3.0 with a custom Devise authentication strategy that makes an SSL call using Curb. I get an "Curl::Err::HostResolutionError (Couldn't resolve host name)" error. Works fine manually from the command line.
The production environment is Apache running Passenger standalone with rvm 1.9.2#rails3, because the main Passenger is running ruby 1.8.7 and rails 2.3.4. I don't get this error with the my other app running the earlier versions of ruby and rails. Same code, but the difference seems to be Devise.
I've read elsewhere that this might have something to do with DNS and Apache, but I can't for the life of me figure this out and I'm really grasping at straws here. Any ideas would be greatly appreciated! Thanks in advance!
The issue actually turned out to be related to user permissions. When I ssh in with my user account and start Passenger standalone, no problem. When I start it remotely from Capistrano with the deploy user I get the error.

Rails locale development server "rails s" to serve multiple request at the same time

Windows 7, Rails 3 here. I local/development mode, rails server does not handle multiple request at the same time. The process crash and the cmd prompt comes in front.
I've noticed this behaviour when :
having too much ajax request, too close from one another
loading a simple page on 2 browsers
Is there a way workaround that ? Change the local server (default is webrick) ? How is that done ?
Thanks.
I don't know if this still needs an answer but I did this by adding gem 'puma' to the Gemfile then you'll need to add config.threadsafe! to either your config/application.rb or the environment file you're running on (like config/environments/development.rb.
Sometimes you might not want threadsafe on so I so did this in my development.rb:
if ENV["THREADS"]
config.threadsafe!
end
Now (with what I did in my development.rb) I can do rails s Puma and it will run with a max of 16 threads and can handle multiple requests. You can also up the thread pool and configure more with Puma, docs are here
Update
Note that the use of config.threadsafe! is not needed in Rails 4+ and is deprecated I believe.
You need to install the mongrel gem and this specify which server you want to use when you rails s
I don't know how you guys do it on win systems. Why not run a virtual Unix box? isn't rails just much easier with it? So with Unix it would be something like:
Install mongrel gem:
gem install mongrel
Then specify which server you want to run:
rails server mongrel

Terminal says delayed_job starting, but not doing anything

I have an app that works perfectly on my local machine and am deploying it now. I have the VPS all set up and it pretty much works, as well. My problem comes from not being able to start delayed_job. I do the "ruby script/delayed_job start RAILS_ENV=production" while SSHd to the app and it returns "delayed_job: process with pid 11547 started." When I look for the process in htop, I can't find it.
So I dug around and read that Monit can keep delayed_job going. I set that up, hoping I could start up the delayed_job that way. There's no delayed_job.pid, though, so I didn't get far. I ended up setting up nginx and mysql in it, though, and would like to finish setting up delayed_job. The lack of delayed_job.pid gets in the way.
When I SSH into the app and run "rake jobs:work RAILS_ENV=production", everything works just fine. So I'm pretty sure the app itself is fine.
I'm using collectiveidea's delayed_job. Thanks for any help.
It turns out that there's a problem with the daemons gem. Using the ghazel-daemons fork works perfectly. Now onto setting up Monit.
In my case, I just declare that it must use version 1.0.10 of daemons in the Gemfile:
gem "daemons", "= 1.0.10"
Which is the previous version of daemons from 2008.

RoR app running on mongrel development but not production

This is my first stab at Ruby on Rails. Just deployed a very simple app to Heroku.
The thing is that my app runs flawlessly on mongrel development; When I run it with "mongrel_rails start -e production" however, I get the error "We're sorry, but something went wrong."
For the life of me, I couldn't debug this. Heroku logs is not returning anything, the Exceptional addon in Heroku is not returning anything, and I cannot find mongrel.log on my Windows machine (when I run mongrel using: mongrel_rails start -e production -d"
I'm using Rails 2.3.5 and sqlite3 with bundler to pack my gems.
I was told that probably rails is not booting up correctly. I can't find any other way to diagnose this. Any ideas?
Thanks,
ANaimi
Take a look at your log/production.log file. That should contain detailed information about what's going on. It will usually contain a line that specifies the name of a gem that needs to be installed.
Heroku doesn't use mongrel, so I'm assuming that's what you're trying to do to figure out why it isn't working when you push it to heroku.
I've found, in most cases, my heroku problems have been because of uninstalled gems. Make sure you create a gem manifest.
Try tailing logs while booting up. From the terminal in the log directory do: tail -f *.log and then launch the app from another terminal (likely it's development.log since you're probably running in development mode.)
Not sure if this got definitively answered, however, check your '%app_root%/config/environments/' folder, and compare 'development.rb' to 'production.rb'.
Make sure that you have all necessary settings in the production.rb file - might have missed something important there.

Resources