orchestration 0.6.11 → 0.6.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60c52d91f6eb17469c4244093217f7c37bdf083bc9b045e175869788178a9196
4
- data.tar.gz: 2b70b8a444c78beb19ffbf9b2690349e942374c16ca36edecd714f33d798bae0
3
+ metadata.gz: 0eca537cffc7c1d04a9fee15b15d039e63f3ea64c29ca7384097ce5c3aeaedad
4
+ data.tar.gz: 00c16b6c7a3d5cf3fa4fdf160a3664ce294d8fd52b4fb875eac0780e5013a9cf
5
5
  SHA512:
6
- metadata.gz: 03efb92b5de3ef15940464ae6e5ba5739c98c4b18d312490f70a497ed0e2fdc2f8094cc482301fe0f81e6667a254fc481783a9f5e349e98a4f0b598d54827640
7
- data.tar.gz: bbc0087cd77db01f1a87f69222425a91ff2f5f8d204794795b4872d8f5157df208caa05343c5fed67bd1461633baa3aed344ebe2db52a82998932f32c215843a
6
+ metadata.gz: c1b0bd62ed5ce027fa5b3fd6e71891df96070c7b874fcdf90e86b9f4d13f3364105b05a456052dc8bed836ea96149ada3ee6b7ef875333b9af0ae22d8426404f
7
+ data.tar.gz: 16e33c0e81496d722b04c5f60d446aa8e506cb549f5f14c3d39d107eb74c03f79e95b76e8f9ed13f35188fcda58b465f6bfa7fd2fe355af0c0adde36bb4a8c22
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orchestration (0.6.11)
4
+ orchestration (0.6.13)
5
5
  database_url (~> 0.1.2)
6
6
  dotenv-rails (~> 2.8)
7
7
  erubis (~> 2.7)
data/README.md CHANGED
@@ -29,7 +29,7 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
29
29
  Add _Orchestration_ to your Gemfile:
30
30
 
31
31
  ```ruby
32
- gem 'orchestration', '~> 0.6.8'
32
+ gem 'orchestration', '~> 0.6.12'
33
33
  ```
34
34
 
35
35
  Install:
@@ -50,13 +50,14 @@ rake orchestration:install server=unicorn # (or 'puma' [default], etc.)
50
50
 
51
51
  To rebuild all build-out at any time, pass `force=yes` to the above install command.
52
52
 
53
- To rebuild just `orchestration/Makefile` (useful after upgrading the _Orchestration_ gem):
53
+ 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
+
55
+ Override these values from the command line by passing `project` and `organization` variables:
56
+
54
57
  ```bash
55
- rake orchestration:install:makefile
58
+ rake orchestration:install project=myapp organization=myorg
56
59
  ```
57
60
 
58
- 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.
59
-
60
61
  #### Configuration files
61
62
 
62
63
  _Orchestration_ generates the following files where appropriate. Backups are created if a file is replaced.
@@ -29,7 +29,7 @@ module Orchestration
29
29
 
30
30
  def healthcheck
31
31
  {
32
- 'test' => ['bundle', 'exec', 'rake', 'orchestration:healthcheck'],
32
+ 'test' => ['/app/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
@@ -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
 
@@ -149,6 +147,19 @@ module Orchestration
149
147
  healthcheck: DockerCompose::AppService.healthcheck
150
148
  )
151
149
  end
150
+
151
+ def configure_orchestration_settings
152
+ @terminal.ask_setting(
153
+ 'docker.organization',
154
+ override: ENV.fetch('organization', nil)
155
+ )
156
+
157
+ @terminal.ask_setting(
158
+ 'docker.repository',
159
+ default: @env.default_app_name,
160
+ override: ENV.fetch('project', nil)
161
+ )
162
+ end
152
163
  end
153
164
  # rubocop:enable Metrics/ClassLength
154
165
  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.6.11'
4
+ VERSION = '0.6.13'
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.6.11
4
+ version: 0.6.13
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
@@ -399,6 +399,7 @@ files:
399
399
  - lib/orchestration/environment.rb
400
400
  - lib/orchestration/errors.rb
401
401
  - lib/orchestration/file_helpers.rb
402
+ - lib/orchestration/healthcheck.bash
402
403
  - lib/orchestration/install_generator.rb
403
404
  - lib/orchestration/make.rb
404
405
  - lib/orchestration/make/orchestration.mk