docker_compose_deploy 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a607bdc2cebcd48c7905a97d19a6063f64cf3001
4
- data.tar.gz: 51d0bcfd2c6df2de106b9e7be070b46db085ad7a
2
+ SHA256:
3
+ metadata.gz: a67cafd94d70649827784bfeb5fe02c88327516a90b9f19a387bd2636360cfca
4
+ data.tar.gz: 811a9defd40ef501304f64f597a90aefb82d1a5de037ca72227d34e8e0bd0a36
5
5
  SHA512:
6
- metadata.gz: e6d4e8aa9a3d15d565448fc6ab0f054b8a616f4a9d2216a6007fd5933dd139a73f6601b7a8a1b544f71aef255e4d504f0bb994389a22553ad63fca8d704c277a
7
- data.tar.gz: a6e921950fd6d358a0e1c9670942998e9c3fc5ef9572f4aa40fd0fd707e67a5e0a70f84e9b520e804e0ee14610598f6576db748359b54eca539711636555a840
6
+ metadata.gz: e711255f0ea8e5b3eb999ceb27b653ccf83ea90cf6bdf64879b4944d1ad63629696f455b897ecfed223f35fdc1159f251a1f73c645307039d7325efb6c05479d
7
+ data.tar.gz: 05dcb27c7ed4d7aa352731e5c7394eacc9eca755b97c2a49c98054d06666c0c3431c2e0dfe9b36d204da719ec623d1634daba64ff6636556ef91ef3c4ec44c98
data/README.md CHANGED
@@ -12,20 +12,6 @@ While these scripts are great for your personal projects, they will not help you
12
12
 
13
13
  This doesn't provide much over using docker-machine, but it will simplify working with volumes and allow you to test your deployment in a realistic environment.
14
14
 
15
- ### Commands
16
-
17
- Each command takes an optional `-e [environment]`. If the environment is not set, it will default to `test`. This environment corresponds to the entry in `config.yml`. There you can configure the connection string for sshing to the host. By default the `test` environment is set up to connect to the vagrant host configured in the Vagrantfile.
18
-
19
- `dcd new [project_name]`: Scaffold a new project.
20
-
21
- `dcd provision`: Install Docker & DockerCompose on the host machine.
22
-
23
- `dcd deploy`: Push your `docker-compose.yml` to the host machine, create directories for volume-mapping (explained below), pull the required docker images, and run `docker-compose up`.
24
-
25
- `dcd backup`: Tar, bzip, and download the `./sites/data` for safekeeping.
26
-
27
- `dcd push [image_names]`: __If all of your images are on hub.docker.com, then you don't need this command.__ Normally you might push your docker images to http://hub.docker.com. However, you might have some images that you'd prefer to keep private. This command will take a local image, tar it, push it to the remote host. Using `dcd push` you do not need to push your private image to docker hub. This is significantly slower than using the registry because you need to push the entire image each time. Note that if you use this command, you will need to set `ignore_pull_failures: true` in your `config.yml`.
28
-
29
15
 
30
16
  ### The big picture
31
17
 
@@ -46,6 +32,20 @@ As I add new apps I must update my nginx config. Testing this can be tricky, sin
46
32
  - Push your project to a vagrant machine
47
33
  - Create entries in `/etc/hosts` on the vagrant machine to help you test your nginx config
48
34
 
35
+ ### Commands
36
+
37
+ Each command takes an optional `-e [environment]`. If the environment is not set, it will default to `test`. This environment corresponds to the entry in `config.yml`. There you can configure the connection string for sshing to the host. By default the `test` environment is set up to connect to the vagrant host configured in the Vagrantfile.
38
+
39
+ `dcd new [project_name]`: Scaffold a new project.
40
+
41
+ `dcd provision`: Install Docker & DockerCompose on the host machine.
42
+
43
+ `dcd deploy`: Push your `docker-compose.yml` to the host machine, create directories for volume-mapping (explained below), pull the required docker images, and run `docker-compose up`.
44
+
45
+ `dcd backup`: Tar, bzip, and download the `./sites/data` for safekeeping.
46
+
47
+ `dcd push [image_names]`: __If all of your images are on hub.docker.com, then you don't need this command.__ Normally you might push your docker images to http://hub.docker.com. However, you might have some images that you'd prefer to keep private. This command will take a local image, tar it, push it to the remote host. Using `dcd push` you do not need to push your private image to docker hub. This is significantly slower than using the registry because you need to push the entire image each time. Note that if you use this command, you will need to set `ignore_pull_failures: true` in your `config.yml`.
48
+
49
49
 
50
50
  ### Installation
51
51
 
@@ -10,14 +10,23 @@ module DockerComposeDeploy
10
10
  shell.scp!("./sites/config/", "#{connection}:./sites/config", "-r")
11
11
 
12
12
  docker_compose.services.each do |service_name|
13
+ shell.ssh!("mkdir -p ./sites/config/#{service_name}")
13
14
  shell.ssh!("mkdir -p ./sites/data/#{service_name}")
14
15
  shell.ssh!("mkdir -p ./sites/log/#{service_name}")
15
16
  end
16
17
 
17
- shell.scp!(docker_compose.path, "#{connection}:./docker-compose.yml")
18
- shell.ssh!("docker-compose down")
19
- shell.ssh!("docker-compose pull #{ignore_pull_failures_option}")
20
- shell.ssh!("docker-compose up -d")
18
+ if DockerComposeDeploy.config.stack?
19
+ shell.scp!(docker_compose.path, "#{connection}:./docker-stack.yml")
20
+ shell.ssh!("docker node ls || docker swarm init") # ensure a swarm is initialized
21
+ shell.ssh!("docker stack rm dcd_stack || exit 0") # try to remove previous stack
22
+ shell.ssh!("while docker ps | grep dcd > /dev/null; do echo 'waiting for shutdown' && sleep 1; done")
23
+ shell.ssh!("docker stack deploy --compose-file docker-stack.yml dcd_stack")
24
+ else
25
+ shell.scp!(docker_compose.path, "#{connection}:./docker-compose.yml")
26
+ shell.ssh!("docker-compose down")
27
+ shell.ssh!("docker-compose pull #{ignore_pull_failures_option}")
28
+ shell.ssh!("docker-compose up -d")
29
+ end
21
30
 
22
31
  shell.notify "success"
23
32
  end
@@ -8,8 +8,10 @@ module DockerComposeDeploy
8
8
  shell.ssh!("sudo usermod -aG docker $USER")
9
9
  shell.ssh!("true", "-O exit") # resets the connection, so that our group changes take effect
10
10
 
11
- shell.ssh!("wget -qO- https://get.docker.com/ | bash")
12
- shell.ssh!("curl -L https://github.com/docker/compose/releases/download/1.11.1/run.sh > ./docker-compose")
11
+ shell.ssh!("curl -L https://get.docker.com/ > ./docker-install")
12
+ shell.ssh!("bash docker-install")
13
+ shell.ssh!("rm docker-install")
14
+ shell.ssh!("curl -L https://github.com/docker/compose/releases/download/2.27.1/run.sh > ./docker-compose")
13
15
  shell.ssh!("chmod +x docker-compose")
14
16
  shell.ssh!("sudo mv ./docker-compose /usr/local/bin/docker-compose")
15
17
  shell.ssh!("docker-compose -v")
@@ -1,3 +1,3 @@
1
1
  module DockerComposeDeploy
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -31,6 +31,10 @@ module DockerComposeDeploy
31
31
  config_block.fetch("domains", [])
32
32
  end
33
33
 
34
+ def stack?
35
+ config_block.fetch("stack", false)
36
+ end
37
+
34
38
  private
35
39
 
36
40
  def config_block
data/template/config.yml CHANGED
@@ -14,7 +14,9 @@
14
14
  #
15
15
  ################################################################
16
16
  #
17
- # "connection": How we connect to the host machine
17
+ # "connection": "user@host"
18
+ #
19
+ # How we connect to the host machine
18
20
  #
19
21
  # For each, we must configure the connection string that we use
20
22
  # to connect to the host using ssh. The "test" environment is
@@ -23,7 +25,9 @@
23
25
  #
24
26
  ################################################################
25
27
  #
26
- # "ignore_pull_failures": Pull Failures configuration
28
+ # "ignore_pull_failures": true/false
29
+ #
30
+ # Pull Failures configuration
27
31
  #
28
32
  # For each environment we can also set the "ignore_pull_failures"
29
33
  # flag. This flag is used when deploying your docker-compose.yml.
@@ -45,7 +49,26 @@
45
49
  #
46
50
  ################################################################
47
51
  #
48
- # "domains" => Urls to hijack on the host machine
52
+ # "stack": true/false
53
+ #
54
+ # Deploy using docker stack
55
+ #
56
+ # Since docker-compose seems to be on its way out, this flag
57
+ # allows you to deploy your docker-compose file using docker stack
58
+ #
59
+ # This is recommended.
60
+ #
61
+ # If your deployment is not working, try checking
62
+ #
63
+ # docker node ps
64
+ #
65
+ # for information on why your containers are not starting.
66
+ #
67
+ ################################################################
68
+ #
69
+ # "domains" => ["domain1", "domain1"]
70
+ #
71
+ # Urls to hijack on the host machine
49
72
  #
50
73
  # It can be tricky to ensure that the nginx configuration that
51
74
  # your proxy is using is routing things to the correct docker
@@ -71,10 +94,12 @@
71
94
  test:
72
95
  connection: "vagrant@default"
73
96
  ignore_pull_failures: false
97
+ stack: true
74
98
  domains:
75
99
  - www.test
76
100
  - site1.test
77
101
  - site2.test
78
102
  production:
103
+ stack: true
79
104
  connection: "user@yourserver"
80
105
  ignore_pull_failures: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_compose_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2024-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - rubygems@k7u7.com
58
58
  executables:
@@ -90,7 +90,7 @@ homepage: http://github.com/petekinnecom/docker_compose_deploy
90
90
  licenses:
91
91
  - MIT
92
92
  metadata: {}
93
- post_install_message:
93
+ post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths:
96
96
  - lib
@@ -105,10 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubyforge_project:
109
- rubygems_version: 2.5.2
110
- signing_key:
108
+ rubygems_version: 3.4.19
109
+ signing_key:
111
110
  specification_version: 4
112
111
  summary: Easily deploy a Docker Compose project
113
112
  test_files: []
114
- has_rdoc: