Can't run Puma after deploying with Capistrano - ruby-on-rails

After deploying my Rails 5 (Ruby 2.3.7) application with Capistrano, I try run on my 'current' folder (with no luck) this command:
bundle exec puma -e production -b unix:/home/deploy/my_app/shared/tmp/sockets/puma.sock"
I get the following error (note that I've set Ruby version to 2.3.7 in the Gemfile, but the error mentions 2.3.0)
bundler: failed to load command: puma (/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma)
Errno::ENOENT: No such file or directory - connect(2) for /home/deploy/my_app/shared/tmp/sockets/puma.sock
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `initialize'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `new'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `add_unix_listener'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:141:in `block in parse'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:88:in `each'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:88:in `parse'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/runner.rb:151:in `load_and_bind'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/single.rb:96:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/launcher.rb:184:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/cli.rb:78:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/bin/puma:10:in `<top (required)>'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma:23:in `load'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma:23:in `<top (required)>'
This is on a EC2 instance with Ubuntu 18.
Any help would be greatly appreciated.
This is the tutorial im following
http://www.dsolc.com/blogs/8-deploying-rails-app-to-ec2-instance-with-capistrano-using-nginx-and-puma

Related

Rails 5: Error with spring when run devise:install

I am trying make a API with Rails
Ruby version: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
Rails version: Rails 5.2.4.1
I added the devise gem to the gemfile and ran the bundle, without errors. When I tried to run $ rails generate devise: install, this error occurred:
/home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:122:in `ensure in preload': undefined method `application' for Rails:Module (NoMethodError)
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:126:in `preload'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
Try restarting the spring server by using the following commands:
bin/spring stop
bin/spring start

uninitialized constant RubyVM::DebugInspector seen in official Rails getting started guide

I am a new user to Ruby on Rails, and I've been following the official getting started.
Platform: Windows 10
Ruby 2.2.4
Rails 4.2.5.2
What I am doing:
rails new myapp cd myapp bundle install rails server
Then I get this error:
C:\Users\MyUser\AAA\myapp>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller/mri2.rb:21:in `callers': uninitialized constant RubyVM::DebugInspector (NameError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/integration/cruby.rb:28:in `set_backtrace_with_binding_of_caller'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from C:/Users/MyUser/AAA/myapp/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have already tried uninstalling debug_inspector and running bundle install after, but the problem persists.
Can anyone help me please?
If it is still actual. Try to add debug_inspector to your Gemfile.
You need to bundle the gem before start rails server. Follow following steps:
rails new myapp
cd myapp
bundle install
rails server
I deleted all versions of debug inspector first:
gem uninstall debug_inspector
then installed it again with the arch -arm64 flag
arch -arm64 gem install debug_inspector
For some reason, it required to install another gem (which may not be necessary for you)
arch -arm64 gem install rbs -v 2.1.0
And after that, the error has gone.

Ruby on Rails: Bundler couldn't find some gems.Did you run 'bundle install'

I am trying to run Fedena which is Ruby on Rails application. I have a hosting account with CPanel. When I try to run Ruby on Rails application, I see the following error in logs:
Bundler couldn't find some gems.Did you run 'bundle install'
Questions:
Is this issue related to Ruby on Rails version? How do I know which version I am running?
How do I fix this issue?
Here's complete error:
/home/abc/rails_apps/abc/config/../config/preinitializer.rb:18: Bundler couldn't find some gems.Did you run `bundle install`? (RuntimeError)
from /home/abc/rails_apps/abc/config/boot.rb:29:in `load'
from /home/abc/rails_apps/abc/config/boot.rb:29:in `preinitialize'
from /home/abc/rails_apps/abc/config/boot.rb:11:in `boot!'
from /home/abc/rails_apps/abc/config/boot.rb:127
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/abc/rails_apps/abc/config/environment.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:23:in `load'
I run fedena app in local m/c
bundle install info
Hope it helps..
As you mentioned that you are deploying in Cpanel.
First, you should get SSH access then you can run command bundle install in the root folder on the app.
You can run rails -v via SSH to know about the Rails version.
Run command bundle install in the root folder on the app to fix this issue.

Why won't Rails' console start or make new apps?

A few days ago I updated my gems because things weren't running so fine, so I went back to 1.4.2. Since then I'm getting all kind of weird errors.
I'm using Ruby 2.0.0p247, Rails 4.0 and Ubuntu.
If I try to start a new app using rails new eraseme, everything goes fine until it's time to do bundle install. The output is:
run bundle install
/usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `bundle_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:277:in `run_bundle'
from (eval):1:in `run_bundle'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/application.rb:43:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
If I try to open the console, I get:
>> bundle exec rails console
Loading development environment (Rails 4.0.0)
/usr/local/lib/ruby/2.0.0/irb/locale.rb:150:in `block in search_file': undefined method `try_activate' for Gem:Module (NoMethodError)
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:158:in `block in each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:167:in `each_sublocale'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:157:in `each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:145:in `search_file'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:124:in `find'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:108:in `load'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:32:in `initialize'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `new'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `init_config'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:16:in `setup'
from /usr/local/lib/ruby/2.0.0/irb.rb:380:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Have you already installed bundler? If not, try:
gem install bundler
If so, try:
gem install bundler --pre
If you running Ruby version manager, what version are you running? You might be set to the wrong version of Ruby.
I think it would be easier for you if you used RVM or some other version manager.
if you have multiple versions of rubygems installed, uninstall all but the one you want to use.
I think rails 4 requires rubygems 2.x.
Also check the bundler version.

Starting thin server without the thin gem does not work

I am using ruby 1.9.3 and rails 3.2.2. Every time i use the thin server with private_pub gem it does not work i did rackup private_pub.ru -s thin -E production. I get the following error
/home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `const_get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `block in get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `each'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `inject'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `load'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `<main>'
rzaartz#ubuntu:~/paper$ rvm 1.9.3
rzaartz#ubuntu:~/paper$ rackup private_pub.ru -s thin -E production
/home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `const_get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `block in get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `each'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `inject'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `load'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `<main>'
but it i include the thin gem in my gem file it would work fine. Any help thanks.
You can't start linux without linux.
You can't launch a rackup server without Rack.
You can't launch thin without thin gem.
/home/dimas/RUBY/application/faye-tutorial/faye.ru:3:in `require': cannot load such file -- thin (LoadError)
from /home/dimas/RUBY/application/faye-tutorial/faye.ru:3:in `block in <main>'
I have the same problem. fix it with:
add this gem to Gemfile
gem 'faye'
gem 'thin'
then bundle install.
If you want to use a gem, it must be in your Gemfile. You can solve your problem as follows:
Add the following line to your Gemfile: gem 'thin'
Update your current app's environment: bundle install
Start the web server: bundle exec thin start

Resources