Petros Kyriakou
Petros Kyriakou

Reputation: 5343

Puma won't start through capistrano

Puma fails all the time when trying to install with capistrano but when i try the same command capistrano uses in the current directory puma starts successfully.

bundle exec puma -C /home/deploy/apps/petfriend/shared/puma.rb --daemon

Here is a trace below

 bundle exec cap production puma:start --trace
    ** Invoke production (first_time)
    ** Execute production
    ** Invoke load:defaults (first_time)
    ** Execute load:defaults
    ** Invoke bundler:map_bins (first_time)
    ** Execute bundler:map_bins
    ** Invoke deploy:set_rails_env (first_time)
    ** Execute deploy:set_rails_env
    ** Invoke deploy:set_linked_dirs (first_time)
    ** Execute deploy:set_linked_dirs
    ** Invoke deploy:set_rails_env
    ** Invoke rbenv:validate (first_time)
    ** Execute rbenv:validate
    ** Invoke rbenv:map_bins (first_time)
    ** Execute rbenv:map_bins
    ** Invoke puma:start (first_time)
    ** Invoke puma:make_dirs (first_time)
    ** Execute puma:make_dirs
    00:00 puma:make_dirs
          01 mkdir /home/deploy/apps/petfriend/shared/tmp/sockets -p
        ✔ 01 deploy@ 1.153s
          02 mkdir /home/deploy/apps/petfriend/shared/tmp/pids -p
        ✔ 02 deploy@ 0.192s
    ** Execute puma:start
    00:01 puma:start
          using conf file /home/deploy/apps/petfriend/shared/puma.rb
          01 bundle exec puma -C /home/deploy/apps/petfriend/shared/puma.rb --daemon
          01 bash: bundle: command not found
          01
    cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing on host : puma exit status: 127
    puma stdout: bash: bundle: command not found
    puma stderr: Nothing written
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
    SSHKit::Command::Failed: puma exit status: 127
    puma stdout: bash: bundle: command not found
    puma stderr: Nothing written
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/command.rb:100:in `exit_status='
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:148:in `execute_command'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:74:in `execute'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/capistrano-puma-e18b30c18ace/lib/capistrano/tasks/puma.rake:57:in `block (6 levels) in <top (required)>'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:93:in `with'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/capistrano-puma-e18b30c18ace/lib/capistrano/tasks/puma.rake:56:in `block (5 levels) in <top (required)>'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:85:in `within'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/capistrano-puma-e18b30c18ace/lib/capistrano/tasks/puma.rake:55:in `block (4 levels) in <top (required)>'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/capistrano-puma-e18b30c18ace/lib/capistrano/tasks/puma.rake:134:in `puma_switch_user'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/capistrano-puma-e18b30c18ace/lib/capistrano/tasks/puma.rake:49:in `block (3 levels) in <top (required)>'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run'
    /Users/pitops/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
    Tasks: TOP => puma:start

Any clues?

Upvotes: 2

Views: 1141

Answers (2)

Hieu Le
Hieu Le

Reputation: 2136

Try to add these lines at the bottom of the file ~/.bashrc on your server:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"

Upvotes: 0

Gaston
Gaston

Reputation: 994

I think because of

01 bash: bundle: command not found

the problem is with bundler, and not puma

Please try:

gem install bundler

on your app's directory

Upvotes: 1

Related Questions