Last active
November 29, 2019 01:49
-
-
Save sue445/58e39a2cc5f13ef41518a15bdcbc093e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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