Skip to content

Instantly share code, notes, and snippets.

@sue445
Last active Nov 29, 2019
Embed
What would you like to do?
# envリポジトリのcurrent
set :env_current, "/home/deploy/docker-gitlab-env/current"
set :stack_name, "gitlab"
namespace :stack do
desc "docker stack deploy"
task :deploy do
on roles(:app) do
within release_path do
options = [
"stack",
"deploy",
"--compose-file docker-compose.yml",
"--compose-file #{fetch(:env_current)}/docker-compose.common.yml",
"--compose-file #{fetch(:env_current)}/docker-compose.#{fetch(:stage)}.yml",
fetch(:stack_name),
]
execute :docker, options
end
invoke "stack:wait_startup"
end
end
desc "Wait for stack deploy"
task :wait_startup do
on roles(:app) do
# c.f. https://github.com/sudo-bmitch/docker-stack-wait
execute :docker, "run --rm -i -v /var/run/docker.sock:/var/run/docker.sock sudobmitch/docker-stack-wait #{fetch(:stack_name)}"
end
end
end
after "deploy:published", "stack:deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment