orchestration 0.4.21 → 0.5.0
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/README.md +5 -39
- data/lib/orchestration/templates/orchestration.mk.erb +11 -33
- data/lib/orchestration/version.rb +1 -1
- data/lib/tasks/orchestration.rake +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972211f73865daa2a2ea2bcbfc35e031d9d974ba8fc129fda6bc8908073c9821
|
4
|
+
data.tar.gz: e1c219157ed6911b89f2af2c0b0851209ce9473c4370d9728e0600486495a564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23400aeae92d13494edde9881448aa24a7fb4e4d7a96a574062c89cb0c8ff7955d884bb8fb5b1fba7a646d0c51bec4e5bc22743fdb91ea104a67d7b65f1cfc57
|
7
|
+
data.tar.gz: e06f3cb45140a2f90e95e7ab5492537f40600da1db892c7f9041f474119509a08882870b3a7d69a68e4727cc02a7af3a9cb80b01881cd727ac9671f65a1af1a6
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
|
|
35
35
|
Add _Orchestration_ to your Gemfile:
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
gem 'orchestration', '~> 0.
|
38
|
+
gem 'orchestration', '~> 0.5.0'
|
39
39
|
```
|
40
40
|
|
41
41
|
Install:
|
@@ -276,10 +276,10 @@ The output from most underlying components is hidden in an effort to make contin
|
|
276
276
|
tail -f log/orchestration*.log
|
277
277
|
```
|
278
278
|
|
279
|
-
A convenience `Makefile` target `dump` is provided
|
279
|
+
A convenience `Makefile` target `dump` is provided. The following command will output all consumed _stdout_, _stderr_, and _Docker Compose_ container logs for the test environment:
|
280
280
|
|
281
281
|
```bash
|
282
|
-
make dump
|
282
|
+
make dump env=test
|
283
283
|
```
|
284
284
|
|
285
285
|
All commands also support the `verbose` flag which will output all logs immediately to the console:
|
@@ -395,44 +395,10 @@ This is a convention of the _Orchestration_ gem intended to make _RabbitMQ_ conf
|
|
395
395
|
|
396
396
|
## Alternate Database Configuration Files
|
397
397
|
|
398
|
-
If you have multiple databases configured in various
|
398
|
+
If you have multiple databases configured in various `config/database.*.yml` files then the `make wait` command will automatically detect database configurations.
|
399
399
|
|
400
|
-
|
400
|
+
If a service `database-example` is included in the relevant _Docker Compose_ configuration then `config/database.example.yml` will be used to load the connection configuration. Note that the service name _must_ begin with `database-`.
|
401
401
|
|
402
|
-
Assuming the following configurations:
|
403
|
-
```
|
404
|
-
# orchestration/docker-compose.test.yml
|
405
|
-
version: '3.7'
|
406
|
-
services:
|
407
|
-
customdb:
|
408
|
-
image: postgres
|
409
|
-
ports:
|
410
|
-
- "55667:5432"
|
411
|
-
# ...
|
412
|
-
```
|
413
|
-
|
414
|
-
```
|
415
|
-
# config/database.custom.yml
|
416
|
-
test:
|
417
|
-
adapter: postgresql
|
418
|
-
host: 127.0.0.1
|
419
|
-
port: 55667
|
420
|
-
username: postgres
|
421
|
-
password: password
|
422
|
-
database: postgres
|
423
|
-
```
|
424
|
-
|
425
|
-
The following command can be used to ensure that the `customdb` service is available:
|
426
|
-
```
|
427
|
-
make wait-database service=custom config=config/database.custom.yml env=test
|
428
|
-
```
|
429
|
-
|
430
|
-
You may wish to extend the example `Makefile` to include something like this:
|
431
|
-
```
|
432
|
-
test: test-setup
|
433
|
-
$(MAKE) wait-database service=custom config=config/database.custom.yml env=test
|
434
|
-
# ...
|
435
|
-
```
|
436
402
|
## License
|
437
403
|
|
438
404
|
[MIT License](LICENSE)
|
@@ -116,15 +116,11 @@ ifeq (${env},$(filter ${env},test development))
|
|
116
116
|
) \
|
117
117
|
|| ( [ -z '${sidecar}' ] || ${fail} )
|
118
118
|
else
|
119
|
-
@${compose} up --detach --scale app=$${instances:-1} ${
|
119
|
+
@${compose} up --detach --scale app=$${instances:-1} ${log} || ${fail}
|
120
120
|
endif
|
121
121
|
@$(call printrawln,' ${green}started${reset} ${tick}')
|
122
122
|
@$(call println,'${yellow}Waiting for services to become available${reset} ...')
|
123
|
-
ifdef services
|
124
|
-
@$(call make,wait services='${services}') 2>${stderr} || ${fail}
|
125
|
-
else
|
126
123
|
@$(call make,wait) 2>${stderr} || ${fail}
|
127
|
-
endif
|
128
124
|
|
129
125
|
<% services.each do |service| %>
|
130
126
|
.PHONY: start-<%= service %>
|
@@ -226,6 +222,14 @@ ifndef verbose
|
|
226
222
|
$(call hr,${red}) ; \
|
227
223
|
)
|
228
224
|
endif
|
225
|
+
@echo ; \
|
226
|
+
$(call hr,${yellow}) ; \
|
227
|
+
$(call println,'${gray}docker-compose logs${reset}') ; \
|
228
|
+
$(call hr,${yellow}) ; \
|
229
|
+
echo
|
230
|
+
@${compose} logs
|
231
|
+
@echo ; \
|
232
|
+
$(call hr,${yellow})
|
229
233
|
|
230
234
|
.PHONY: image
|
231
235
|
image:
|
@@ -296,14 +300,8 @@ endif
|
|
296
300
|
### Service healthcheck commands ###
|
297
301
|
|
298
302
|
.PHONY: wait
|
299
|
-
|
300
|
-
|
301
|
-
wait: wait-<%= service %>
|
302
|
-
endif
|
303
|
-
<% end %>
|
304
|
-
ifndef services
|
305
|
-
wait: <%= services.map { |command| "wait-#{command}" }.join(' ') %>
|
306
|
-
endif
|
303
|
+
wait:
|
304
|
+
@${rake} orchestration:wait
|
307
305
|
@$(call println,'${yellow}All services${reset} ${green}ready${reset}. ${tick}')
|
308
306
|
|
309
307
|
## Generic Listener healthcheck for TCP services ##
|
@@ -311,26 +309,6 @@ endif
|
|
311
309
|
wait-listener:
|
312
310
|
@${rake} orchestration:listener:wait service=${service} sidecar=${sidecar}
|
313
311
|
|
314
|
-
## Test/development wait commands
|
315
|
-
|
316
|
-
<% services.each do |service| %>
|
317
|
-
<% next if service.to_sym == :app %>
|
318
|
-
.PHONY: wait-<%= service %>
|
319
|
-
ifdef config
|
320
|
-
wait-<%= service %>: configvar := config=$(config)
|
321
|
-
endif
|
322
|
-
ifdef service
|
323
|
-
wait-<%= service %>: servicevar := service=$(service)
|
324
|
-
endif
|
325
|
-
wait-<%= service %>:
|
326
|
-
@${rake} orchestration:<%= service %>:wait $(configvar) $(servicevar)
|
327
|
-
|
328
|
-
<% end %>
|
329
|
-
|
330
|
-
.PHONY: wait-app
|
331
|
-
wait-app:
|
332
|
-
@# no-op
|
333
|
-
|
334
312
|
### Docker build commands ###
|
335
313
|
|
336
314
|
.PHONY: build
|
@@ -15,6 +15,31 @@ namespace :orchestration do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
task :wait do
|
19
|
+
env = Orchestration::Environment.new
|
20
|
+
services = Orchestration::Services
|
21
|
+
env.docker_compose_config['services'].each do |name, service|
|
22
|
+
path = nil
|
23
|
+
|
24
|
+
adapter = if name == 'database'
|
25
|
+
services::Database
|
26
|
+
elsif name.include?('database')
|
27
|
+
path = "config/database.#{name.sub('database-', '')}.yml"
|
28
|
+
services::Database
|
29
|
+
elsif name == 'mongo'
|
30
|
+
services::Mongo
|
31
|
+
elsif name == 'rabbitmq'
|
32
|
+
services::RabbitMQ
|
33
|
+
else
|
34
|
+
services::Listener
|
35
|
+
end
|
36
|
+
|
37
|
+
adapter::Healthcheck.start(
|
38
|
+
nil, nil, config_path: path, service_name: name, sidecar: ENV['sidecar']
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
18
43
|
namespace :app do
|
19
44
|
desc I18n.t('orchestration.rake.app.wait')
|
20
45
|
task :wait do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|