Vlad the Deployment - usage patterns?

I'm starting to use vlad for new deployments, and wondering how best to configure it, so can I use the same tasks for my local development and remote production servers?

I was thinking about defining everything as remote tasks, and then having dev / prod methods that set the domain variable, then I can just call rake dev/prod vlad:do_something, but this is just completely wrong.

Many of my tasks are useful for running on my local server and on my production server, and I want to avoid repeating myself by having one "task" for the local and one "remote_talk" for the remote. eg.

def do_something
  run "echo something"
end

task :do_something_dev
  do_something
end

remote_task do_something_prod
  do_something
end

- , ?

+3
1

:

[:development, :test, :production].each do |environment|
  namespace environment do
    task :do_something do
      echo "do something on #{environment}"
    end
  end
end

:

  • rake vlad:development:do_something
  • rake vlad:test:do_something
  • rake vlad:production:do_something

, , , -. , .

+5

Source: https://habr.com/ru/post/1726305/


All Articles