capistrano-docker_cluster 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGE_LOG.md +4 -0
- data/README.md +6 -0
- data/bin/docker-cluster +8 -1
- data/lib/capistrano-docker_cluster.rb +3 -0
- data/lib/capistrano/docker_cluster/scripts.rb +47 -9
- data/lib/capistrano/docker_cluster/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8968081d032261ad943dd8c0a356c9b9862ebd6b000b54e5489fe4f934c401f
|
4
|
+
data.tar.gz: 727e4cef7ef2ab53e3ca6c6a19f820b938135f5a024193a83d30bdc217b1826a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66820769e19bea0782c7e5c0f966593f8a4a3472bead40666ea0167f2ad91c9e51760fa15b9477a8c8b0d191ef637a6961c44fab42a0c7cdfd0284030a1dc9f8
|
7
|
+
data.tar.gz: 3cbb64c824c58e5512cf5481981692e0d9363c3e38e14fe55e836a51bafc86f2f4fe9c55803f6ef59fd796411438b166f0583784f704601f5a353d48f6eb8256
|
data/CHANGE_LOG.md
CHANGED
data/README.md
CHANGED
@@ -32,10 +32,16 @@ The deployment is configured with the following properties in your capistrano re
|
|
32
32
|
|
33
33
|
* `docker_app_configs` - Map of configuration files for starting specific docker apps.
|
34
34
|
|
35
|
+
* `docker_configs_<app>` - List of global configuration files for starting a docker app.
|
36
|
+
|
35
37
|
* `docker_args` - List of global command line arguments for all continers.
|
36
38
|
|
37
39
|
* `docker_app_args` - Map of command line arguments for starting specific docker apps.
|
38
40
|
|
41
|
+
* `docker_args_<app>` - List of global command line arguments for starting a specific docker app.
|
42
|
+
|
43
|
+
Directory structures are ignored when configuration filse copies to servers for `docker_configs` and `docker_app_configs`. This means you can only have one file with a given base name in all you configuration files. So, `config/app/web.properties` and `config/production/web.properties` will both be copied to `confg/web.properties` on the servers. You can use this feature to overwrite whole files if you need to, but otherwise you'll need to use unique file names.
|
44
|
+
|
39
45
|
### Example Configuration
|
40
46
|
|
41
47
|
```ruby
|
data/bin/docker-cluster
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
# host port 8000 to container port 80 and the second mapping host port 8001 to container port 80.
|
21
21
|
#
|
22
22
|
# The --hostname parameter can be used to specify a base host name for the containers. The host name for each
|
23
|
-
# container will be "container_name.
|
23
|
+
# container will be "container_name.base_host_name" where container name uses a hyphen instead of a period as
|
24
24
|
# the delimiter.
|
25
25
|
#
|
26
26
|
# The --healthcheck parameter can be used to specify either a command to run inside the container or a URL
|
@@ -38,6 +38,8 @@
|
|
38
38
|
#
|
39
39
|
# The --command parameter can be used to specify the command each docker container should run. If multiple command parameters
|
40
40
|
# are specified, they will be concatenated together. You can use this to specify a command and arguments separately.
|
41
|
+
# You can also specify the command by using --. Anything after a double hyphen will be appended to the docker
|
42
|
+
# command line verbatim.
|
41
43
|
#
|
42
44
|
# The --force parameter can be used to specify that containers should always be restarted. The default behavior
|
43
45
|
# is to only restart containers if they are not running the specified image.
|
@@ -139,6 +141,11 @@ read_arguments() {
|
|
139
141
|
set -o xtrace
|
140
142
|
CMD_OUT=/dev/stdout
|
141
143
|
;;
|
144
|
+
-- )
|
145
|
+
shift
|
146
|
+
DOCKER_RUN_COMMAND="$DOCKER_RUN_COMMAND $@"
|
147
|
+
shift ${#@}
|
148
|
+
;;
|
142
149
|
* )
|
143
150
|
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS $1"
|
144
151
|
esac
|
@@ -130,10 +130,22 @@ module Capistrano
|
|
130
130
|
end
|
131
131
|
|
132
132
|
apps = Array(fetch_for_host(host, :docker_apps))
|
133
|
-
|
134
133
|
app_configs = app_configuration(fetch(:docker_app_configs, nil))
|
134
|
+
host_app_configs = app_configuration(host.properties.send(:docker_app_configs))
|
135
|
+
apps += app_configs.keys if app_configs
|
136
|
+
apps += host_app_configs.keys if host_app_configs
|
137
|
+
apps = apps.collect(&:to_s).uniq
|
138
|
+
|
139
|
+
if app_configs
|
140
|
+
app_configs.values.each do |paths|
|
141
|
+
Array(paths).each do |path|
|
142
|
+
configs[File.basename(path)] = path
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
135
147
|
apps.each do |app|
|
136
|
-
Array(
|
148
|
+
Array(fetch(:"docker_app_configs_#{app}")).each do |path|
|
137
149
|
configs[File.basename(path)] = path
|
138
150
|
end
|
139
151
|
end
|
@@ -142,9 +154,16 @@ module Capistrano
|
|
142
154
|
configs[File.basename(path)] = path
|
143
155
|
end
|
144
156
|
|
145
|
-
host_app_configs
|
157
|
+
if host_app_configs
|
158
|
+
host_app_configs.values.each do |paths|
|
159
|
+
Array(paths).each do |path|
|
160
|
+
configs[File.basename(path)] = path
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
146
165
|
apps.each do |app|
|
147
|
-
Array(
|
166
|
+
Array(host.properties.send(:"docker_app_configs_#{app}")).each do |path|
|
148
167
|
configs[File.basename(path)] = path
|
149
168
|
end
|
150
169
|
end
|
@@ -182,24 +201,43 @@ module Capistrano
|
|
182
201
|
end
|
183
202
|
|
184
203
|
def app_host_args(app, host)
|
185
|
-
|
204
|
+
global_config_args = config_args(fetch(:docker_configs, nil))
|
186
205
|
command_args = Array(fetch(:docker_args, nil))
|
187
206
|
|
188
207
|
host_config_args = config_args(host.properties.send(:docker_configs))
|
189
|
-
host_command_args = Array(host.properties.send(:
|
208
|
+
host_command_args = Array(host.properties.send(:docker_args))
|
190
209
|
|
191
210
|
app_configs = app_configuration(fetch(:docker_app_configs, {}))
|
192
211
|
app_args = app_configuration(fetch(:docker_app_args, {}))
|
193
212
|
|
194
|
-
host_app_configs = app_configuration(host.properties.send(:
|
195
|
-
host_app_args = app_configuration(host.properties.send(:
|
213
|
+
host_app_configs = app_configuration(host.properties.send(:docker_app_configs))
|
214
|
+
host_app_args = app_configuration(host.properties.send(:docker_app_args))
|
196
215
|
|
197
216
|
app = app.to_s
|
198
217
|
app_config_args = config_args(app_configs[app])
|
199
218
|
app_command_args = Array(app_args[app])
|
200
219
|
host_app_config_args = config_args(host_app_configs[app])
|
201
220
|
host_app_command_args = Array(host_app_args[app])
|
202
|
-
|
221
|
+
|
222
|
+
inline_app_config_args = config_args(fetch(:"docker_app_configs_#{app}", nil))
|
223
|
+
inline_app_command_args = Array(fetch(:"docker_app_args_#{app}", nil))
|
224
|
+
|
225
|
+
host_inline_app_config_args = config_args(host.properties.send(:"docker_app_configs_#{app}"))
|
226
|
+
host_inline_app_command_args = Array(host.properties.send(:"docker_app_args_#{app}"))
|
227
|
+
|
228
|
+
args = global_config_args +
|
229
|
+
command_args +
|
230
|
+
app_config_args +
|
231
|
+
inline_app_config_args +
|
232
|
+
app_command_args +
|
233
|
+
inline_app_command_args +
|
234
|
+
host_config_args +
|
235
|
+
host_command_args +
|
236
|
+
host_app_config_args +
|
237
|
+
host_inline_app_config_args +
|
238
|
+
host_app_command_args +
|
239
|
+
host_inline_app_command_args
|
240
|
+
|
203
241
|
args.uniq
|
204
242
|
end
|
205
243
|
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
|
+
version: 1.0.2
|
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-
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- bin/docker-cluster
|
67
67
|
- capistrano-docker_cluster.gemspec
|
68
|
+
- lib/capistrano-docker_cluster.rb
|
68
69
|
- lib/capistrano/docker_cluster.rb
|
69
70
|
- lib/capistrano/docker_cluster/scripts.rb
|
70
71
|
- lib/capistrano/docker_cluster/version.rb
|