capistrano-docker_cluster 1.0.4 → 1.0.5

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
2
  SHA256:
3
- metadata.gz: 444ef3fec5be6c32f7f8cf8e2ee1c1bfb89a153372c6213ff8b505ba46ee4ba7
4
- data.tar.gz: e36145b530ac39683213d08aff2111930cc5a7a0a75094dfd2a6a15f6fffa7d7
3
+ metadata.gz: ebbb1defa7363b3977d59a8086513972c4a0258a4e3766b4de6c306f5beee4ed
4
+ data.tar.gz: 49e0318d6ef793cbe74351bfcce166e456aabd28347c430917b44bd836fca518
5
5
  SHA512:
6
- metadata.gz: b9dfeb4a4e6d4b4d97c4a31d5aaf8c1f5e3df7df51e54c3248793d6675bf7616e7c7f3bd25ade0d264db63ef9d076249ac754b609bd3477997c062bab240ef41
7
- data.tar.gz: ff8957d0fba36b8b62fd65127aae9419943da6ff3208cc80484234f5e1f3ef61b3f261ee62515b31690b5876348c42a75ec7178c8b11a1add69ada8f3ee183fb
6
+ metadata.gz: 44497d8dd8ab30ac78b15362e7ecf8e5081a238804034273e183d5811a6ba4e5189a93f9db486672bd1708ce7b325ad6ec5e1894bddda4d5e6d6b6a117789e43
7
+ data.tar.gz: 7cdd4315f6a9cface2ee10216f7e7376a9d1dbbd21efd20b6a6b104b21c72ca4635e3bd0829bdf77e3f1dae6dc9117b5bb340f75d4e7f14e4755032e9dd3f8f0
data/CHANGE_LOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.0.5
2
+
3
+ * Add "--no-" prefix on arguments to remove them.
4
+ * Add ability to turn off healthcheck entirely.
5
+
1
6
  # 1.0.4
2
7
 
3
8
  * Add --clear-command argument to clear the docker command buffer.
data/bin/docker-cluster CHANGED
@@ -17,15 +17,18 @@
17
17
  # port is the exposed port to map from the containers. The base host port is the port number to start mapping
18
18
  # the container ports to. If the base host port is not specified, then the container port will be used as the
19
19
  # base host port. For instance, `--port=80:8000 --count=2` will start two containers with the first one mapping
20
- # host port 8000 to container port 80 and the second mapping host port 8001 to container port 80.
20
+ # host port 8000 to container port 80 and the second mapping host port 8001 to container port 80. You can use
21
+ # --no-port to clear all port bindings.
21
22
  #
22
23
  # The --hostname parameter can be used to specify a base host name for the containers. The host name for each
23
24
  # container will be "container_name.base_host_name" where container name uses a hyphen instead of a period as
24
- # the delimiter.
25
+ # the delimiter. You can use --no-hostname to clear the hostname to use the default.
25
26
  #
26
27
  # The --healthcheck parameter can be used to specify either a command to run inside the container or a URL
27
28
  # to ping from within the container to determine if the container is up. The next container will not be shutdown
28
- # until the previous one is determined to be up when this parameter is specified.
29
+ # until the previous one is determined to be up when this parameter is specified. If this is not specified,
30
+ # or if the value is "docker", the docker engine health check will be used. You can remove the healthcheck
31
+ # altogether with --no-healthcheck.
29
32
  #
30
33
  # The --timeout parameter can be used to specify a timeout for how long to wait for a container to stop or start
31
34
  # before assuming something is wrong. In the case of stopping the container, the container will be force killed
@@ -39,10 +42,7 @@
39
42
  # The --command parameter can be used to specify the command each docker container should run. If multiple command parameters
40
43
  # are specified, they will be concatenated together. You can use this to specify a command and arguments separately.
41
44
  # You can also specify the command by using --. Anything after a double hyphen will be appended to the docker
42
- # command line verbatim.
43
- #
44
- # The --clear-command flag can be used to clear the docker run command. Use this if you need to completely override
45
- # command that has already been set on the command line.
45
+ # command line verbatim. You can clear the command buffer with --no-command.
46
46
  #
47
47
  # The --force parameter can be used to specify that containers should always be restarted. The default behavior
48
48
  # is to only restart containers if they are not running the specified image.
@@ -64,13 +64,14 @@ usage() {
64
64
  echo " --name CONTAINER_NAME_PREFIX (or --one-off)"
65
65
  echo " [--count CONTAINER_COUNT] (default 1)"
66
66
  echo " [--image DOCKER_IMAGE] (image tag or id; required if --count > 0)"
67
- echo " [--port CONTAINER_PORT[:BASE_HOST_PORT]]"
68
- echo " [--hostname CONTAINER_BASE_HOST_NAME]"
69
- echo " [--healthcheck COMMAND|CURL_URL]"
67
+ echo " [--[no-]port CONTAINER_PORT[:BASE_HOST_PORT]]"
68
+ echo " [--[no-]hostname CONTAINER_BASE_HOST_NAME]"
69
+ echo " [--[no-]healthcheck COMMAND|CURL_URL]"
70
70
  echo " [--timeout SECONDS] (default 120)"
71
71
  echo " [--config CONFIG_FILE_PATH]"
72
- echo " [--command DOCKER_RUN_COMMAND]"
73
- echo " [--verbose]"
72
+ echo " [--[no-]command DOCKER_RUN_COMMAND]"
73
+ echo " [--[no-]verbose]"
74
+ echo " [--] docker command arguments"
74
75
  echo " All other options are passed through to 'docker run'"
75
76
  }
76
77
 
@@ -103,10 +104,16 @@ read_arguments() {
103
104
  [[ -z $val ]] && shift && val=$1
104
105
  PORT_MAPPING+=($val)
105
106
  ;;
107
+ --no-port )
108
+ PORT_MAPPING=()
109
+ ;;
106
110
  --hostname )
107
111
  [[ -z $val ]] && shift && val=$1
108
112
  CONTAINER_BASE_HOST_NAME=$val
109
113
  ;;
114
+ --hostname )
115
+ CONTAINER_BASE_HOST_NAME=
116
+ ;;
110
117
  --config )
111
118
  [[ -z $val ]] && shift && val=$1
112
119
  cat "$val" > /dev/null
@@ -119,6 +126,9 @@ read_arguments() {
119
126
  [[ -z $val ]] && shift && val=$1
120
127
  DOCKER_RUN_COMMAND="$DOCKER_RUN_COMMAND $val"
121
128
  ;;
129
+ --no-command )
130
+ DOCKER_RUN_COMMAND=""
131
+ ;;
122
132
  --clear-command )
123
133
  DOCKER_RUN_COMMAND=""
124
134
  ;;
@@ -133,6 +143,9 @@ read_arguments() {
133
143
  [[ -z $val ]] && shift && val=$1
134
144
  HEALTHCHECK=$val
135
145
  ;;
146
+ --no-healthcheck )
147
+ HEALTHCHECK=
148
+ ;;
136
149
  --timeout )
137
150
  [[ -z $val ]] && shift && val=$1
138
151
  TIMEOUT=$val
@@ -140,6 +153,9 @@ read_arguments() {
140
153
  --force )
141
154
  FORCE_RESTART="1"
142
155
  ;;
156
+ --no-force )
157
+ FORCE_RESTART=
158
+ ;;
143
159
  --help )
144
160
  usage
145
161
  exit
@@ -148,6 +164,10 @@ read_arguments() {
148
164
  set -o xtrace
149
165
  CMD_OUT=/dev/stdout
150
166
  ;;
167
+ --no-verbose )
168
+ set +o xtrace
169
+ CMD_OUT=/dev/null
170
+ ;;
151
171
  -- )
152
172
  shift
153
173
  DOCKER_RUN_COMMAND="$DOCKER_RUN_COMMAND $@"
@@ -323,13 +343,8 @@ start_container() {
323
343
 
324
344
  typeset status=${info_arr[3]}
325
345
  if [[ $status == "Up"* ]]; then
326
- if [[ $HEALTHCHECK != "" ]]; then
327
- healthy=`docker_healthcheck $container_id "$HEALTHCHECK"`
328
- if [[ $healthy == "0" ]]; then
329
- success=0
330
- break
331
- fi
332
- else
346
+ if [[ $HEALTHCHECK == "docker" ]]; then
347
+ # use built in docker health check
333
348
  if [[ $status == *"health"* ]]; then
334
349
  if [[ $status == *"healthy"* ]]; then
335
350
  success=0
@@ -339,6 +354,17 @@ start_container() {
339
354
  success=0
340
355
  break
341
356
  fi
357
+ elif [[ $HEALTHCHECK != "" ]]; then
358
+ # custom container command
359
+ healthy=`docker_healthcheck $container_id "$HEALTHCHECK"`
360
+ if [[ $healthy == "0" ]]; then
361
+ success=0
362
+ break
363
+ fi
364
+ else
365
+ # no health check
366
+ success=0
367
+ break
342
368
  fi
343
369
  fi
344
370
 
@@ -381,7 +407,7 @@ CONTAINER_NAME_PREFIX=
381
407
  CONTAINER_COUNT=1
382
408
  PORT_MAPPING=()
383
409
  DOCKER_RUN_COMMAND=
384
- HEALTHCHECK=
410
+ HEALTHCHECK=docker
385
411
  TIMEOUT=120
386
412
  CMD_OUT=/dev/null
387
413
  DOCKER_RUN_ARGS=
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capistrano
4
4
  module DockerCluster
5
- VERSION = "1.0.4"
5
+ VERSION = "1.0.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-docker_cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano