orchestration 0.6.16 → 0.7.0

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: 9495b1f5ce01552fda9a9fb5db75ad58cc9870c06a010093b0de05d8c572f1ab
4
- data.tar.gz: 2e0be60722c04f7a75c622f2be88a08152253247f61179f740e9722dbce64f8f
3
+ metadata.gz: 7891efd1c4930036b2245fad46bc9bc78c0de97b3c2cce26ede48d5a6de34a2c
4
+ data.tar.gz: c56d7d3193fd6cafe76dc823924bcc1ba74fda288090d1424bfdce148789cb51
5
5
  SHA512:
6
- metadata.gz: 15a39a36a88488f993306387b31a229c74ab30f66360143bc17bcbe3f075073fbd301887530b976a36f9a9b8970e44b250ff1b7c3d82f64f62ed71d2633ba231
7
- data.tar.gz: 961da484694bc593a1ffac5e78e9fb1b1f7df74071b043821806d07bde6519c057f1835dcc1824cf0bb3921eb412f006c66af5478441ffb2b67b48e3f28138a7
6
+ metadata.gz: c82db0ac9646d8b93ad2ef72cff3216106e8558f670c086cd0647f5496559f0a0c32309b8e2680323e627345a9f6da9f2745d4d67a5a1d8d1e7a56d2fc91417c
7
+ data.tar.gz: c0fc26b8ea7f66f7a50b52de3991fe5f4a99ec73b9186312e397fce229c184f8bdf8182d8bca991a79cb5b95f24ed3ce1907048bf27dceff482437129ce18ad4
data/.gitignore CHANGED
@@ -9,6 +9,8 @@
9
9
  # rspec failure tracking
10
10
  .rspec_status
11
11
 
12
+ Gemfile.lock
13
+
12
14
  *.swp
13
15
  *.swo
14
16
 
@@ -32,3 +34,5 @@ docker/.build/
32
34
  docker/.context.tar
33
35
 
34
36
  .DS_Store
37
+
38
+ .ruby-version
data/.strong_versions.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  ignore:
2
2
  - i18n
3
3
  - rails
4
+ - activerecord
data/README.md CHANGED
@@ -26,10 +26,18 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
26
26
 
27
27
  ### Install
28
28
 
29
- Add _Orchestration_ to your Gemfile:
29
+ Add _Orchestration_ to your `Gemfile`:
30
+
31
+ _Ruby 3.x_:
32
+
33
+ ```ruby
34
+ gem 'orchestration', '~> 0.7.0'
35
+ ```
36
+
37
+ _Ruby 2.x_:
30
38
 
31
39
  ```ruby
32
- gem 'orchestration', '~> 0.6.12'
40
+ gem 'orchestration', '~> 0.6.6'
33
41
  ```
34
42
 
35
43
  Install:
@@ -52,12 +60,6 @@ To rebuild all build-out at any time, pass `force=yes` to the above install comm
52
60
 
53
61
  You will be prompted to enter values for your _Docker_ organisation and repository name. For example, the _organisation_ and _repository_ for https://hub.docker.com/r/rubyorchestration/sampleapp are `rubyorchestration` and `sampleapp` respectively. If you are unsure of these values, they can be modified later by editing `.orchestration.yml` in the root of your project directory.
54
62
 
55
- Override these values from the command line by passing `project` and `organization` variables:
56
-
57
- ```bash
58
- rake orchestration:install project=myapp organization=myorg
59
- ```
60
-
61
63
  #### Configuration files
62
64
 
63
65
  _Orchestration_ generates the following files where appropriate. Backups are created if a file is replaced.
@@ -163,15 +165,30 @@ make push
163
165
 
164
166
  ### Development
165
167
 
166
- A [`.env` file](https://docs.docker.com/compose/env-file/) is created automatically in your project root. This file is _not_ stored in version control. Set all application environment variables in this file.
168
+ An [`.env` file](https://docs.docker.com/compose/env-file/) is created automatically in your project root. This file is _not_ stored in version control. Set all application environment variables in this file.
167
169
 
168
170
  #### Launching a development server
169
171
 
170
- Use vanilla _Rails_ commands to load a server or console. If present, a `.env` file will be read and loaded (via the [dotenv](https://github.com/bkeepers/dotenv) gem) to populate the environment.
172
+ To load all variables from `.env` and launch a development server, run the following command:
171
173
 
172
174
  ```bash
173
- bundle exec rails s # Launch a server
174
- bundle exec rails c # Launch a console
175
+ make serve
176
+ ```
177
+
178
+ To load a _Rails_ console:
179
+ ```bash
180
+ make console
181
+ ```
182
+
183
+ The application environment will be output on launch for convenience.
184
+
185
+ To pass extra commands to the _Rails_ server:
186
+ ```bash
187
+ # Custom server, custom port
188
+ make serve server='webrick -p 3001'
189
+
190
+ # Default server, custom port, custom bind address
191
+ make serve server='-p 3001 -b 192.168.0.1'
175
192
  ```
176
193
 
177
194
  ### Testing
@@ -29,7 +29,7 @@ module Orchestration
29
29
 
30
30
  def healthcheck
31
31
  {
32
- 'test' => ['/app/orchestration/healthcheck'],
32
+ 'test' => ['bundle', 'exec', 'rake', 'orchestration:healthcheck'],
33
33
  # Defaults according to
34
34
  # https://docs.docker.com/engine/reference/builder/#healthcheck
35
35
  # Except start_period which cannot be set to 0s
@@ -54,7 +54,7 @@ module Orchestration
54
54
  raise ArgumentError,
55
55
  I18n.t(
56
56
  'orchestration.rake.app.unspported_web_server',
57
- server: server,
57
+ server:,
58
58
  expected: %w[puma unicorn]
59
59
  )
60
60
  end
@@ -77,7 +77,7 @@ module Orchestration
77
77
  # '{sidecar-27018:}27017' => '27018:27017'
78
78
  local, _, remote = mapping.sub(/\${sidecar-(\d+):}/, '\1:')
79
79
  .partition(':')
80
- { local: local, remote: remote }
80
+ { local:, remote: }
81
81
  end
82
82
  end
83
83
  end
@@ -9,7 +9,7 @@ module Orchestration
9
9
  def environment
10
10
  return @environment unless @environment.nil?
11
11
 
12
- ENV.fetch('RAILS_ENV') { ENV.fetch('RACK_ENV', 'development') }
12
+ ENV.fetch('RAILS_ENV', nil) || ENV.fetch('RACK_ENV', nil) || 'development'
13
13
  end
14
14
 
15
15
  def web_server
@@ -20,9 +20,9 @@ module Orchestration
20
20
  def database_url
21
21
  case environment
22
22
  when 'development'
23
- ENV.fetch('DEVELOPMENT_DATABASE_URL') { ENV.fetch('DATABASE_URL', nil) }
23
+ ENV.fetch('DEVELOPMENT_DATABASE_URL', nil) || ENV.fetch('DATABASE_URL', nil)
24
24
  when 'test'
25
- ENV.fetch('TEST_DATABASE_URL') { ENV.fetch('DATABASE_URL', nil) }
25
+ ENV.fetch('TEST_DATABASE_URL', nil) || ENV.fetch('DATABASE_URL', nil)
26
26
  else
27
27
  ENV.fetch('DATABASE_URL', nil)
28
28
  end
@@ -6,7 +6,7 @@ module Orchestration
6
6
 
7
7
  def orchestration_dir
8
8
  path = @env.orchestration_root
9
- FileUtils.mkdir_p(path)
9
+ FileUtils.mkdir(path) unless Dir.exist?(path)
10
10
 
11
11
  path
12
12
  end
@@ -95,9 +95,9 @@ module Orchestration
95
95
  end
96
96
 
97
97
  def ensure_line_in_file(path, line, echo: true, regex: nil)
98
- return if line_in_file?(path, line: line, regex: regex)
98
+ return if line_in_file?(path, line:, regex:)
99
99
 
100
- append_file(path, "\n#{line.chomp}\n", echo: echo)
100
+ append_file(path, "\n#{line.chomp}\n", echo:)
101
101
  true
102
102
  end
103
103
 
@@ -131,7 +131,7 @@ module Orchestration
131
131
 
132
132
  def force?
133
133
  # Rake task was invoked with `force=yes`
134
- ENV['force'] == 'yes'
134
+ ENV.fetch('force', nil) == 'yes'
135
135
  end
136
136
  end
137
137
  end
@@ -17,10 +17,10 @@ module Orchestration
17
17
  end
18
18
 
19
19
  def orchestration_configuration
20
- return unless build?('.orchestration.yml')
21
-
22
- configure_orchestration_settings
23
- relpath = relative_path(@env.orchestration_configuration_path)
20
+ path = @env.orchestration_configuration_path
21
+ @terminal.ask_setting('docker.organization')
22
+ @terminal.ask_setting('docker.repository', @env.default_app_name)
23
+ relpath = relative_path(path)
24
24
  return @terminal.write(:create, relpath) unless @settings.exist? || force?
25
25
  return @terminal.write(:update, relpath) if @settings.dirty?
26
26
 
@@ -28,15 +28,11 @@ module Orchestration
28
28
  end
29
29
 
30
30
  def application_makefile
31
- return unless build?('Makefile')
32
-
33
31
  path = @env.root.join('Makefile')
34
32
  simple_copy('application.mk', path) unless File.exist?(path)
35
33
  end
36
34
 
37
35
  def dockerfile
38
- return unless build?('Dockerfile')
39
-
40
36
  create_file(
41
37
  orchestration_dir.join('Dockerfile'),
42
38
  dockerfile_content,
@@ -45,8 +41,6 @@ module Orchestration
45
41
  end
46
42
 
47
43
  def entrypoint_sh
48
- return unless build?('entrypoint.sh')
49
-
50
44
  content = template('entrypoint.sh')
51
45
  path = orchestration_dir.join('entrypoint.sh')
52
46
  create_file(path, content, overwrite: false)
@@ -54,15 +48,12 @@ module Orchestration
54
48
  end
55
49
 
56
50
  def docker_compose
57
- return unless build?('docker-compose.yml')
58
-
59
51
  @docker_compose.docker_compose_test_yml
60
52
  @docker_compose.docker_compose_development_yml
61
53
  @docker_compose.docker_compose_deployment_yml
62
54
  end
63
55
 
64
56
  def puma
65
- return unless build?('puma.rb')
66
57
  return nil unless @env.web_server == 'puma'
67
58
 
68
59
  content = template('puma.rb')
@@ -71,18 +62,16 @@ module Orchestration
71
62
  end
72
63
 
73
64
  def unicorn
74
- return unless build?('unicorn.rb')
75
65
  return nil unless @env.web_server == 'unicorn'
76
66
 
77
67
  content = template('unicorn.rb')
78
68
  path = @env.root.join('config', 'unicorn.rb')
79
69
  create_file(path, content, backup: true)
80
70
  regex = /gem\s+['"]unicorn['"]/
81
- ensure_line_in_file(gemfile_path, "gem 'unicorn'", regex: regex)
71
+ ensure_line_in_file(gemfile_path, "gem 'unicorn'", regex:)
82
72
  end
83
73
 
84
74
  def database_yml
85
- return unless build?('database.yml')
86
75
  return unless defined?(ActiveRecord)
87
76
 
88
77
  adapter = DockerCompose::ComposeConfiguration.database_adapter_name
@@ -92,28 +81,22 @@ module Orchestration
92
81
  end
93
82
 
94
83
  def mongoid_yml
95
- return unless build?('mongoid.yml')
96
84
  return unless defined?(Mongoid)
97
85
 
98
86
  service_config('mongoid.yml', Services::Mongo::Configuration)
99
87
  end
100
88
 
101
89
  def rabbitmq_yml
102
- return unless build?('rabbitmq.yml')
103
90
  return unless defined?(Bunny)
104
91
 
105
92
  service_config('rabbitmq.yml', Services::RabbitMQ::Configuration)
106
93
  end
107
94
 
108
95
  def env
109
- return unless build?('.env')
110
-
111
96
  simple_copy('env', @env.root.join('.env'), overwrite: false)
112
97
  end
113
98
 
114
99
  def gitignore
115
- return unless build?('.gitignore')
116
-
117
100
  path = @env.root.join('.gitignore')
118
101
  globs = %w[.build/ .deploy/ Gemfile Gemfile.lock docker-compose.local.yml]
119
102
  lines = %w[orchestration/.sidecar .env deploy.tar] + globs.map do |line|
@@ -125,13 +108,6 @@ module Orchestration
125
108
 
126
109
  private
127
110
 
128
- def build?(filename)
129
- return true unless ENV.key?('build')
130
- return true if ENV.fetch('build') == filename
131
-
132
- false
133
- end
134
-
135
111
  def t(key)
136
112
  I18n.t("orchestration.#{key}")
137
113
  end
@@ -173,19 +149,6 @@ module Orchestration
173
149
  healthcheck: DockerCompose::AppService.healthcheck
174
150
  )
175
151
  end
176
-
177
- def configure_orchestration_settings
178
- @terminal.ask_setting(
179
- 'docker.organization',
180
- override: ENV.fetch('organization', nil)
181
- )
182
-
183
- @terminal.ask_setting(
184
- 'docker.repository',
185
- default: @env.default_app_name,
186
- override: ENV.fetch('project', nil)
187
- )
188
- end
189
152
  end
190
153
  # rubocop:enable Metrics/ClassLength
191
154
  end
@@ -2,8 +2,7 @@
2
2
  ### Environment setup ###
3
3
  SHELL:=/bin/bash
4
4
  MAKE:=mkpath=${mkpath} make --no-print-directory
5
- ORCHESTRATION_DISABLE_ENV=1
6
- export
5
+
7
6
  TERM ?= 'dumb'
8
7
  pwd:=$(shell pwd)
9
8
 
@@ -53,14 +52,14 @@ println=$(call print,$1'\n')
53
52
  printraw=printf $1
54
53
  stdout=${pwd}/log/orchestration.stdout.log
55
54
  stderr=${pwd}/log/orchestration.stderr.log
56
- log_path_length:=$(shell echo "${stdout}" | wc -c)
55
+ log_path_length=$(shell echo "${stdout}" | wc -c)
57
56
  ifndef verbose
58
57
  log_tee:= 2>&1 | tee -a ${stdout}
59
58
  log:= >>${stdout} 2>>${stderr}
60
59
  progress_point:=perl -e 'printf("[${magenta}busy${reset}] "); while( my $$line = <STDIN> ) { printf("."); select()->flush(); }'
61
60
  log_progress:= > >(tee -ai ${stdout} >&1 | ${progress_point}) 2> >(tee -ai ${stderr} 2>&1 | ${progress_point})
62
61
  endif
63
- hr:=$(call println,"$1$(shell head -c ${log_path_length} < /dev/zero | tr '\0' '=')${reset}")
62
+ hr=$(call println,"$1$(shell head -c ${log_path_length} < /dev/zero | tr '\0' '=')${reset}")
64
63
  managed_env_tag:=\# -|- ORCHESTRATION
65
64
  standard_env_path:=${pwd}/.env
66
65
  backup_env_path:=${pwd}/.env.orchestration.backup
@@ -108,9 +107,7 @@ endif
108
107
  ifneq (${env},test)
109
108
  ifeq (,$(findstring test,$(MAKECMDGOALS)))
110
109
  ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
111
- ifeq (,$(findstring setup,$(MAKECMDGOALS)))
112
- -include ${env_path}
113
- endif
110
+ -include ${env_path}
114
111
  endif
115
112
  endif
116
113
  endif
@@ -125,9 +122,7 @@ ifneq (,$(findstring test,$(MAKECMDGOALS)))
125
122
  env=test
126
123
  endif
127
124
 
128
- ifneq (,$(RAILS_ENV))
129
- env=$(RAILS_ENV)
130
- else ifneq (,$(env))
125
+ ifneq (,$(env))
131
126
  # `env` set by current shell.
132
127
  else ifneq (,$(RAILS_ENV))
133
128
  env=$(RAILS_ENV)
@@ -143,7 +138,7 @@ DOCKER_TAG ?= latest
143
138
  ifneq (,$(wildcard ./Gemfile))
144
139
  bundle_cmd = bundle exec
145
140
  endif
146
- rake=ORCHESTRATION_DISABLE_ENV=1 DEVPACK_DISABLE=1 RACK_ENV=${env} SECRET_KEY_BASE='placeholder-secret' 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
147
142
 
148
143
  ifneq (,$(wildcard ${env_file}))
149
144
  ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
@@ -182,39 +177,32 @@ ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
182
177
  ifeq (,${sidecar_suffix})
183
178
  $(warning Unable to generate project suffix; project name collisions may occur.)
184
179
  endif
185
- compose_project_name_base = ${project_base}_${sidecar_suffix}
180
+ compose_project_name = ${project_base}_${sidecar_suffix}
186
181
  else
187
- compose_project_name_base = ${project_base}
182
+ compose_project_name = ${project_base}
188
183
  endif
189
184
  else
190
- compose_project_name_base = ${project_base}
185
+ compose_project_name = ${project_base}
191
186
  endif
192
187
 
193
- ifdef COMPOSE_PROJECT_NAME_SUFFIX
194
- compose_project_name = ${compose_project_name_base}_${COMPOSE_PROJECT_NAME_SUFFIX}
195
- else
196
- compose_project_name = ${compose_project_name_base}
197
- endif
198
-
199
- compose_base:=env -i \
200
- PATH="$(PATH)" \
188
+ compose_base=env -i \
189
+ PATH=$(PATH) \
201
190
  HOST_UID=$(shell id -u) \
202
191
  DOCKER_ORGANIZATION="${docker_organization}" \
203
192
  DOCKER_REPOSITORY="${docker_repository}" \
204
193
  COMPOSE_PROJECT_NAME="${compose_project_name}" \
205
- COMPOSE_PROJECT_NAME_SUFFIX="${COMPOSE_PROJECT_NAME_SUFFIX}" \
206
194
  ${sidecar_compose} \
207
195
  docker-compose \
208
196
  -f ${orchestration_dir}/docker-compose.${env}.yml
209
197
 
210
- git_branch := $(if $(branch),$(branch),$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no-branch))
198
+ git_branch ?= $(if $(branch),$(branch),$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no-branch))
211
199
  ifndef dev
212
- git_version := $(shell git rev-parse --short --verify ${git_branch} 2>/dev/null || echo no-version)
200
+ git_version ?= $(shell git rev-parse --short --verify ${git_branch} 2>/dev/null || echo no-version)
213
201
  else
214
- git_version := dev
202
+ git_version = dev
215
203
  endif
216
204
 
217
- docker_image:=${docker_organization}/${docker_repository}:${git_version}
205
+ docker_image=${docker_organization}/${docker_repository}:${git_version}
218
206
 
219
207
  compose=${compose_base}
220
208
  compose_human=docker-compose -f ${orchestration_dir_name}/docker-compose.${env}.yml
@@ -228,16 +216,11 @@ all: build
228
216
 
229
217
  ### Container management commands ###
230
218
 
231
- .PHONY: pull
232
- pull:
233
- @$(call system,${compose_human} pull)
234
- @${compose} pull
235
-
236
219
  .PHONY: start
237
220
  ifndef network
238
221
  start: network := ${compose_project_name}
239
222
  endif
240
- start: _create-log-directory _clean-logs pull
223
+ start: _create-log-directory _clean-logs
241
224
  ifneq (,${compose_services})
242
225
  @$(call system,${compose_human} up --detach)
243
226
  ifeq (${env},$(filter ${env},test development))
@@ -322,7 +305,7 @@ db-console:
322
305
 
323
306
  .PHONY: setup
324
307
  ifneq (,$(wildcard config/database.yml))
325
- setup: url := $(shell ${rake} orchestration:db:url RAILS_ENV=${env} 2>/dev/null)
308
+ setup: url = $(shell ${rake} orchestration:db:url RAILS_ENV=${env} 2>/dev/null)
326
309
  endif
327
310
  setup: _log-notify
328
311
  @$(call echo,Setting up ${env_human} environment)
@@ -330,16 +313,16 @@ setup: _log-notify
330
313
  ifneq (,$(wildcard config/database.yml))
331
314
  @$(call echo,Preparing ${env_human} database)
332
315
  @$(call system,rake db:create RAILS_ENV="${env}")
333
- @${rake} db:create RAILS_ENV=${env} DATABASE_URL='${url}' ${log} || : ${log}
316
+ @${rake} db:create RAILS_ENV=${env} ${log} || : ${log}
334
317
  ifneq (,$(wildcard db/structure.sql))
335
- @$(call system,rake db:structure:load RAILS_ENV="${env}" ${url_prefix}DATABASE_URL="${url}")
318
+ @$(call system,rake db:structure:load RAILS_ENV="${env}" DATABASE_URL="${url}")
336
319
  @${rake} db:structure:load RAILS_ENV="${env}" DATABASE_URL='${url}' ${log} || ${exit_fail}
337
320
  else ifneq (,$(wildcard db/schema.rb))
338
- @$(call system,rake db:schema:load RAILS_ENV="${env}" ${url_prefix}DATABASE_URL="${url}")
321
+ @$(call system,rake db:schema:load RAILS_ENV="${env}" DATABASE_URL="${url}")
339
322
  @${rake} db:schema:load RAILS_ENV="${env}" DATABASE_URL='${url}' ${log} || ${exit_fail}
340
323
  endif
341
- @$(call system,rake db:migrate RAILS_ENV="${env}" ${url_prefix}DATABASE_URL="${url}")
342
- @${rake} db:migrate RAILS_ENV="${env}" DATABASE_URL='${url}' ${log} || ${exit_fail}
324
+ @$(call system,rake db:migrate RAILS_ENV="${env}" DATABASE_URL="${url}")
325
+ @${rake} db:migrate RAILS_ENV=${env} ${log} || ${exit_fail}
343
326
  endif
344
327
  @if $(MAKE) -n post-setup >/dev/null 2>&1; then \
345
328
  $(call system,make post-setup RAILS_ENV="${env}") \
@@ -393,13 +376,14 @@ tag:
393
376
  .PHONY: deploy
394
377
  deploy: _log-notify _clean-logs
395
378
  ifdef env_file
396
- deploy: env_file_option = . ${env_file}
379
+ deploy: env_file_option = --env-file ${env_file}
397
380
  endif
398
381
  deploy: RAILS_ENV := ${env}
399
382
  deploy: RACK_ENV := ${env}
400
383
  deploy: DOCKER_TAG = ${git_version}
401
384
  deploy: base_vars = DOCKER_ORGANIZATION=${docker_organization} DOCKER_REPOSITORY=${docker_repository} DOCKER_TAG=${git_version}
402
- deploy: config_cmd := ( set -a ; ${env_file_option} ; ${base_vars} COMPOSE_PROJECT_NAME=${project_base} HOST_UID=$(shell id -u) docker stack config --compose-file orchestration/docker-compose.deployment.yml )
385
+ deploy: compose_deploy := ${base_vars} COMPOSE_PROJECT_NAME=${project_base} HOST_UID=$(shell id -u) docker-compose ${env_file_option} --project-name ${project_base} -f orchestration/docker-compose.deployment.yml
386
+ deploy: config_cmd = ${compose_deploy} config
403
387
  deploy: remote_cmd = cat | docker stack deploy --prune --with-registry-auth -c - ${project_base}
404
388
  deploy: ssh_cmd = ssh "${manager}"
405
389
  deploy: deploy_cmd := ${config_cmd} | ${ssh_cmd} "/bin/bash -lc '${remote_cmd}'"
@@ -455,8 +439,6 @@ build: _create-log-directory check-local-changes
455
439
  @$(call echo,Preparing build context from ${cyan}${git_branch}${reset} (${cyan}${git_version}${reset})${reset})
456
440
  @$(call system,git archive --format "tar" -o "${context}" "${git_branch}")
457
441
  @mkdir -p ${orchestration_dir}/.build ${log} || ${exit_fail}
458
- @cp '$(shell bundle info --path orchestration)/lib/orchestration/healthcheck.bash' '${orchestration_dir}/healthcheck'
459
- @chmod +x '${orchestration_dir}/healthcheck'
460
442
  ifndef dev
461
443
  @git show ${git_branch}:./Gemfile > ${orchestration_dir}/.build/Gemfile 2>${stderr} || ${exit_fail}
462
444
  @git show ${git_branch}:./Gemfile.lock > ${orchestration_dir}/.build/Gemfile.lock 2>${stderr} || ${exit_fail}
@@ -464,8 +446,6 @@ ifndef dev
464
446
  else
465
447
  @tar -cvf '${context}' . ${log} || ${exit_fail}
466
448
  endif
467
- @tar --append --file '${context}' '${orchestration_dir}/healthcheck'
468
- @rm '${orchestration_dir}/healthcheck'
469
449
  ifdef include
470
450
  @$(call echo,Including files from: ${cyan}${include}${reset})
471
451
  @(while read line; do \
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ENV['ORCHESTRATION_DISABLE_ENV'] = '1'
4
-
5
3
  require 'orchestration'
6
4
  puts Orchestration.makefile
@@ -21,10 +21,10 @@ module Orchestration
21
21
  def settings(healthcheck: false)
22
22
  {
23
23
  adapter: adapter.name,
24
- host: host,
25
- port: port,
26
- username: username,
27
- password: password,
24
+ host:,
25
+ port:,
26
+ username:,
27
+ password:,
28
28
  database: healthcheck ? adapter.credentials['database'] : database
29
29
  }.transform_keys(&:to_s)
30
30
  end
@@ -64,7 +64,7 @@ module Orchestration
64
64
  return {} unless File.exist?(database_configuration_path) || custom?
65
65
 
66
66
  yaml = ERB.new(File.read(database_configuration_path)).result
67
- YAML.safe_load(yaml, [], [], true)[@env.environment] || {}
67
+ YAML.safe_load(yaml, aliases: true)[@env.environment] || {}
68
68
  end
69
69
 
70
70
  def url_config
@@ -74,7 +74,7 @@ module Orchestration
74
74
 
75
75
  def yaml(content)
76
76
  # Whitelist `Symbol` and permit aliases:
77
- YAML.safe_load(content, [Symbol], [], true)
77
+ YAML.safe_load(content, permitted_classes: [Symbol], aliases: true)
78
78
  end
79
79
  end
80
80
  end
@@ -19,7 +19,7 @@ module Orchestration
19
19
 
20
20
  def connection_error(code)
21
21
  raise HTTPConnectionError,
22
- I18n.t('orchestration.http.connection_error', code: code)
22
+ I18n.t('orchestration.http.connection_error', code:)
23
23
  end
24
24
 
25
25
  def connection_error?(code)
@@ -64,7 +64,7 @@ module Orchestration
64
64
  return {} unless File.exist?(@env.mongoid_configuration_path)
65
65
 
66
66
  yaml = File.read(@env.mongoid_configuration_path)
67
- config = YAML.safe_load(yaml, [], [], true)
67
+ config = YAML.safe_load(yaml, aliases: true)
68
68
  env = config.fetch(@env.environment, nil)
69
69
  return {} if env.nil?
70
70
 
@@ -2,22 +2,20 @@ FROM ruby:<%= ruby_version %>
2
2
  ARG BUNDLE_BITBUCKET__ORG
3
3
  ARG BUNDLE_GITHUB__COM
4
4
  ARG GIT_COMMIT
5
- ENV NODE_MAJOR=20
6
- RUN apt-get update \
5
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
6
+ && apt-get update \
7
7
  && DEBIAN_FRONTEND=noninteractive apt-get install -y \
8
+ nodejs \
8
9
  gosu \
9
10
  sendmail \
10
- ca-certificates \
11
- curl \
12
- gnupg \
13
- && mkdir -p /etc/apt/keyrings \
14
- && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
15
- && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
16
- && apt-get update \
17
- && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
18
11
  && rm -rf /var/lib/apt/lists/* \
19
12
  && gem install bundler \
20
13
  && mkdir /app<%if defined?(Webpacker) %> \
14
+ && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
15
+ && . /root/.bashrc \
16
+ && nvm install 14.16.0 \
17
+ && npm config set user 0 \
18
+ && npm config set unsafe-perm true \
21
19
  && npm install -g yarn<% end %>
22
20
  WORKDIR /app
23
21
  COPY .build/Gemfile .build/Gemfile.lock ./
@@ -25,7 +23,7 @@ RUN bundle config set deployment 'true' \
25
23
  && bundle config set without 'development test' \
26
24
  && bundle install
27
25
  ADD .build/context.tar .
28
- <% if defined?(Webpacker) %>RUN 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 %>
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 %>
29
27
  RUN echo "${GIT_COMMIT}" > /app/GIT_COMMIT
30
28
  HEALTHCHECK --interval=<%= healthcheck['interval'] %> \
31
29
  --timeout=<%= healthcheck['timeout'] %> \
@@ -12,4 +12,4 @@ test:
12
12
 
13
13
  production:
14
14
  url: <%%= ENV['RABBITMQ_URL'] %>
15
- management_url: <%%= ENV['RABBITMQ_MANAGEMENT_URL'] %>
15
+ url: <%%= ENV['RABBITMQ_MANAGEMENT_URL'] %>
@@ -39,19 +39,14 @@ module Orchestration
39
39
  result
40
40
  end
41
41
 
42
- def ask_setting(setting, default: nil, override: nil)
42
+ def ask_setting(setting, default = nil)
43
43
  return unless @settings.get(setting).nil?
44
- return @settings.set(setting, override) unless override.nil?
45
44
 
46
45
  write(:setup, t("settings.#{setting}.description"))
47
46
  prompt = t("settings.#{setting}.prompt")
48
47
  @settings.set(setting, read(prompt, default))
49
48
  end
50
49
 
51
- def print_variable(variable, value)
52
- $stderr.print "#{Paint[variable, :blue]}#{Paint['=', :white]}#{Paint[value, :cyan]}"
53
- end
54
-
55
50
  private
56
51
 
57
52
  def prompt(message, default)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.6.16'
4
+ VERSION = '0.7.0'
5
5
  end