Coder Social home page Coder Social logo

Comments (18)

molfar avatar molfar commented on August 29, 2024
  1. Try replace
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

with single

require 'capistrano/rails'
  1. Show here please your Gemfile
  2. why do you use require 'rvm1/capistrano3' ?
  3. Move require 'capistrano/puma' to the last line, after all other requires

from capistrano-puma.

developerby avatar developerby commented on August 29, 2024
  1. Try, does not work
  2. my Gemfile
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'mysql2'

gem 'puma'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

gem 'haml-rails'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'devise'
gem 'cancan'

gem 'activeadmin', github: 'gregbell/active_admin'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'capistrano', '~> 3.0.1'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'capistrano-rvm', '~> 0.0.3'
  gem 'capistrano-puma', github: "seuros/capistrano-puma"
end

group :development, :test do
  gem 'rspec-rails', '~> 2.0'
  gem 'capybara'
  gem 'factory_girl'
end

  1. Now I do not use:

my updated Capfile

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/bundler' # Rails needs Bundler, right?
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

require 'capistrano/rvm'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
require 'capistrano/puma'
  1. Done

And now:

cap sandbox puma:status (or restart, or stop / start and etc) output same error ( bash: pumactl: command not found )

cap sandbox deploy puma starts now, but single not daemonize mode without puma.rb (file exist and linked)

 INFO [2448d607] Running ~/.rvm/bin/rvm ruby-2.0.0-p247 do pumactl -S /var/www/apps/project/sandbox/shared/tmp/pids/puma.state restart on fb.by
DEBUG [2448d607] Command: cd /var/www/apps/project/sandbox/current && ~/.rvm/bin/rvm ruby-2.0.0-p247 do pumactl -S /var/www/apps/project/sandbox/shared/tmp/pids/puma.state restart
DEBUG [2448d607]  Puma starting in single mode...
DEBUG [2448d607]  * Version 2.6.0, codename: Pantsuit Party
DEBUG [2448d607]  * Min threads: 0, max threads: 16
DEBUG [2448d607]  * Environment: development
DEBUG [2448d607]  * Listening on tcp://0.0.0.0:9292
DEBUG [2448d607]  Use Ctrl-C to stop

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

@developerby you have to set :puma_workers either in your (staging || deploy) files

for example to have 2 workers you will need put :

  set :puma_workers, 2

then run puma:config to regenerate the puma.rb file.

from capistrano-puma.

developerby avatar developerby commented on August 29, 2024

puma regenerate config with new sets, but cap sandbox deploy running puma without config :\

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

You have to stop and start puma to take the new settings into effect i think.
try

bundle exec cap sandbox puma:stop puma:start deploy

from capistrano-puma.

developerby avatar developerby commented on August 29, 2024

:\ doesn't start

But there is a difference:

Run bundle exec cap sandbox puma:stop puma:start deploy

capistrano run command

DEBUG [ef9bf364] Command: cd /var/www/apps/project/sandbox/current && /bin/rvm  do pumactl -S /var/www/apps/project/sandbox/shared/tmp/pids/puma.state stop
DEBUG [ef9bf364]    bash: /bin/rvm: No such file or directory

.... && /bin/rvm do pumactl -S ....

But if I run
cap sandbox deploy

capistrano run

 INFO [99630653] Running ~/.rvm/bin/rvm ruby-2.0.0-p247 do pumactl -S /var/www/apps/project/sandbox/shared/tmp/pids/puma.state restart on feedback.by
DEBUG [99630653] Command: cd /var/www/apps/project/sandbox/current && ~/.rvm/bin/rvm ruby-2.0.0-p247 do pumactl -S /var/www/apps/project/sandbox/shared/tmp/pids/puma.state restart

... && ~/.rvm/bin/rvm ruby-2.0.0-p247 do pumactl -S ...

different path for rvm

And puma start single mode (not daemonize) without config

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

@developerby @kyledecot
can you add :

before 'puma:restart', 'rvm:hook'
before 'puma:start', 'rvm:hook'
before 'puma:stop', 'rvm:hook'

and let me know if that fix your issue so i can upgrade the gem for rvm users

from capistrano-puma.

kyledecot avatar kyledecot commented on August 29, 2024

@seuros adding the above lines gives me

DEBUG [89a66c32] Command: cd /var/www/skateboxes/current && ( RAILS_ENV=production /usr/local/rvm/bin/rvm 2.0@skateboxes do pumactl -S /var/www/skateboxes/shared/tmp/pids/puma.state restart )
DEBUG [89a66c32]    /usr/local/rvm/scripts/set: line 15: exec: pumactl: not found

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

@kyledecot You have to load the rvm tasks before puma's. @molfar added the correct rvm_map_bins in his PR.

@developerby : i had your bug this morning after a deploy once, but i could not replicate it again. :/

from capistrano-puma.

kyledecot avatar kyledecot commented on August 29, 2024

@seuros I am loading rvm before puma

%w[setup deploy rvm bundler rails puma].each { |r| require "capistrano/#{r}" }
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

from capistrano-puma.

molfar avatar molfar commented on August 29, 2024

@kyledecot, I really want to help you, but I have no mind about the reason about of issue. Check if you use all correct gems. Because here exist some collisions in gem's names. You should carefully check you Gemfile. And last, try to update all gems to latest versions. As for me, this gem seuros/capistrano-puma works just fine at my project, but with rbenv instead rvm.

from capistrano-puma.

syntaxTerr0r avatar syntaxTerr0r commented on August 29, 2024

Hi there, i have the same problem, I think it come from bundler support:

When capistrano run puma:start in my case it does the following:

Command: 
cd /my/app/current && /usr/local/rvm/bin/rvm ruby-2.0.0-p247 do puma -C /my/app/shared/config/puma.rb
/usr/local/rvm/scripts/set: line 15: exec: puma: not found

The same error as @kyledecot occurs
But if I connect to the server through SSH and run the command with bundle exec:

/usr/local/rvm/bin/rvm ruby-2.0.0-p247 do bundle exec puma -C /my/app/shared/config/puma.rb

Puma start just fine.

Maybe we should try checking for Bundler like in capistrano-rvm gem: https://github.com/capistrano/rvm/blob/master/lib/capistrano/tasks/rvm.rake

def bundler_loaded?
  Gem::Specification::find_all_by_name('capistrano-bundler').any?
end

And build the puma & pumactl command according to this test?

(note: I have a system-wide RVM install on my server)

Hope it helps...

from capistrano-puma.

molfar avatar molfar commented on August 29, 2024

@syntaxTerr0r This capistrano-puma has no bundler dependency. If you use bundler, you should of course run the commands through it. As for my rails 4 project, I always run bin/cap deploy. And everything works ok. I think your puma gem is installed with bundler, and is not available as separate gem. So, at first, try run bin/cap or bundle exec cap.

from capistrano-puma.

syntaxTerr0r avatar syntaxTerr0r commented on August 29, 2024

thx @molfar, my puma gem is indeed installed with bundler.
But I've no bin/cap and bundle exec cap produce the error I described earlier.

What about providing a way to customize the puma and pumactl command then? No dependencies involved then.

from capistrano-puma.

molfar avatar molfar commented on August 29, 2024

There is no need to customize commands. They run through bundler (if gem capistrano-bundler is used).

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

@syntaxTerr0r , @kyledecot : could try the new version ? i updated it so you can set puma and puma_ctl manually until the capistrano-rvm gem is fixed.

from capistrano-puma.

syntaxTerr0r avatar syntaxTerr0r commented on August 29, 2024

It works like a charm, thx a lot!

from capistrano-puma.

seuros avatar seuros commented on August 29, 2024

You are welcome

from capistrano-puma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.