Phussion Passenger fails - ruby-on-rails

recently my app stacked and I tried to make some checks.
I run such command through console:
passenger-config --detect-apache2
Got this error.
Detecting configuration file location...
--> /etc/httpd/conf/httpd.conf
Detecting error log file...
/home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `initialize': No such file or directory - /etc/httpd/conf/httpd.conf (Errno::ENOENT)
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `open'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `httpd_actual_error_log'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info.rb:115:in `httpd_actual_error_log'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:148:in `block in detect_one'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:226:in `add_result'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:118:in `detect_one'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:112:in `block in detect_all'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:111:in `each'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:111:in `detect_all'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/config/about_command.rb:140:in `run'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/config/main.rb:60:in `run!'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/bin/passenger-config:37:in `<top (required)>'
from /home3/ecotec11/ruby/gems/bin/passenger-config:23:in `load'
from /home3/ecotec11/ruby/gems/bin/passenger-config:23:in `<main>'
ecotec11#ecotechno.lv [~/rails_apps/darbs]#

Related

Rails - Ruby 3.1.1 will not load on CentOS but okay on OSX

I have a rails app that runs fine on my development iMac (Ventura). I pushed to production CentOS7. It bundled up fine but when trying to to assets precompile I get the error below. I have tried, removing lock file and re-bundling, updating bundler, did gem update and did yum update on server. I get the following when doing rake assets:clean precompile and I see similar error in apache log as well. I am running rails 7.0.4.2 and ruby 3.1.1. I need some guidance on how to resolve.
rake assets:clean precompile
rake aborted!
LoadError: cannot load such file -- Version
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:290:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/activeadmin-2.13.1/lib/active_admin.rb:68:in `setup'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `load'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `block in load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:208:in `instrument'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:666:in `load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:372:in `initialize!'
/admin/bin/rails/catering_bk/config/environment.rb:5:in `<top (required)>'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:511:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.1/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
As noted above. I tried
Remove lock file and bundle again.
gem update
yum update
Also to note this is also an older app that was upgraded to be in compliance with Veracode. It works perfectly on OSX, so the issue must be within CentOS.

Unicorn start up issue

I cant figure out whats wrong with Unicorn, it doesnt want to start up. Any help is appreciated
ubuntu#ip-172-31-15-195:~/www/tf/current$ RAILS_ENV=production bundle exec unicorn_rails -c config/unicorn.rb -D
bundler: failed to load command: unicorn_rails (/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails)
Errno::EEXIST: File exists # dir_s_mkdir - tmp/pids
/usr/local/lib/ruby/2.3.0/fileutils.rb:254:in `mkdir'
/usr/local/lib/ruby/2.3.0/fileutils.rb:254:in `fu_mkdir'
/usr/local/lib/ruby/2.3.0/fileutils.rb:228:in `block (2 levels) in mkdir_p'
/usr/local/lib/ruby/2.3.0/fileutils.rb:226:in `reverse_each'
/usr/local/lib/ruby/2.3.0/fileutils.rb:226:in `block in mkdir_p'
/usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `each'
/usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:202:in `block in <top (required)>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/configurator.rb:80:in `reload'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/configurator.rb:65:in `initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:76:in `new'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:76:in `initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `new'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `<top (required)>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `load'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `<top (required)>'
master failed to start, check stderr log for details
You have symbolic link ~www/tf/current/tmp/pids present but its target directory ~www/tf/shared/pids/ doesn't exist so the link is broken. unicorn is attempting to create tmp/pids directory in the ~www/tf/current/ but the symbolic link which already exists causes failure.
To fix this you need to create ~www/tf/shared/pids/ directory with appropriate ownership and permissions.

Permission denied # dir_s_mkdir (Errno::EACCES) - on application run

I have a ruby web app configured, with all the gems installed etc. It runs fine through my apache server, but now I have to debug something (which I'm still figuring out) and I need to run the rails server -b (ip) -p (port) command.
However I get the following outcome:
=> Booting Thin
=> Rails 4.0.12 application starting in development on http://192.168.39.163:3004
=> Run 'rails server -h' for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:252:in 'mkdir': Permission denied # dir_s_mkdir - /home/vicky/vanerum/tmp/pids (Errno::EACCES)
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:252:in 'fu_mkdir'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:71:in `block in start'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:70:in `each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:70:in `start'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:71:in `tap'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I've changed ~/.rbenv's owner to myself, I've tried setting the permissions to 775 on that folder. It keeps giving me this error. Any more ideas?
Create a folder in /home/vicky/vanerum/ with name tmp.
For a case, create a folder pids in /home/vicky/vanerum/tmp.
I assume the problem in thin server, it not able to create folder.

rails - running production mode locally = No such file to load - config/environment

I am trying to run locally in production mode with:
$ RAILS_ENV=production rails s
But I get:
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
I can create a brand new rails 3.1.8 app and do RAILS_ENV=production rails server and I don't get this problem.
I can also do rails s and that runs the server fine in development mode without error.
I can also do RAILS_ENV=development rails s and that runs the server fine in development mode without error.
fwiw, my app was originally a rails 2.3 app so perhaps I am missing something that's been added or changed in rails ?
I do have the config directory with an environment.rb file. Perhaps the way it's being referenced is wrong somehow?
I added config.assets.enabled = true to config/application.rb but it didn't help (didn't expect it to as that is asset compilation, but it was a difference I found!).
Full Trace:
durrantm#Castle2012:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Changed a few things. One of the main ones were to enable static assets locally in config/environments/production.rb when trying to run it locally (only) and revert that before pushing to a production web server. I didn't know that.
seems like your old assets directory lived in other place (maybe in public) and now it is in app/assets, but it doesn't know about it and some files try to load environment.rb. just double check assets dir.

Error while starting WEBrick server using rails

I have an existing application with database ready I have made all the changes in database.yml and did bundle install when I am trying to do rails s to start the WEBrick server I am getting the following error
/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': File exists - /home/username/appname/app/releases/20120831125545/tmp (Errno::EEXIST)
from /usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
from /usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `each'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:62:in `block in start'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:61:in `each'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:61:in `start'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:27:in `tap'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Am I missing some step , Do I have to re run the migration (I have the database ready with me with data in it)
any help?
Apparently the tmp directory Rails uses for session store is already present. Try deleting the /tmp folder in your release directory.

Resources