mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.35k stars 491 forks source link

Deploy does not work since version 1.2.0 #572

Closed ozgg closed 6 years ago

ozgg commented 6 years ago

I've updated bundle to 1.2.0 and since then if I try to run mina deploy, I get the following error without any additional information:

 !     Can't be run outside deploy do block. Please use mina 'rake[db_migrate]' instead

Creating new config with mina init does not help. So I had to roll back to previous version.

d4be4st commented 6 years ago

I have added a couple of guards to discourage wrong use. Can I take a lookt at your deploy.rb? At least your deploy task?

ozgg commented 6 years ago

I doesn't differ much from one that is generated with mina init, only in settings such as user/host:

require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'  # for rbenv support. (https://rbenv.org)

set :application_name, 'paradox'
set :domain, 'paradox-life.ru'
set :deploy_to, '/var/www/paradox-life.ru'
set :repository, '...'
set :branch, 'master'

set :user, 'developer'          # Username in the server to SSH to.

set :shared_dirs, fetch(:shared_dirs, []).push('tmp', 'log', 'public/uploads', 'public/ckeditor')
set :shared_files, fetch(:shared_files, []).push('.env')

task :environment do
  invoke :'rbenv:load'
end

task :setup do
end

desc "Deploys the current version to the server."
task :deploy do
  deploy do
    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
      in_path(fetch(:current_path)) do
        command %{mkdir -p tmp/}
        command %{touch tmp/restart.txt}
      end
    end
  end
end

(I've removed comments for brevity).

d4be4st commented 6 years ago

Gah, had a typo!

Thank you!

Released v1.2.1 with a fix

ozgg commented 6 years ago

Now it fails with another error :)

-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
       Cloning into '.'...
       done.
-----> Using this git commit
       Maxim Khan-Magomedov (dbb0d30):
       > Масштабирование картинки для курсов в шапке
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
       bash: line 86: bundle: command not found
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK
       Connection to paradox-life.ru closed.

 !     Run Error

Is it somehow connected with environment block?

ozgg commented 6 years ago

I changed task :environment to task :remote_environment in deploy.rb and it worked.

ccfiel commented 6 years ago

@ozgg thanks!