Exception while configuring ruby on rails app on IIS - ruby-on-rails

I have a Windows server 2012 R2 and I downloaded and installed Ruby Hosting Packing from Microsoft Web Platform installer. When I try to run an existing website, I get the following error:
Error
Helicon Zoo module has caught up an error. Please see the details below.
Worker Status
The process was created
Windows error
The pipe has been ended. (ERROR CODE: 109)
Internal module error
message: Application backend read Error. type: ZooException file: App\Jobs\JobBase.cpp line: 531 version: 3.1.98.538
STDERR
[tid-5360004] Couldn't run bundler/setup: cannot load such file -- bundler/setup (String) [tid-5360004] cannot load such file -- rack (LoadError) C:/Zoo/Workers/ruby/lib/app.rb:84:in eval' C:/Ruby19/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' (eval):1:in assure_rack' C:/Zoo/Workers/ruby/lib/app.rb:84:ineval' C:/Zoo/Workers/ruby/lib/app.rb:84:in assure_rack' C:/Zoo/Workers/ruby/lib/app.rb:23:inbuild_app' C:/Zoo/Workers/ruby/lib/app.rb:16:in initialize' C:/Zoo/Workers/ruby/lib/worker.rb:4:innew' C:/Zoo/Workers/ruby/lib/worker.rb:4:in initialize' C:/Zoo/Workers/ruby/zoorack.rb:30:innew' C:/Zoo/Workers/ruby/zoorack.rb:30:in <module:Zack>' C:/Zoo/Workers/ruby/zoorack.rb:12:in'
Any idea on how to fix this?
Thanks.

Related

Discourse server fails to start with errors related to redis

Rails server fails to start in Discourse project either in development or production. Below are the logs when trying to start the server in dev mode. The application was installed and has been working, It's deployed on AWS in production mode and restarting the unicorn loads the application for some time and again the url stops responding with error messages.
Development logs from $rails s
rb t#ip-XXX-XX-XX-XX-app:/var/www/discourse# vi
config/environments/development.r
root#ip-172-31-25-46-app:/var/www/discourse# rails s
=> Booting Puma
=> Rails 5.1.4 application starting in production
=> Run `rails server -h` for more startup options
Exiting
bundler: failed to load command: script/rails (script/rails)
Redis::CommandError: ERR Error running script (call to f_b06356ba4628144e123b652c99605b873107c9be): #user_script:14: #user_script: 14: -MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:121:in `call'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:2399:in `block in _eval'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:58:in `block in synchronize'
/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:58:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:2398:in `_eval'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:2450:in `evalsha'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.1/lib/message_bus/backends/redis.rb:380:in `cached_eval'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.1/lib/message_bus/backends/redis.rb:140:in `publish'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.1/lib/message_bus.rb:248:in `publish'
/var/www/discourse/lib/distributed_cache.rb:72:in `publish'
**Production logs **
/var/www/discourse/lib/demon/base.rb:109:in `ensure_running'
/var/www/discourse/lib/demon/base.rb:34:in `block in ensure_running'
/var/www/discourse/lib/demon/base.rb:33:in `each'
/var/www/discourse/lib/demon/base.rb:33:in `ensure_running'
config/unicorn.conf.rb:145:in `master_sleep'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:284:in `join'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `load'
/var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `<main>'
E, [2018-01-04T08:43:37.949928 #60] ERROR -- : reaped #<Process::Status: pid 5870 exit 1> worker=unknown
Detected dead worker 5870, restarting...
Loading Sidekiq in process id 5883
Failed to report error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. 4 Redis::CommandError (MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.)
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:121:in `call' web-exception
Redis logs
47:M 17 Jan 09:38:01.070 # Can't save in background: fork: Cannot allocate memory
47:M 17 Jan 09:38:07.087 * 10000 changes in 60 seconds. Saving...
The issue has been fixed, Edited this file
/etc/sysctl.conf and added the line at last
vm.overcommit_memory=1
After this restarted sysctl.
$ sudo sysctl -p /etc/sysctl.conf
Redis doesn't need the amount of memory which OS thinks, the status 1 means always overcommit, never check.
More details can be found from Redis Docs.

Rails.application.database_configuration error with Rails 5.1 + Nginx + Phusion_Passenger

I have a server with Rails 5.1, Phusion_Passenger and Nginx.
When I start the server with just Phusion_Passenger, all is good:
=============== Phusion Passenger Standalone web server started ===============
PID file: /project/tmp/pids/passenger.3000.pid
Log file: /project/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
===============================================================================
[ N 2017-09-26 15:13:06.4195 8753/T5 age/Cor/SecurityUpdateChecker.h:374 ]: Security update check: no update found (next check in 24 hours)
When I try to start and access the same instance with Nginx as the overlay, I get the following error:
App 8129 stdout:
App 8129 stdout:
[ E 2017-09-26 15:06:26.4848 1774/T1l age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /project: An error occurred while starting up the preloader.
Error ID: e18b79ab
Error details saved to: /tmp/passenger-error-YkowRo.html
Message from application: Cannot load `Rails.application.database_configuration`:
undefined method `[]' for nil:NilClass (NoMethodError)
(erb):13:in `<main>'
It seems that when you load the rails app with Nginx, it cannot access the "Rails" object.
Passenger does not have a default environment set in the passenger.conf. Added this variable and it fixed the problem.
passenger_app_env development;

Passenger could not spawn process for application

I have deployed my webapp on CentOS 7 using bundle --standalone and have configured the app to use the correct gems by using .bundle/config. It works great when I use rails server, but when I set it up to use passenger I get the following error:
[ 2016-02-02 13:27:50.7037 5134/7fb8225b8700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/rails-web: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger.
Error ID: 7b0eafb9
Error details saved to: /tmp/passenger-error-YR2EzW.html
Message from application: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.<br>
<h2>Raw process output:</h2>
<pre>
/usr/share/rubygems/rubygems/path_support.rb:68:in `path=&apos;: undefined method `+&apos; for nil:NilClass (NoMethodError)
from /usr/share/rubygems/rubygems/path_support.rb:30:in `initialize&apos;
from /usr/share/rubygems/rubygems.rb:357:in `new&apos;
from /usr/share/rubygems/rubygems.rb:357:in `paths&apos;
from /usr/share/rubygems/rubygems.rb:379:in `path&apos;
from /usr/share/rubygems/rubygems/specification.rb:794:in `dirs&apos;
from /usr/share/rubygems/rubygems/specification.rb:658:in `each_normal&apos;
from /usr/share/rubygems/rubygems/specification.rb:669:in `_all&apos;
from /usr/share/rubygems/rubygems/specification.rb:822:in `each&apos;
from /usr/share/rubygems/rubygems/specification.rb:864:in `find&apos;
from /usr/share/rubygems/rubygems/specification.rb:864:in `find_inactive_by_path&apos;
from /usr/share/rubygems/rubygems.rb:175:in `try_activate&apos;
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:132:in `rescue in require&apos;
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:144:in `require&apos;
from <internal:abrt_prelude>:2:in `<compiled>&apos;
</pre>
The code around path_support.rb:68 involves setting GEM_PATH. What does this error message mean and how can I fix it. Thanks.
This appears passenger looks in /home/<username>/.gem/ruby as a part of its spawn process. If /home/<username> doesn't exist (like with system users that don't have home directories), you get this error.
Here is the bug report.

Resque job returning with error: "No such file or directory - getcwd"

I have a really simple job:
class MyJob
#queue = :high
def self.perform(user_id)
user = User.find(user_id)
MyMailer.send_email(user).deliver
end
end
If I run it manually MyJob.perform(some_id)it works perfect. However, when Rescue is executing it, it returns this error:
Exception
Errno::ENOENT Error
No such file or directory - getcwd
shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:221:in `expand_path' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:221:in `initialize' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:251:in `new' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/template/resolver.rb:251:in `instances' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:16:in `<class:LookupContext>' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:12:in `<module:ActionView>' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:5:in `<top (required)>' shared/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/view_paths.rb:45:in `lookup_context' shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:456:in `process' shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:452:in `initialize' shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:439:in `new' shared/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:439:in `method_missing' releases/1111111111111/app/jobs/my_job.rb:6:in `perform'
Have any ideas why might be happening?
Thanks!
Yes Sky. You are right about it needing to be restarted.
Some people received this error after trying to run from an already deleted directory.
I received this error after switching databases and leaving the server running. The old server info was still showing up but I was getting this error. Restarted my rails server and everything works fine with the new db.
Basically it means that there is a significant state change on the server, and your environment needs to be reset/restarted.
I started having this same issue on my production environment. After some investigation I found that this was caused by my resque workers failing to be properly restarted on each capistrano deployment.

Can't start jruby rails server on Windows because it can't find ncursesw

I can't seem to get the server to start for some reason, I keep getting this cryptic error.
C:\src\marvel\server\script>jruby rails server
c:/tools/jruby/lib/ruby/site_ruby/shared/ffi/library.rb:28:in `ffi_lib': Could n
(LoadError)ary 'ncursesw' : The operation completed successfully.
. Could not open library 'ncursesw.dll' : The operation completed successfully.
. Could not open library 'ncurses' : The operation completed successfully.
. Could not open library 'ncurses.dll' : The operation completed successfully.
from c:/tools/jruby/lib/ruby/site_ruby/shared/ffi/library.rb:10:in `map'
from c:/tools/jruby/lib/ruby/site_ruby/shared/ffi/library.rb:10:in `ffi_
lib'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/ffi-ncurses-0.3.3/lib/ffi-ncu
rses.rb:32
from c:/tools/jruby/lib/ruby/gems/1.8/gems/ffi-ncurses-0.3.3/lib/ffi-ncu
rses.rb:64:in require'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/run
time.rb:64:inrequire'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/run
time.rb:62:in each'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/run
time.rb:62:inrequire'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/run
time.rb:51:in each'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/run
time.rb:51:inrequire'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:
112:in require'
from C:/src/marvel/server/config/application.rb:9
from C:/src/marvel/server/config/application.rb:28:inrequire'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/comm
ands.rb:28
from c:/tools/jruby/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/comm
ands.rb:27:in tap'
from c:/tools/jruby/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/comm
ands.rb:27
from c:/tools/jruby/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/comm
ands.rb:6:inrequire'
from rails:6
I figured it out, I don't need ncurses on Windows, so I just commented it out from my gemfile. It appears that Jruby cannot distinguish between windows and *nix, so it blows up without special care.

Resources