Skip to content

Mina fails to deploy release folders #490

Description

@activestylus

I've run the setup task which completes without a hitch.
But when I try to deploy my app, I get errors because the current alias
points to a non-existent directory.

Here's the output of mina deploy --verbose:

-----> Creating a temporary build path
       $ touch "deploy.lock"
       $ mkdir -p "$build_path"
       $ cd "$build_path"

-----> Fetching new git commits
       $ (cd "/home/admin/www/myapp/scm" && git fetch "/home/admin/repos/myapp.git" "mast       $ (cd "/home/admin/www/myapp/scm" && git fetch "/home/admin/repos/myapp.git" "master:master" --force)

-----> Using git branch 'master'
       $ git clone "/home/admin/www/myapp/scm"       Cloning into '.'...
       $ git clone "/home/admin/www/myapp/scm" . --recursive --branch "master"
       done.

-----> Using this git commit

       $ git rev-parse HEAD > .mina_git_revision
       $ git --no-pager log --format='%aN (%h):%n> %s' -n 1
       Steven Garcia (7g152ad):
       > update
       $ rm -rf .git

-----> Symlinking shared paths
       $ mkdir -p "./log"
       $ mkdir -p "./public"
       $ mkdir -p "."
       $ rm -rf "./log/production.log"
       $ ln -s "/home/admin/www/myapp/shared/log/production.log" "./log/production.log"
       $ rm -rf "./public/system"
       $ ln -s "/home/admin/www/myapp/shared/public/system" "./public/system"
       $ rm -rf "./tmp"
       $ ln -s "/home/admin/www/myapp/shared/tmp" "./tmp"

-----> Deploy finished

-----> Building

-----> Moving build to releases/1
       $ mv "$build_path" "$release_path"
       $ cd "$release_path"

-----> Build finished

-----> Launching

-----> Updating the current symlink
       $ ln -nfs "$release_path" "current"

-----> Launching
       $ cd "current"
       stop: Unknown instance:
 !     ERROR: Deploy failed.

When I check myapp/releases folder there is nothing in it. I tried resetting the last_version file but now it just points to releases/1, which is simply not there, despite what the script tells me.

Here is my deploy.rb:

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

set :domain,        'XX.XXX.XXX.XXX'
set :port,          'XXX' 
set :user,          'XXXXXXXXXXX'
set :identity_file, '/Users/XXXXXXXXXXX/.ssh/id_rsa'
set :deploy_to,     '/home/admin/www/myapp'
set :repository,    "/home/admin/repos/myapp.git"
set :branch,        'master'
set :shared_paths, ['log/production.log','public/system','tmp']
set :rvm_path, '/home/admin/.rvm/bin/rvm'

task :environment do
  invoke :'rvm:use[ruby-2.3.1@default]'
end

task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
end

task :deploy => :environment 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'

    to :launch do
      queue "sudo stop puma-manager && sudo start puma-manager"
    end
  end
end

task :'deploy:code' do
  invoke :'git:clone'
  invoke :'deploy:link_shared_paths'
end

Any help you can provide would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions