Mina: Deploy does not work since version 1.2.0

Created on 29 Sep 2017  路  6Comments  路  Source: mina-deploy/mina

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.

Most helpful comment

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

All 6 comments

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?

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).

Gah, had a typo!

Thank you!

Released v1.2.1 with a fix

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?

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

@ozgg thanks!

Was this page helpful?
0 / 5 - 0 ratings