I installed Apache, Passenger and Sinatra and deployed an app. It gives error when trying to access:
An error occurred while starting up the preloader: it di
For future reference : I had wrong database credentials in my config, which resulted in the same error.
To solve this issue, please follow this guide by phusion phassenger https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems
I found the answer what is causing it in my case. In my config.ru
I was redirecting STDOUT
like this:
log = File.new("logs/std.log", "a+")
STDOUT.reopen(log)
Removing the redirect into the log and it starts up again.
Looks like passenger needs STDOUT
to detect a working "preloader".
Edit: I'm currently using the following solution to redirect the log into a file and keep passenger happy (basically just duplicating stdout into the log file and not redirecting):
log = File.new("logs/std.log", "a+")
def STDOUT.write string
log.write string
super
end
STDOUT.sync = true
In case the above doesn't solve it for you, I had the exact same error message with a different cause.
In my case, we were using an external database server and that had gone down.
Bringing the external db server back up fixed the issue.
But before we solved this, we spent a bunch of time thinking about recompiling passenger, etc.
Hope this note saves someone some time.