mina-multistage icon indicating copy to clipboard operation
mina-multistage copied to clipboard

'deploy' deploys twice

Open samnissen opened this issue 7 years ago • 1 comments

From config/deploy.rb

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

set :rvm_path, '$HOME/.rvm/bin/rvm'

task :remote_environment do
  invoke :'rvm:use', 'ruby-2.4'
end

task :'db:configure' do
  invoke :'rails:db_create'
  invoke :'rails:db_migrate'
  command "#{fetch(:rails)} db:seed"
end

From config/deploy/production.rb

set :domain, ENV['SOMEENVNAME']
set :deploy_to, ENV['SOMEOTHERENV']
set :repository, '[email protected]:name/codebase.git'
set :branch, 'master'
set :term_mode, nil
set :rails_env, 'production'

task :deploy => :environment do
  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'db:configure'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'
    command %[sudo /bin/systemctl restart httpd.service]
  end
end

Running the appropriate setup steps and then mina production deploy (or staging, omitted for simplicity), produces

# ...
-----> Moving build to /path/to/deployment/releases/1
-----> Build finished
-----> Launching
       Connection to 1.2.3.4 closed.

-----> Updating the /path/to/deployment/current symlink
-----> Done. Deployed version 1
       Elapsed time: 206.62 seconds
-----> Creating a temporary build path # <= starting on version 2
-----> Using RVM environment "ruby-2.4"
       Using /home/rakuten-publishers/.rvm/gems/ruby-2.4.1
-----> Fetching new git commits
# ...

and

$ cd /path/to/deployment
$ ls releases/
1  2

Both with seemingly correct deployments.

samnissen avatar Dec 19 '17 13:12 samnissen

@samnissen That's an interesting problem. I'll see if I can reproduce to see what's going on. Thank you for reporting your issue!

endoze avatar Jan 03 '18 15:01 endoze