Reputation: 11
I am getting an error attempting to deploy my rails application using capistrano/nginx and passenger, capistrano is working fine and I can run my deploy command just fine however I cannot access my endpoint due to an error coming from passenger gem.
This is the error logged in the temp html file passenger creates when attempting to visit my domiain.
`Error response Error code: 404
Message: File not found.
Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.`
and this is what it says when you view the page.
We're sorry, but something went wrong. The issue has been logged for investigation. Please try again later.
this is what nginx error log shows
App 79721 output: from /home/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.4.22/lib/bundler.rb:208:in `definition'
App 79721 output: from /home/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.4.22/lib/bundler.rb:156:in `setup'
App 79721 output: from /home/deploy/.rbenv/versions/2.6.1/lib/ruby/2.6.0/bundler/setup.rb:20:in `<top (required)>'
App 79721 output: from /home/deploy/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
App 79721 output: from /home/deploy/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
[ E 2024-06-30 12:40:49.9999 77711/T2g age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/myappname/current: The application process exited prematurely.
Error ID: bbc2b04f
Error details saved to: /tmp/passenger-error-v7N1qC.html
[ E 2024-06-30 12:40:50.0044 77711/T6 age/Cor/Con/CheckoutSession.cpp:281 ]: [Client 1-16] Cannot checkout session because a spawning error occurred. The identifier of the error is bbc2b04f. Please see earlier logs for details about the error.
This is what my gemfile looks like (this is an older ruby app that i plan to upgrade once i get deploy setup)
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.7', '>= 5.0.7.2'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'
gem 'jwt'
gem 'capistrano', '~> 3.11'
gem 'capistrano-rails', '~> 1.4'
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rbenv', '~> 2.1', '>= 2.1.4'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'pry-byebug'
end
group :development do
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
and this is what my nginx config looks like
server {
listen 80;
listen [::]:80;
server_name mydomain.app;
root /home/deploy/myappname/current/public;
passenger_enabled on;
passenger_app_env production;
passenger_preload_bundler on;
location /cable {
passenger_app_group_name mydomain_websocket;
passenger_force_max_concurrent_requests_per_process 0;
}
# Allow uploads up to 100MB in size
client_max_body_size 100m;
location ~ ^/(assets|packs) {
expires max;
gzip_static on;
}
# Return 404 for requests to any unknown routes
error_page 404 /404.html;
location = /404.html {
internal;
}
# Additional error handling
error_page 500 502 503 504 /50x.html;
location = /50x.html {
internal;
}
}
I am following this tutorial which I've followed with other projects without these issues running on the same hosting DigitalOcean VPS ubuntu 22.04 LTS
https://gorails.com/deploy/ubuntu/22.04
Searching passenger project github Stackoverflow search Google Search ChatGPT troubleshooting
Was going to open a issue ticket with passenger but it says to try stackoverflow first.
Upvotes: 1
Views: 52
Reputation: 11
If you run into this issue there doesn't appear to be anyway to find which file specifically that passenger is complaining about. What eventually worked for me was upgrading the ruby version from 2.6.1 to 2.7.1 , reinstalling bundler, and all gems as well. Then redeploying the application using
cap production deploy
I wish I had a better solution but 2.6.1 is pretty outdated and I planned to upgrade anyway, jumping up to 2.7.1 resolved this issue for me without any other changes.
Upvotes: 0