orchestration 0.6.3 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.strong_versions.yml +1 -0
- data/README.md +1 -1
- data/UPGRADE.md +22 -2
- data/config/locales/en.yml +2 -0
- data/lib/orchestration/docker_compose/app_service.rb +5 -7
- data/lib/orchestration/docker_compose/compose_configuration.rb +4 -0
- data/lib/orchestration/docker_compose/compose_helpers.rb +6 -0
- data/lib/orchestration/docker_compose/database_service.rb +0 -6
- data/lib/orchestration/docker_compose/mongo_service.rb +1 -1
- data/lib/orchestration/docker_compose/rabbitmq_service.rb +1 -1
- data/lib/orchestration/environment.rb +8 -4
- data/lib/orchestration/make/orchestration.mk +37 -25
- data/lib/orchestration/templates/Dockerfile.erb +1 -1
- data/lib/orchestration/templates/application.mk.erb +3 -6
- data/lib/orchestration/terminal.rb +4 -0
- data/lib/orchestration/version.rb +1 -1
- data/lib/orchestration.rb +1 -0
- data/lib/tasks/orchestration.rake +97 -1
- data/orchestration.gemspec +3 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz: '
|
3
|
+
metadata.gz: 12b69a813bf576761bf0c72198b9bf68a9e1ce212d4dd1f1c819f50c2b3a46cf
|
4
|
+
data.tar.gz: '0383c1b95a84b29fe78ab766ed6fb8f862f32f8cd33a1695b815ecb752f00be5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1df8619845cdf6383360e22b051f0307665b9c7137d2e2a105595cbc9ba38b39745b9c44169c3585edabc389dab18ec61f8371e73b1899c84e6a8f2c212bc3
|
7
|
+
data.tar.gz: 2d467b15257d2ce8346e9f6e9efdebbb7e23d25aed0576b205c5ec9da85dc038b81fd8d92d6dfd35cf0fbe6358aab92ef71fef94071009a941a95220741aaab7
|
data/.strong_versions.yml
CHANGED
data/README.md
CHANGED
data/UPGRADE.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
-
# Upgrade guide
|
1
|
+
# Upgrade guide (0.5 to 0.6)
|
2
2
|
|
3
|
-
##
|
3
|
+
## Automatic Upgrade
|
4
|
+
|
5
|
+
A _Rake_ task is provided to automatically upgrade your application:
|
6
|
+
|
7
|
+
```bash
|
8
|
+
bundle exec rake orchestration:upgrade
|
9
|
+
```
|
10
|
+
|
11
|
+
Obsolete files will be removed and required modifications to existing files will be applied.
|
12
|
+
|
13
|
+
It is recommended to manually verify the validity of all changes to ensure that no custom configuration is lost.
|
14
|
+
|
15
|
+
## Manual Upgrade
|
4
16
|
|
5
17
|
### Delete/rename files
|
6
18
|
|
@@ -48,6 +60,14 @@ post-setup:
|
|
48
60
|
|
49
61
|
Replace the body of this target with any commands that you want to take place once the initial setup (launching development/test containers, running migrations, etc.) is complete. For example, running migrations for a secondary database.
|
50
62
|
|
63
|
+
### Update Dockerfile healthcheck
|
64
|
+
|
65
|
+
Edit `orchestration/Dockerfile` and edit the `HEALTHCHECK` directive's `CMD` to:
|
66
|
+
|
67
|
+
```
|
68
|
+
CMD ["bundle","exec","rake","orchestration:healthcheck"]
|
69
|
+
```
|
70
|
+
|
51
71
|
### Continuous Integration files
|
52
72
|
|
53
73
|
Update any continuous integration scripts (e.g. `Jenkinsfile`) to run the `setup` target before `test`, e.g.:
|
data/config/locales/en.yml
CHANGED
@@ -28,7 +28,9 @@ en:
|
|
28
28
|
|
29
29
|
rake:
|
30
30
|
config: "Parse and output Orchestration config (internal use)"
|
31
|
+
upgrade: "Upgrade from Orchestration 0.5.x to 0.6.x"
|
31
32
|
healthcheck: "Execute healthcheck; used for HEALTHCHECK command in Docker image"
|
33
|
+
compose_services: "Output configured services for a given environment (RAILS_ENV)"
|
32
34
|
install: "Install Orchestration tools"
|
33
35
|
install_makefile: "(Re)create orchestration/Makefile"
|
34
36
|
wait: "Wait for development/test dependencies to be available"
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Orchestration
|
4
4
|
module DockerCompose
|
5
5
|
class AppService
|
6
|
+
include ComposeHelpers
|
7
|
+
|
6
8
|
def initialize(config, environment)
|
7
9
|
@environment = environment
|
8
10
|
@config = config
|
@@ -89,19 +91,15 @@ module Orchestration
|
|
89
91
|
}
|
90
92
|
end
|
91
93
|
|
92
|
-
def networks
|
93
|
-
{ 'local' => {} }
|
94
|
-
end
|
95
|
-
|
96
94
|
def environment
|
97
95
|
{
|
98
96
|
'RAILS_LOG_TO_STDOUT' => '1',
|
99
97
|
'RAILS_SERVE_STATIC_FILES' => '1',
|
100
98
|
'WEB_PRELOAD_APP' => '1',
|
101
|
-
'WEB_HEALTHCHECK_PATH' => '/',
|
99
|
+
'WEB_HEALTHCHECK_PATH' => '/healthcheck',
|
102
100
|
'WEB_PORT' => 8080,
|
103
101
|
'DATABASE_URL' => database_url
|
104
|
-
}.merge(inherited_environment.
|
102
|
+
}.merge(inherited_environment.to_h { |key| [key, nil] }).merge(rabbitmq_urls)
|
105
103
|
end
|
106
104
|
|
107
105
|
def rabbitmq_urls
|
@@ -115,7 +113,7 @@ module Orchestration
|
|
115
113
|
'postgresql' => 'postgresql://postgres:password@database-local:5432/production',
|
116
114
|
'mysql2' => 'mysql2://root:password@database-local:3306/production',
|
117
115
|
'sqlite3' => 'sqlite3:db/production.sqlite3'
|
118
|
-
}.fetch(DockerCompose::ComposeConfiguration.database_adapter_name)
|
116
|
+
}.fetch(DockerCompose::ComposeConfiguration.database_adapter_name, nil)
|
119
117
|
end
|
120
118
|
|
121
119
|
def inherited_environment
|
@@ -42,12 +42,16 @@ module Orchestration
|
|
42
42
|
ports(name).find { |mapping| mapping[:remote] == remote_port }
|
43
43
|
.fetch(:local)
|
44
44
|
.to_i
|
45
|
+
rescue NoMethodError
|
46
|
+
nil
|
45
47
|
end
|
46
48
|
|
47
49
|
private
|
48
50
|
|
49
51
|
def config
|
50
52
|
@config ||= @env.docker_compose_config
|
53
|
+
rescue Errno::ENOENT
|
54
|
+
{}
|
51
55
|
end
|
52
56
|
|
53
57
|
def listener?(name)
|
@@ -13,6 +13,12 @@ module Orchestration
|
|
13
13
|
# "3306" (docker will use an ephemeral host port which we will not use)
|
14
14
|
"${sidecar-#{port}:}"
|
15
15
|
end
|
16
|
+
|
17
|
+
def networks
|
18
|
+
service = self.class.name.rpartition('::').last.partition('Service').first.downcase
|
19
|
+
network_alias = %i[development test].include?(@environment) ? service : "#{service}-local"
|
20
|
+
{ 'local' => { 'aliases' => [network_alias] } }
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
@@ -33,12 +33,6 @@ module Orchestration
|
|
33
33
|
adapter.default_port
|
34
34
|
end
|
35
35
|
|
36
|
-
def networks
|
37
|
-
return {} unless @environment == :deployment
|
38
|
-
|
39
|
-
{ 'local' => { 'aliases' => ['database-local'] } }
|
40
|
-
end
|
41
|
-
|
42
36
|
def ports
|
43
37
|
return {} unless %i[development test].include?(@environment)
|
44
38
|
|
@@ -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
|
@@ -99,13 +99,21 @@ exit_fail=( \
|
|
99
99
|
)
|
100
100
|
|
101
101
|
ifdef env_file
|
102
|
-
|
102
|
+
env_path=${env_file}
|
103
103
|
else
|
104
|
-
|
105
|
-
ifeq (,$(findstring test,$(MAKECMDGOALS)))
|
106
|
-
-include .env
|
104
|
+
env_path=.env
|
107
105
|
endif
|
106
|
+
|
107
|
+
ifneq (${env},test)
|
108
|
+
ifeq (,$(findstring test,$(MAKECMDGOALS)))
|
109
|
+
ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
|
110
|
+
-include ${env_path}
|
111
|
+
endif
|
112
|
+
endif
|
108
113
|
endif
|
114
|
+
|
115
|
+
ifneq (,$(findstring deploy,$(MAKECMDGOALS)))
|
116
|
+
RAILS_ENV=$(shell grep '^RAILS_ENV=' '${env_path}' | tail -n1 | sed 's/^RAILS_ENV=//')
|
109
117
|
endif
|
110
118
|
|
111
119
|
export
|
@@ -130,17 +138,21 @@ DOCKER_TAG ?= latest
|
|
130
138
|
ifneq (,$(wildcard ./Gemfile))
|
131
139
|
bundle_cmd = bundle exec
|
132
140
|
endif
|
133
|
-
rake=DEVPACK_DISABLE=1 RACK_ENV=${env} RAILS_ENV=${env} ${bundle_cmd} rake
|
141
|
+
rake=DEVPACK_DISABLE=1 RACK_ENV=${env} SECRET_KEY_BASE='placeholder-secret' RAILS_ENV=${env} ${bundle_cmd} rake
|
134
142
|
|
135
143
|
ifneq (,$(wildcard ${env_file}))
|
136
|
-
|
137
|
-
|
144
|
+
ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
|
145
|
+
rake_cmd:=${rake}
|
146
|
+
rake=. ${env_file} && ${rake_cmd}
|
147
|
+
endif
|
138
148
|
endif
|
139
149
|
|
140
150
|
docker_config:=$(shell DEVPACK_DISABLE=1 RAILS_ENV=development ${bundle_cmd} rake orchestration:config 2>/dev/null || echo no-org no-repo)
|
141
151
|
docker_organization=$(word 1,$(docker_config))
|
142
152
|
docker_repository=$(word 2,$(docker_config))
|
143
153
|
|
154
|
+
compose_services:=$(shell ${rake} orchestration:compose_services RAILS_ENV=${env})
|
155
|
+
|
144
156
|
ifeq (,$(project_name))
|
145
157
|
project_base = ${docker_repository}_${env}
|
146
158
|
else
|
@@ -209,6 +221,7 @@ ifndef network
|
|
209
221
|
start: network := ${compose_project_name}
|
210
222
|
endif
|
211
223
|
start: _create-log-directory _clean-logs
|
224
|
+
ifneq (,${compose_services})
|
212
225
|
@$(call system,${compose_human} up --detach)
|
213
226
|
ifeq (${env},$(filter ${env},test development))
|
214
227
|
@${compose} up --detach --force-recreate --renew-anon-volumes --remove-orphans ${services} ${log} || ${exit_fail}
|
@@ -229,10 +242,12 @@ endif
|
|
229
242
|
@$(call echo,${env_human} containers started ${tick})
|
230
243
|
@$(call echo,Waiting for services to become available)
|
231
244
|
@$(call make,wait) 2>${stderr} || ${exit_fail}
|
245
|
+
endif
|
232
246
|
|
233
247
|
.PHONY: stop
|
234
248
|
stop: network := ${compose_project_name}
|
235
249
|
stop:
|
250
|
+
ifneq (,${compose_services})
|
236
251
|
@$(call echo,Stopping ${env_human} containers)
|
237
252
|
@$(call system,${compose_human} down)
|
238
253
|
@if docker ps --format "{{.ID}}" | grep -q $(shell hostname) ; \
|
@@ -244,6 +259,7 @@ stop:
|
|
244
259
|
${compose} down ${log} || ${exit_fail} ; \
|
245
260
|
fi
|
246
261
|
@$(call echo,${env_human} containers stopped ${tick})
|
262
|
+
endif
|
247
263
|
|
248
264
|
.PHONY: logs
|
249
265
|
logs:
|
@@ -288,27 +304,29 @@ db-console:
|
|
288
304
|
@${rake} orchestration:db:console RAILS_ENV=${env}
|
289
305
|
|
290
306
|
.PHONY: setup
|
291
|
-
|
307
|
+
ifneq (,$(wildcard config/database.yml))
|
308
|
+
setup: url = $(shell ${rake} orchestration:db:url RAILS_ENV=${env} 2>/dev/null)
|
309
|
+
endif
|
292
310
|
setup: _log-notify
|
293
311
|
@$(call echo,Setting up ${env_human} environment)
|
294
312
|
@$(call make,start env=${env})
|
295
313
|
ifneq (,$(wildcard config/database.yml))
|
296
314
|
@$(call echo,Preparing ${env_human} database)
|
297
|
-
@$(call system,rake db:create
|
315
|
+
@$(call system,rake db:create RAILS_ENV="${env}")
|
298
316
|
@${rake} db:create RAILS_ENV=${env} ${log} || : ${log}
|
299
317
|
ifneq (,$(wildcard db/structure.sql))
|
300
|
-
@$(call system,rake db:
|
301
|
-
@${rake} db:
|
318
|
+
@$(call system,rake db:structure:load RAILS_ENV="${env}" DATABASE_URL="${url}")
|
319
|
+
@${rake} db:structure:load RAILS_ENV="${env}" DATABASE_URL='${url}' ${log} || ${exit_fail}
|
302
320
|
else ifneq (,$(wildcard db/schema.rb))
|
303
|
-
@$(call system,rake db:schema:load DATABASE_URL="${url}")
|
304
|
-
@${rake} db:schema:load DATABASE_URL='${url}' ${log} || ${exit_fail}
|
321
|
+
@$(call system,rake db:schema:load RAILS_ENV="${env}" DATABASE_URL="${url}")
|
322
|
+
@${rake} db:schema:load RAILS_ENV="${env}" DATABASE_URL='${url}' ${log} || ${exit_fail}
|
305
323
|
endif
|
306
|
-
@$(call system,rake db:migrate DATABASE_URL="${url}")
|
307
|
-
@${rake} db:migrate RAILS_ENV=${env}
|
324
|
+
@$(call system,rake db:migrate RAILS_ENV="${env}" DATABASE_URL="${url}")
|
325
|
+
@${rake} db:migrate RAILS_ENV=${env} ${log} || ${exit_fail}
|
308
326
|
endif
|
309
|
-
|
310
|
-
|
311
|
-
&& $(MAKE) post-setup RAILS_ENV=${env}
|
327
|
+
@if $(MAKE) -n post-setup >/dev/null 2>&1; then \
|
328
|
+
$(call system,make post-setup RAILS_ENV="${env}") \
|
329
|
+
&& $(MAKE) post-setup RAILS_ENV=${env}; fi
|
312
330
|
@$(call echo,${env_human} environment setup complete ${tick})
|
313
331
|
|
314
332
|
.PHONY: dump
|
@@ -414,15 +432,9 @@ wait-listener:
|
|
414
432
|
build: _log-notify _clean-logs
|
415
433
|
build: build_dir = ${orchestration_dir}/.build
|
416
434
|
build: context = ${build_dir}/context.tar
|
417
|
-
build: build_args := --build-arg GIT_COMMIT='${git_version}'
|
435
|
+
build: build_args := --build-arg GIT_COMMIT='${git_version}' $(shell grep '^ARG ' orchestration/Dockerfile | sed -e 's/=.*$$//' -e 's/^ARG /--build-arg /')
|
418
436
|
build: tag_human = ${cyan}${docker_organization}/${docker_repository}:${git_version}${reset}
|
419
437
|
build: latest_tag_human = ${cyan}${docker_organization}/${docker_repository}:latest${reset}
|
420
|
-
ifdef BUNDLE_GITHUB__COM
|
421
|
-
build: build_args := ${build_args} --build-arg BUNDLE_GITHUB__COM
|
422
|
-
endif
|
423
|
-
ifdef BUNDLE_BITBUCKET__ORG
|
424
|
-
build: build_args := ${build_args} --build-arg BUNDLE_BITBUCKET__ORG
|
425
|
-
endif
|
426
438
|
build: _create-log-directory check-local-changes
|
427
439
|
@$(call echo,Preparing build context from ${cyan}${git_branch}${reset} (${cyan}${git_version}${reset})${reset})
|
428
440
|
@$(call system,git archive --format "tar" -o "${context}" "${git_branch}")
|
@@ -23,7 +23,7 @@ RUN bundle config set deployment 'true' \
|
|
23
23
|
&& bundle config set without 'development test' \
|
24
24
|
&& bundle install
|
25
25
|
ADD .build/context.tar .
|
26
|
-
<% if defined?(Webpacker) %>RUN . /root/.bashrc ; NODE_ENV=production RAILS_ENV=production yarn install && NODE_ENV=production RAILS_ENV=production SECRET_KEY_BASE=
|
26
|
+
<% if defined?(Webpacker) %>RUN . /root/.bashrc ; NODE_ENV=production RAILS_ENV=production yarn install && NODE_ENV=production RAILS_ENV=production SECRET_KEY_BASE=placeholder-secret bundle exec rake assets:precompile<% elsif Rake::Task.tasks.map(&:name).include?('assets:precompile') %>RUN NODE_ENV=production RAILS_ENV=production SECRET_KEY_BASE=placeholder-secret bundle exec rake assets:precompile<% end %>
|
27
27
|
RUN echo "${GIT_COMMIT}" > /app/GIT_COMMIT
|
28
28
|
HEALTHCHECK --interval=<%= healthcheck['interval'] %> \
|
29
29
|
--timeout=<%= healthcheck['timeout'] %> \
|
@@ -30,11 +30,8 @@ post-setup:
|
|
30
30
|
# Launch all dependencies needed for a development environment and set up the
|
31
31
|
# development database.
|
32
32
|
#
|
33
|
-
.PHONY:
|
33
|
+
.PHONY: develop
|
34
34
|
develop:
|
35
35
|
bundle install
|
36
|
-
@$(MAKE)
|
37
|
-
@$(MAKE)
|
38
|
-
bundle exec rake db:create
|
39
|
-
bundle exec rake db:migrate
|
40
|
-
bundle exec rake db:seed
|
36
|
+
@$(MAKE) setup env=test
|
37
|
+
@$(MAKE) setup env=development
|
@@ -3,9 +3,13 @@
|
|
3
3
|
module Orchestration
|
4
4
|
COLOR_MAP = {
|
5
5
|
failure: %i[red bright],
|
6
|
+
success: %i[green],
|
7
|
+
info: %i[blue],
|
6
8
|
error: %i[red],
|
7
9
|
ready: %i[green],
|
8
10
|
create: %i[green],
|
11
|
+
delete: %i[red],
|
12
|
+
rename: %i[blue],
|
9
13
|
update: %i[yellow],
|
10
14
|
backup: %i[blue],
|
11
15
|
status: %i[blue],
|
data/lib/orchestration.rb
CHANGED
@@ -19,13 +19,103 @@ namespace :orchestration do
|
|
19
19
|
puts "#{config['docker']['organization']} #{config['docker']['repository']}"
|
20
20
|
end
|
21
21
|
|
22
|
+
desc I18n.t('orchestration.rake.upgrade')
|
23
|
+
task :upgrade do
|
24
|
+
terminal = Orchestration::Terminal.new(Orchestration::Environment.new.settings)
|
25
|
+
%w[
|
26
|
+
orchestration/docker-compose.yml
|
27
|
+
orchestration/docker-compose.override.yml
|
28
|
+
orchestration/Makefile
|
29
|
+
orchestration/deploy.mk
|
30
|
+
orchestration/yaml.bash
|
31
|
+
orchestration/healthcheck.rb
|
32
|
+
].each.map { |path| Pathname.new(path) }.each do |path|
|
33
|
+
next unless path.exist?
|
34
|
+
|
35
|
+
terminal.write(:delete, path)
|
36
|
+
path.unlink
|
37
|
+
end
|
38
|
+
|
39
|
+
src = 'orchestration/docker-compose.production.yml'
|
40
|
+
dest = 'orchestration/docker-compose.deployment.yml'
|
41
|
+
if File.exist?(src)
|
42
|
+
terminal.write(:rename, "#{src} => #{dest}")
|
43
|
+
File.rename(src, dest)
|
44
|
+
end
|
45
|
+
|
46
|
+
makefile = File.read('Makefile')
|
47
|
+
makefile.gsub!(
|
48
|
+
%r{^include orchestration/Makefile$},
|
49
|
+
%[include $(shell bundle exec ruby -e 'require "orchestration/make"')]
|
50
|
+
)
|
51
|
+
makefile.gsub!(/^test: test-setup$/, 'test:')
|
52
|
+
lines = makefile.lines(chomp: true)
|
53
|
+
post_setup_start = lines.index('ifndef light')
|
54
|
+
if post_setup_start.nil?
|
55
|
+
updated_makefile = lines.join("\n")
|
56
|
+
post_setup = []
|
57
|
+
else
|
58
|
+
post_setup_end = post_setup_start + lines[post_setup_start..].index('endif')
|
59
|
+
post_setup = lines[(post_setup_start + 1)...post_setup_end]
|
60
|
+
updated_makefile = lines.each.with_index.reject do |_line, index|
|
61
|
+
(post_setup_start..post_setup_end).cover?(index)
|
62
|
+
end.map(&:first).join("\n")
|
63
|
+
end
|
64
|
+
if makefile.match(/^post-setup:$/).nil?
|
65
|
+
updated_makefile += %(
|
66
|
+
|
67
|
+
.PHONY: post-setup
|
68
|
+
post-setup:
|
69
|
+
@# Setup tasks that are not already provided by Orchestration go here.
|
70
|
+
#{post_setup.join("\n")}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
if updated_makefile != makefile
|
74
|
+
terminal.write(:update, 'Makefile')
|
75
|
+
File.write('Makefile', updated_makefile)
|
76
|
+
end
|
77
|
+
|
78
|
+
%w[orchestration/docker-compose.test.yml orchestration/docker-compose.development.yml].each do |path|
|
79
|
+
terminal.write(:update, path)
|
80
|
+
config = YAML.safe_load(File.read(path))
|
81
|
+
config['networks'] ||= {}
|
82
|
+
config['networks']['local'] = { 'name' => '${COMPOSE_PROJECT_NAME}' }
|
83
|
+
config['services'] ||= {}
|
84
|
+
config['services'].each do |name, service|
|
85
|
+
service['networks'] = { 'local' => { 'aliases' => [name] } }
|
86
|
+
end
|
87
|
+
File.write(path, config.to_yaml)
|
88
|
+
end
|
89
|
+
|
90
|
+
dockerfile_path = 'orchestration/Dockerfile'
|
91
|
+
dockerfile = File.read(dockerfile_path)
|
92
|
+
updated_dockerfile = dockerfile.dup
|
93
|
+
updated_dockerfile.gsub!(
|
94
|
+
'CMD ["ruby","/app/orchestration/healthcheck.rb"]',
|
95
|
+
'CMD ["bundle","exec","rake","orchestration:healthcheck"]'
|
96
|
+
)
|
97
|
+
if updated_dockerfile != dockerfile
|
98
|
+
terminal.write(:update, dockerfile_path)
|
99
|
+
File.write(dockerfile_path, updated_dockerfile)
|
100
|
+
end
|
101
|
+
|
102
|
+
terminal.write(:success, 'Upgrade complete.')
|
103
|
+
terminal.write(:info, '`make test` will now only run tests, skipping setup.')
|
104
|
+
terminal.write(:info, 'Run `make setup test` to load test containers, run migrations, etc.')
|
105
|
+
terminal.write(:info, 'Run `make setup` to load development environment.')
|
106
|
+
terminal.write(:info, 'Run `make setup RAILS_ENV=test` to load test environment without running tests.')
|
107
|
+
terminal.write(:info, 'Edit the `post-setup` recipe in `Makefile` to perform custom setup actions.')
|
108
|
+
end
|
109
|
+
|
22
110
|
namespace :db do
|
23
111
|
desc I18n.t('orchestration.rake.db.url')
|
24
112
|
task :url do
|
25
|
-
config = Rails.application.config_for(:database)
|
113
|
+
config = Rails.application.config_for(:database).transform_keys(&:to_sym)
|
26
114
|
|
27
115
|
if config[:adapter] == 'sqlite3'
|
28
116
|
puts "sqlite3:#{config[:database]}"
|
117
|
+
elsif !config[:url].nil?
|
118
|
+
puts config[:url]
|
29
119
|
else
|
30
120
|
puts DatabaseUrl.to_active_record_url(config)
|
31
121
|
end
|
@@ -39,6 +129,12 @@ namespace :orchestration do
|
|
39
129
|
end
|
40
130
|
end
|
41
131
|
|
132
|
+
desc I18n.t('orchestration.rake.compose_services')
|
133
|
+
task :compose_services do
|
134
|
+
config = Orchestration::DockerCompose::ComposeConfiguration.new(Orchestration::Environment.new)
|
135
|
+
puts config.services.keys.join(' ') unless config.services.nil? || config.services.empty?
|
136
|
+
end
|
137
|
+
|
42
138
|
desc I18n.t('orchestration.rake.healthcheck')
|
43
139
|
task :healthcheck do
|
44
140
|
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 = '
|
25
|
+
spec.required_ruby_version = '>= 2.6'
|
25
26
|
spec.bindir = 'bin'
|
26
27
|
spec.executables = []
|
27
28
|
spec.require_paths = ['lib']
|
@@ -30,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
30
31
|
spec.add_runtime_dependency 'erubis', '~> 2.7'
|
31
32
|
spec.add_runtime_dependency 'i18n', '>= 0.5'
|
32
33
|
spec.add_runtime_dependency 'paint', '~> 2.0'
|
33
|
-
spec.add_runtime_dependency 'rails', '
|
34
|
+
spec.add_runtime_dependency 'rails', '>= 4.1'
|
34
35
|
spec.add_runtime_dependency 'thor', '~> 1.0'
|
35
36
|
|
36
37
|
spec.add_development_dependency 'activerecord', '~> 6.0'
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4.1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: thor
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -414,14 +414,15 @@ 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:
|
421
422
|
- lib
|
422
423
|
required_ruby_version: !ruby/object:Gem::Requirement
|
423
424
|
requirements:
|
424
|
-
- - "
|
425
|
+
- - ">="
|
425
426
|
- !ruby/object:Gem::Version
|
426
427
|
version: '2.6'
|
427
428
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -430,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
430
431
|
- !ruby/object:Gem::Version
|
431
432
|
version: '0'
|
432
433
|
requirements: []
|
433
|
-
rubygems_version: 3.0.3
|
434
|
+
rubygems_version: 3.0.3.1
|
434
435
|
signing_key:
|
435
436
|
specification_version: 4
|
436
437
|
summary: Docker orchestration toolkit
|