orchestration 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/locales/en.yml +1 -0
- data/lib/orchestration/docker_compose/app_service.rb +3 -3
- data/lib/orchestration/docker_compose/compose_configuration.rb +2 -0
- data/lib/orchestration/environment.rb +8 -4
- data/lib/orchestration/make/orchestration.mk +12 -4
- data/lib/orchestration/version.rb +1 -1
- data/lib/tasks/orchestration.rake +6 -0
- data/orchestration.gemspec +2 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99bdeb106830843d2a0e600151a4d80b411d21e86f25010d6c2379810ef85273
|
4
|
+
data.tar.gz: 4b3828ec78541d1680d3e5749c0a2e428bed328313d17e13d3f4e0dc1bdb0e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5a03e78c1e442daa079a5d92540df52a148b7ea08b8fa3ecd55919d045e7fc239d5638d8a850565044b9c1d7065b39c4401a72db0daef0d299c622e86ee02f
|
7
|
+
data.tar.gz: e2061ef7628599f65c05d28380376ef841a329f85408c2dfa84172907ada7392dc0ba556b01a6559f3869b1f7b6809304615ebe91a9970e71adc31d04a0e82ed
|
data/README.md
CHANGED
data/config/locales/en.yml
CHANGED
@@ -29,6 +29,7 @@ en:
|
|
29
29
|
rake:
|
30
30
|
config: "Parse and output Orchestration config (internal use)"
|
31
31
|
healthcheck: "Execute healthcheck; used for HEALTHCHECK command in Docker image"
|
32
|
+
compose_services: "Output configured services for a given environment (RAILS_ENV)"
|
32
33
|
install: "Install Orchestration tools"
|
33
34
|
install_makefile: "(Re)create orchestration/Makefile"
|
34
35
|
wait: "Wait for development/test dependencies to be available"
|
@@ -98,10 +98,10 @@ module Orchestration
|
|
98
98
|
'RAILS_LOG_TO_STDOUT' => '1',
|
99
99
|
'RAILS_SERVE_STATIC_FILES' => '1',
|
100
100
|
'WEB_PRELOAD_APP' => '1',
|
101
|
-
'WEB_HEALTHCHECK_PATH' => '/',
|
101
|
+
'WEB_HEALTHCHECK_PATH' => '/healthcheck',
|
102
102
|
'WEB_PORT' => 8080,
|
103
103
|
'DATABASE_URL' => database_url
|
104
|
-
}.merge(inherited_environment.
|
104
|
+
}.merge(inherited_environment.to_h { |key| [key, nil] }).merge(rabbitmq_urls)
|
105
105
|
end
|
106
106
|
|
107
107
|
def rabbitmq_urls
|
@@ -115,7 +115,7 @@ module Orchestration
|
|
115
115
|
'postgresql' => 'postgresql://postgres:password@database-local:5432/production',
|
116
116
|
'mysql2' => 'mysql2://root:password@database-local:3306/production',
|
117
117
|
'sqlite3' => 'sqlite3:db/production.sqlite3'
|
118
|
-
}.fetch(DockerCompose::ComposeConfiguration.database_adapter_name)
|
118
|
+
}.fetch(DockerCompose::ComposeConfiguration.database_adapter_name, nil)
|
119
119
|
end
|
120
120
|
|
121
121
|
def inherited_environment
|
@@ -69,12 +69,12 @@ module Orchestration
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def default_app_name
|
72
|
-
default = docker_filter(root.basename.to_s)
|
72
|
+
default = docker_filter(root.basename.to_s, underscore: true)
|
73
73
|
return default unless defined?(Rails)
|
74
74
|
# Edge case if Rails is used as a dependency but we are not a Rails app:
|
75
75
|
return default if rails_application == Object
|
76
76
|
|
77
|
-
docker_filter(rails_application.name.underscore)
|
77
|
+
docker_filter(rails_application.name.underscore, underscore: true)
|
78
78
|
end
|
79
79
|
|
80
80
|
def rabbitmq_url
|
@@ -126,10 +126,14 @@ module Orchestration
|
|
126
126
|
app_class.parent
|
127
127
|
end
|
128
128
|
|
129
|
-
def docker_filter(string)
|
129
|
+
def docker_filter(string, underscore: false)
|
130
130
|
# Filter out characters not accepted by Docker Hub
|
131
131
|
permitted = [('0'..'9'), ('a'..'z')].map(&:to_a).flatten
|
132
|
-
string.chars.select
|
132
|
+
string.chars.select do |char|
|
133
|
+
next true if underscore && char == '_'
|
134
|
+
|
135
|
+
permitted.include?(char)
|
136
|
+
end.join
|
133
137
|
end
|
134
138
|
end
|
135
139
|
end
|
@@ -141,6 +141,8 @@ docker_config:=$(shell DEVPACK_DISABLE=1 RAILS_ENV=development ${bundle_cmd} rak
|
|
141
141
|
docker_organization=$(word 1,$(docker_config))
|
142
142
|
docker_repository=$(word 2,$(docker_config))
|
143
143
|
|
144
|
+
compose_services:=$(shell ${rake} orchestration:compose_services RAILS_ENV=${env})
|
145
|
+
|
144
146
|
ifeq (,$(project_name))
|
145
147
|
project_base = ${docker_repository}_${env}
|
146
148
|
else
|
@@ -209,9 +211,10 @@ ifndef network
|
|
209
211
|
start: network := ${compose_project_name}
|
210
212
|
endif
|
211
213
|
start: _create-log-directory _clean-logs
|
214
|
+
ifneq (,${compose_services})
|
212
215
|
@$(call system,${compose_human} up --detach)
|
213
216
|
ifeq (${env},$(filter ${env},test development))
|
214
|
-
|
217
|
+
${compose} up --detach --force-recreate --renew-anon-volumes --remove-orphans ${services} ${log} || ${exit_fail}
|
215
218
|
@[ -n '${sidecar}' ] && \
|
216
219
|
( \
|
217
220
|
$(call echo,(joining dependency network ${cyan}${network}${reset})) ; \
|
@@ -229,10 +232,12 @@ endif
|
|
229
232
|
@$(call echo,${env_human} containers started ${tick})
|
230
233
|
@$(call echo,Waiting for services to become available)
|
231
234
|
@$(call make,wait) 2>${stderr} || ${exit_fail}
|
235
|
+
endif
|
232
236
|
|
233
237
|
.PHONY: stop
|
234
238
|
stop: network := ${compose_project_name}
|
235
239
|
stop:
|
240
|
+
ifneq (,${compose_services})
|
236
241
|
@$(call echo,Stopping ${env_human} containers)
|
237
242
|
@$(call system,${compose_human} down)
|
238
243
|
@if docker ps --format "{{.ID}}" | grep -q $(shell hostname) ; \
|
@@ -244,6 +249,7 @@ stop:
|
|
244
249
|
${compose} down ${log} || ${exit_fail} ; \
|
245
250
|
fi
|
246
251
|
@$(call echo,${env_human} containers stopped ${tick})
|
252
|
+
endif
|
247
253
|
|
248
254
|
.PHONY: logs
|
249
255
|
logs:
|
@@ -288,7 +294,9 @@ db-console:
|
|
288
294
|
@${rake} orchestration:db:console RAILS_ENV=${env}
|
289
295
|
|
290
296
|
.PHONY: setup
|
297
|
+
ifneq (,$(wildcard config/database.yml))
|
291
298
|
setup: url = $(shell ${rake} orchestration:db:url RAILS_ENV=${env})
|
299
|
+
endif
|
292
300
|
setup: _log-notify
|
293
301
|
@$(call echo,Setting up ${env_human} environment)
|
294
302
|
@$(call make,start env=${env})
|
@@ -306,9 +314,9 @@ ifneq (,$(wildcard config/database.yml))
|
|
306
314
|
@$(call system,rake db:migrate DATABASE_URL="${url}")
|
307
315
|
@${rake} db:migrate RAILS_ENV=${env}
|
308
316
|
endif
|
309
|
-
|
310
|
-
|
311
|
-
&& $(MAKE) post-setup RAILS_ENV=${env}
|
317
|
+
@if $(MAKE) -n post-setup >/dev/null 2>&1; then \
|
318
|
+
$(call system,make post-setup RAILS_ENV=${env}) \
|
319
|
+
&& $(MAKE) post-setup RAILS_ENV=${env}; fi
|
312
320
|
@$(call echo,${env_human} environment setup complete ${tick})
|
313
321
|
|
314
322
|
.PHONY: dump
|
@@ -39,6 +39,12 @@ namespace :orchestration do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
desc I18n.t('orchestration.rake.compose_services')
|
43
|
+
task :compose_services do
|
44
|
+
config = Orchestration::DockerCompose::ComposeConfiguration.new(Orchestration::Environment.new)
|
45
|
+
puts config.services.keys.join(' ') unless config.services.nil? || config.services.empty?
|
46
|
+
end
|
47
|
+
|
42
48
|
desc I18n.t('orchestration.rake.healthcheck')
|
43
49
|
task :healthcheck do
|
44
50
|
Orchestration::DockerHealthcheck.execute
|
data/orchestration.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.summary = 'Docker orchestration toolkit'
|
15
15
|
spec.description = 'Tools to help launch apps in Docker'
|
16
16
|
spec.homepage = url
|
17
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
17
18
|
|
18
19
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
20
|
`git ls-files -z`.split("\x0").reject do |f|
|
@@ -21,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
spec.required_ruby_version = '~> 2.
|
25
|
+
spec.required_ruby_version = '~> 2.7'
|
25
26
|
spec.bindir = 'bin'
|
26
27
|
spec.executables = []
|
27
28
|
spec.require_paths = ['lib']
|
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.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|
@@ -414,7 +414,8 @@ files:
|
|
414
414
|
- orchestration.gemspec
|
415
415
|
homepage: https://github.com/bobf/orchestration
|
416
416
|
licenses: []
|
417
|
-
metadata:
|
417
|
+
metadata:
|
418
|
+
rubygems_mfa_required: 'true'
|
418
419
|
post_install_message:
|
419
420
|
rdoc_options: []
|
420
421
|
require_paths:
|
@@ -423,14 +424,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
423
424
|
requirements:
|
424
425
|
- - "~>"
|
425
426
|
- !ruby/object:Gem::Version
|
426
|
-
version: '2.
|
427
|
+
version: '2.7'
|
427
428
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
428
429
|
requirements:
|
429
430
|
- - ">="
|
430
431
|
- !ruby/object:Gem::Version
|
431
432
|
version: '0'
|
432
433
|
requirements: []
|
433
|
-
rubygems_version: 3.
|
434
|
+
rubygems_version: 3.1.6
|
434
435
|
signing_key:
|
435
436
|
specification_version: 4
|
436
437
|
summary: Docker orchestration toolkit
|