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 fails to deploy release folders #490

Closed
activestylus opened this issue Dec 8, 2016 · 2 comments
Closed

Mina fails to deploy release folders #490

activestylus opened this issue Dec 8, 2016 · 2 comments

Comments

@activestylus
Copy link

activestylus commented Dec 8, 2016

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.

@d4be4st
Copy link
Member

d4be4st commented Dec 8, 2016

This looks like your sudo stop puma-manager && sudo start puma-manager fails
if current didnt exist it woud say unknown folder

@activestylus
Copy link
Author

I SSH'd into the server and the folder wasn't there.

I did manage to solve this issue by completely nuking the deploy dir and starting from scratch.

Thanks for the prompt reply though!

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

2 participants