mina-deploy / mina

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

Make `in_path` tolerate "directory doesn't exist" case #587

Closed x-yuri closed 6 years ago

x-yuri commented 6 years ago

mina-sidekiq has sidekiq:quiet task, which is to be executed after git:clone or so:

task :deploy do
  deploy do
    # stop accepting new workers
    invoke :'git:clone'
    invoke :'sidekiq:quiet'
    invoke :'deploy:link_shared_paths'
    ...

    on :launch do
      ...
      invoke :'sidekiq:restart'
    end
  end
end

That is, on first deploy it tries to enter the directory, but it doesn't exist yet. Could we add some option to in_path to make mina tolerate this case?

d4be4st commented 6 years ago

you did not run mina setup

but we should add a check for in_path

x-yuri commented 6 years ago

Sorry for not stating this explicitly, it tries to enter current_path. Take a look at the task. Apparently, setup doesn't create this dir.

d4be4st commented 6 years ago

Oh i see what is happening here

current_path is a symlink so it is not created on the setup. It is created on :launch https://github.com/mina-deploy/mina/blob/master/data/deploy.sh.erb#L78 The sidekiq-quiet gem assumes you already have a deployed app.

What would you assume that happens here?

I) we can exit the script with 'path does not exits' II) or skip the block execution.

For general code first option is better for your case it is actually better to skip the execution because you cant stop sidekiqs that have not started yet.

So i would not address this issue, just when first deploying not try to quiet the sidekiq. It would actually be better for sidekiq gem to check for the path before entering