Class: DockerComposeDeploy::Actions::Deployment

Inherits:
Struct
  • Object
show all
Defined in:
lib/docker_compose_deploy/actions/deployment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ignore_pull_failuresObject

Returns the value of attribute ignore_pull_failures

Returns:

  • the current value of ignore_pull_failures



5
6
7
# File 'lib/docker_compose_deploy/actions/deployment.rb', line 5

def ignore_pull_failures
  @ignore_pull_failures
end

#shellObject

Returns the value of attribute shell

Returns:

  • the current value of shell



5
6
7
# File 'lib/docker_compose_deploy/actions/deployment.rb', line 5

def shell
  @shell
end

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/docker_compose_deploy/actions/deployment.rb', line 7

def create
  shell.ssh!("mkdir -p ./sites")
  shell.ssh!("rm -rf ./sites/config") # bin/deploy is irreversible :)
  shell.scp!("./sites/config/", "#{connection}:./sites/config", "-r")

  docker_compose.services.each do |service_name|
    shell.ssh!("mkdir -p ./sites/data/#{service_name}")
    shell.ssh!("mkdir -p ./sites/log/#{service_name}")
  end

  shell.scp!(docker_compose.path, "#{connection}:./docker-compose.yml")
  shell.ssh!("docker-compose down")
  shell.ssh!("docker-compose pull #{ignore_pull_failures_option}")
  shell.ssh!("docker-compose up -d")

  shell.notify "success"
end