Class: DockerComposeDeploy::Actions::Server

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shellObject

Returns the value of attribute shell

Returns:

  • (Object)

    the current value of shell



3
4
5
# File 'lib/docker_compose_deploy/actions/server.rb', line 3

def shell
  @shell
end

Instance Method Details

#provisionObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/docker_compose_deploy/actions/server.rb', line 5

def provision
  shell.notify("Provisioning: #{connection}")
  shell.ssh!("sudo groupadd docker")
  shell.ssh!("sudo usermod -aG docker $USER")
  shell.ssh!("true", "-O exit") # resets the connection, so that our group changes take effect

  shell.ssh!("curl -L https://get.docker.com/ > ./docker-install")
  shell.ssh!("bash docker-install")
  shell.ssh!("rm docker-install")
  shell.ssh!("curl -L https://github.com/docker/compose/releases/download/2.27.1/run.sh > ./docker-compose")
  shell.ssh!("chmod +x docker-compose")
  shell.ssh!("sudo mv ./docker-compose /usr/local/bin/docker-compose")
  shell.ssh!("docker-compose -v")

  shell.notify "success"
end