Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mina deploy throws error - bundle: command not found ! ERROR: Deploy failed. #594

Closed
krishnateja opened this issue Nov 28, 2017 · 6 comments

Comments

@krishnateja
Copy link

mina deploy throws error. Any help would be much appreciated.

Here is the mina deploy --trace

root@ruby-rails-1gb-blr1-01:/home/rails/rails-demo# mina deploy --trace
** Invoke deploy (first_time)
** Execute deploy
** Invoke remote_environment (first_time)
** Execute remote_environment
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
** Invoke puma:phased_restart (first_time)
** Invoke remote_environment (first_time)
** Execute remote_environment
** Execute puma:phased_restart
root@139.59.72.156's password: 
-----> Creating a temporary build path
-----> Deploying rails-demo to 139.59.72.156:/home/rails/rails-demo
-----> Fetching new git commits
       remote: Counting objects: 43, done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 43 (delta 6), reused 43 (delta 6), pack-reused 0
Unpacking objects: 100% (43/43), done.   
       From github.com:krishnateja/rails-demo
          739096a..4cf74f8  master     -> master
-----> Using git branch 'master'
       Cloning into '.'...
       done.
-----> Using this git commit
       root (4cf74f8):
       > small config change
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
       bash: line 137: bundle: command not found
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK
       Connection to 139.59.72.156 closed.

 !     Run Error

deploy.rb

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'

set :application_name, 'rails-demo'
set :domain, '139.59.72.156'
set :deploy_to, '/home/rails/rails-demo'
set :repository, 'git@github.com:krishnateja/rails-demo.git'

set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/pids', 'tmp/sockets', 'public/uploads')
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml', 'config/puma.rb')
set :user, 'root'

task :environment do
  invoke :'rvm:use', 'ruby-2.2.3'
end

task :setup do
  command %[touch "#{fetch(:shared_path)}/config/database.yml"]
  command %[touch "#{fetch(:shared_path)}/config/secrets.yml"]
  command %[touch "#{fetch(:shared_path)}/config/puma.rb"]
  comment "Be sure to edit '#{fetch(:shared_path)}/config/database.yml', 'secrets.yml' and puma.rb."
end

task :deploy do
  deploy do
    comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}"
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      invoke :'puma:phased_restart'
    end
  end

end

puma.rb

environment "production"

bind  "unix:///home/rails/rails-demo/shared/tmp/sockets/puma.sock"
pidfile "/home/rails/rails-demo/shared/tmp/pids/puma.pid"
state_path "/home/rails/rails-demo/shared/tmp/sockets/puma.state"
directory "/home/rails/rails-demo/current"

workers 2
threads 1,2

daemonize true

activate_control_app 'unix:///home/rails/rails-demo/shared/tmp/sockets/pumactl.sock'

prune_bundler
@zmcNotafraid
Copy link

I have same issue after I update my gemfile

@krishnateja
Copy link
Author

krishnateja commented Dec 8, 2017 via email

@vemarav
Copy link

vemarav commented Jan 17, 2018

Try bundle exec mina deploy
This solved mine.

@gabskoro
Copy link
Member

When it comes to the "command not found: bundle" error, the main reason is that people didn't install it on their server for that particular version of ruby. If you're using Rbenv, Rvm... just switch to that exact version and run gem install bundler.
I'm using Rbenv, so whenever I want to deploy an application which will use a new version of ruby (which I don't have yet installed), I ssh to my server and run

rbenv install 2.5.0
rbenv shell 2.5.0
gem install bundler

@d4be4st
Copy link
Member

d4be4st commented Jan 26, 2018

Take a look at FAQ

@d4be4st d4be4st closed this as completed Jan 26, 2018
@wafiq
Copy link
Contributor

wafiq commented Feb 7, 2018

If you use the :environment block, rename it to :remote_environment to target remote server, or run mina init to copy a new deploy script (back up the old deploy.rb first). This happens to me too, albeit using rbenv instead of rvm.

Ajmal added a commit to Ajmal/mina that referenced this issue Nov 10, 2018
- Bump ruby version
- Add gem install bundler. [mina-deploy#594 (comment)](mina-deploy#594) [mina-deploy#528(comment)](mina-deploy#528)
@Ajmal Ajmal mentioned this issue Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants