Unable to run rails commands due to invalid URI
It turns out that this was a problem with ElasticSearch. The ElasticSearch_URL environment variable was not set, and that led to an invalid URI.
This problem was identified by the numbers ":9200" in the URL, which is the default port that ElasticSearch uses.
Rails: how to debug localhost not responding with delayed_job / foreman
This is only a partial answer, but it might help you with debugging.
Rails buffers logging by default, and flushes it after every web request. One option is to simply replace the logger with a simpler logger
Rails.logger = Logger.new(STDOUT)
You can also configure the buffered logger to flush more often
Rails.logger.auto_flushing = (Rails.env.development? || Rails.env.test?)
You also have to be careful about STDOUT. In my current project I have stdout flushing enabled in both config.ru
and my background bootup (I'm using sidekiq, so the boot process may be a little different)
STDOUT.sync = true
As to your larger problem,
I'm surprised that the rails process is running background tasks. Is there an option to disable that, at least for experimentation?
Then there are the standard debugging tools - all the database calls on save worry me, so I'd try various combinations of disabling them to see if anything improves. Especially with two of them - for instance, if your before_save hook changes a value in the model, it might be trigger a validation; if that resets the before_save hooks, you'd have a loop.
foreman only shows line with “started with pid #” and nothing else
I’ve been able to resolve this issue by 2 different ways:
From https://github.com/ddollar/foreman/wiki/Missing-Output:
If you are not seeing any output from your program, there is a likely
chance that it is buffering stdout. Ruby buffers stdout by default. To
disable this behavior, add this code as early as possible in your
program:# ruby
$stdout.sync = trueBy installing foreman via the heroku toolbelt package
But I still don’t know what’s happening nor why this 2 ways above resolved the issue…
Related Topics
An Error Occurred While Installing Debugger-Linecache (1.1.1), and Bundler Cannot Continue
Ruby Singleton Methods with (Class_Eval, Define_Method) VS (Instance_Eval, Define_Method)
Rails: How to Show User's "Last Seen At" Time
How to Reinstall a Gem Using Bundler
Xcode - Configure: Error: No Acceptable C Compiler Found in $Path
Setting Ruby Hash .Default to a List
How to Rescue Model Transaction and Show the User an Error
Testing Actionmailer Multipart Emails(Text and HTML Version) with Rspec
Ruby Net::Http::Get and JSON Responses
Namespaced Models in Rails: What's the State of the Union
Ruby Replace String with Captured Regex Pattern
How to Check What Is Queued in Activejob Using Rspec
Disable Rvm or Use Ruby Which Was Installed Without Rvm
Ruby Method with Maximum Number of Parameters
Testing Whether String Starts with or End with Another String
How to Check If a Variable Is an Instance of a Class
$ Bundle Exec Rake Db:Reset Command Raising Couldn't Drop Db/Development.Sqlite3