orchestration 0.7.8 → 0.7.10

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: 5c7e9edb1bd0c867ecf0ec2e04843a9088da9094a58db4a5316d232f08852383
4
- data.tar.gz: de0f1c365a23e2d88ee01f108800801ee261765d756cff2d28bf548d0d3c9c06
3
+ metadata.gz: aea7091859513085daaa652226e9e6e2eaad838f8cea0fc5e4f92baabf231d66
4
+ data.tar.gz: 01f656a8e0a4c94679ea1cede73a276345dd097254c8feee73ecf4d71c6ae0f8
5
5
  SHA512:
6
- metadata.gz: dcd287e55fddb78b737ae52a8c5af3e632c34cb55391aa7ea14593f501c1935e66e9070064c83b251a408326b3f31099b9bcbc3c56f76123e5a3da6e47a4ef02
7
- data.tar.gz: cf2f763a19c10b0717c2918ebd996371e0b3445db287833b14d66cef07e4737f183692944d5f1b468436fb6775a786a64ad4866ab843e04f9f7009ee3ffb610f
6
+ metadata.gz: aac8c41311328ee9285d9d3172baed798ca89a17a9311c16bd2dfd75ff2ee9631b4f8b464c208d0e607cd9c488641e8cce33fc6988204d5812b4ac1abd428861
7
+ data.tar.gz: 6c5bd17caaa053100b721f78fe93620aa8579e55c141b35a477ce162ed1929bb10a2e073d2f4b8ca6e5ca3ffe110d862bab3bfdce1b33f332431fdd3d5fbef98
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orchestration (0.7.8)
4
+ orchestration (0.7.10)
5
5
  database_url (~> 0.1.2)
6
6
  dotenv-rails (~> 2.8)
7
7
  erubis (~> 2.7)
data/README.md CHANGED
@@ -31,13 +31,13 @@ Add _Orchestration_ to your `Gemfile`:
31
31
  _Ruby 3.x_:
32
32
 
33
33
  ```ruby
34
- gem 'orchestration', '~> 0.7.3'
34
+ gem 'orchestration', '~> 0.7.9'
35
35
  ```
36
36
 
37
37
  _Ruby 2.x_:
38
38
 
39
39
  ```ruby
40
- gem 'orchestration', '~> 0.6.7'
40
+ gem 'orchestration', '~> 0.6.12'
41
41
  ```
42
42
 
43
43
  Install:
@@ -60,6 +60,12 @@ To rebuild all build-out at any time, pass `force=yes` to the above install comm
60
60
 
61
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.
62
62
 
63
+ Override these values from the command line by passing `project` and `organization` variables:
64
+
65
+ ```bash
66
+ rake orchestration:install project=myapp organization=myorg
67
+ ```
68
+
63
69
  #### Configuration files
64
70
 
65
71
  _Orchestration_ generates the following files where appropriate. Backups are created if a file is replaced.
@@ -30,7 +30,7 @@ module Orchestration
30
30
 
31
31
  def healthcheck
32
32
  {
33
- 'test' => ['bundle', 'exec', 'rake', 'orchestration:healthcheck'],
33
+ 'test' => ['/app/orchestration/healthcheck'],
34
34
  # Defaults according to
35
35
  # https://docs.docker.com/engine/reference/builder/#healthcheck
36
36
  # Except start_period which cannot be set to 0s
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ url="${WEB_HEALTHCHECK_PROTOCOL:-http}://${WEB_HOST:-localhost}:${WEB_PORT:-8080}${WEB_HEALTHCHECK_PATH:-/healthcheck}"
4
+ curl_options="--max-time ${WEB_HEALTHCHECK_READ_TIMEOUT:-10} --connect-timeout ${WEB_HEALTHCHECK_OPEN_TIMEOUT:-10} --silent --output /dev/null --write-out %{http_code}"
5
+ status_code="$(curl ${curl_options} "${url}")"
6
+
7
+ echo "Status Code: ${status_code} (${url})"
8
+
9
+ if [[ "${WEB_HEALTHCHECK_SUCCESS_CODES:-200,201,202,204}" =~ (^|,)"${status_code}"(,|$) ]]
10
+ then
11
+ echo 'Healthcheck SUCCESS'
12
+ exit 0
13
+ else
14
+ echo 'Healthcheck FAILURE'
15
+ exit 1
16
+ fi
@@ -17,10 +17,8 @@ module Orchestration
17
17
  end
18
18
 
19
19
  def orchestration_configuration
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)
20
+ configure_orchestration_settings
21
+ relpath = relative_path(@env.orchestration_configuration_path)
24
22
  return @terminal.write(:create, relpath) unless @settings.exist? || force?
25
23
  return @terminal.write(:update, relpath) if @settings.dirty?
26
24
 
@@ -155,6 +153,19 @@ module Orchestration
155
153
  healthcheck: DockerCompose::AppService.healthcheck
156
154
  )
157
155
  end
156
+
157
+ def configure_orchestration_settings
158
+ @terminal.ask_setting(
159
+ 'docker.organization',
160
+ override: ENV.fetch('organization', nil)
161
+ )
162
+
163
+ @terminal.ask_setting(
164
+ 'docker.repository',
165
+ default: @env.default_app_name,
166
+ override: ENV.fetch('project', nil)
167
+ )
168
+ end
158
169
  end
159
170
  # rubocop:enable Metrics/ClassLength
160
171
  end
@@ -449,6 +449,8 @@ build: _create-log-directory check-local-changes
449
449
  @$(call echo,Preparing build context from ${cyan}${git_branch}${reset} (${cyan}${git_version}${reset})${reset})
450
450
  @$(call system,git archive --format "tar" -o "${context}" "${git_branch}")
451
451
  @mkdir -p ${orchestration_dir}/.build ${log} || ${exit_fail}
452
+ @cp '$(shell bundle info --path orchestration)/lib/orchestration/healthcheck.bash' '${orchestration_dir}/healthcheck'
453
+ @chmod +x '${orchestration_dir}/healthcheck'
452
454
  ifndef dev
453
455
  @git show ${git_branch}:./Gemfile > ${orchestration_dir}/.build/Gemfile 2>${stderr} || ${exit_fail}
454
456
  @git show ${git_branch}:./Gemfile.lock > ${orchestration_dir}/.build/Gemfile.lock 2>${stderr} || ${exit_fail}
@@ -456,6 +458,8 @@ ifndef dev
456
458
  else
457
459
  @tar -cvf '${context}' . ${log} || ${exit_fail}
458
460
  endif
461
+ @tar --append --file '${context}' '${orchestration_dir}/healthcheck'
462
+ @rm '${orchestration_dir}/healthcheck'
459
463
  ifdef include
460
464
  @$(call echo,Including files from: ${cyan}${include}${reset})
461
465
  @(while read line; do \
@@ -39,8 +39,9 @@ module Orchestration
39
39
  result
40
40
  end
41
41
 
42
- def ask_setting(setting, default = nil)
42
+ def ask_setting(setting, default: nil, override: nil)
43
43
  return unless @settings.get(setting).nil?
44
+ return @settings.set(setting, override) unless override.nil?
44
45
 
45
46
  write(:setup, t("settings.#{setting}.description"))
46
47
  prompt = t("settings.#{setting}.prompt")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.7.8'
4
+ VERSION = '0.7.10'
5
5
  end
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.7.8
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-05 00:00:00.000000000 Z
11
+ date: 2023-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: database_url
@@ -414,6 +414,7 @@ files:
414
414
  - lib/orchestration/environment.rb
415
415
  - lib/orchestration/errors.rb
416
416
  - lib/orchestration/file_helpers.rb
417
+ - lib/orchestration/healthcheck.bash
417
418
  - lib/orchestration/install_generator.rb
418
419
  - lib/orchestration/make.rb
419
420
  - lib/orchestration/make/orchestration.mk