orchestration 0.5.1 → 0.5.2

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: c3ef93d88b5d6c2c60bf1c558ec2f04c3563194bae32a5374b53b8a2dd53a73f
4
- data.tar.gz: 1488c9004ca7857e59e4dafd5f2276d4c0dd2ad70776ad57f6250dc633895e99
3
+ metadata.gz: a8525fb5a3f6bd07564ec80a6f2663f1ab3157f7e4ad7e3db411844e36ae42d1
4
+ data.tar.gz: 7828198b463b1e40a0f4b085efe848b742aa04dded4278df485706c358eed618
5
5
  SHA512:
6
- metadata.gz: 93470c6903f7aaa33b3e684712884733b9112080e7b94bd8461feff6c9fe15c9a647710be340fcd4071a143c9d4a31e2dd2c2bd47de31333b8e93bd121072818
7
- data.tar.gz: 024df80165322260d9a9df620eedc4b69fe9e4d844b35f5a21b5ce5a7658f380ac85fd37aec169ed2c50f59917dc89a18a75f661062b8cdb12833b29c5c6eb80
6
+ metadata.gz: 2ca10bebdc3fc34cda1491dfa694386b591c0f1122c1a2d4a1c16273a6f936cdf49aa7b97b9b91b1ab271ff41b0b881a9a736956ff5d3709c07ee42da96030ea
7
+ data.tar.gz: 6c86b19c30c5265ed9ad37af22ffab8176c88e815918a62278b2cfe82d4ec9cb4f4237f2202e88423ea1580a112058231e5f5005a4e1c5cf63cf7809e105a3d3
data/README.md CHANGED
@@ -35,7 +35,7 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
35
35
  Add _Orchestration_ to your Gemfile:
36
36
 
37
37
  ```ruby
38
- gem 'orchestration', '~> 0.5.1'
38
+ gem 'orchestration', '~> 0.5.2'
39
39
  ```
40
40
 
41
41
  Install:
@@ -22,6 +22,7 @@ require 'orchestration/file_helpers'
22
22
  require 'orchestration/docker_compose'
23
23
  require 'orchestration/environment'
24
24
  require 'orchestration/errors'
25
+ require 'orchestration/docker_healthcheck'
25
26
  require 'orchestration/install_generator'
26
27
  require 'orchestration/railtie' if defined?(Rails)
27
28
  require 'orchestration/service_check'
@@ -1,64 +1,65 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'net/http'
4
+ module Orchestration
5
+ class DockerHealthcheck
6
+ def self.execute
7
+ new.execute
8
+ end
4
9
 
5
- class DockerHealthcheck
6
- def self.execute
7
- new.execute
8
- end
9
-
10
- def execute
11
- return_code = 1
10
+ def execute
11
+ return_code = 1
12
12
 
13
- # rubocop:disable Lint/RescueException
14
- begin
15
- response = run
16
- return_code = 0 if success?(response.code)
17
- puts message(response.code)
18
- rescue Exception => e
19
- puts "[#{__FILE__}] ERROR: #{e.inspect}"
20
- ensure
21
- exit return_code
13
+ # rubocop:disable Lint/RescueException
14
+ begin
15
+ response = run
16
+ return_code = 0 if success?(response.code)
17
+ puts message(response.code)
18
+ rescue Exception => e
19
+ puts "[#{__FILE__}] ERROR: #{e.inspect}"
20
+ ensure
21
+ exit return_code
22
+ end
23
+ # rubocop:enable Lint/RescueException
22
24
  end
23
- # rubocop:enable Lint/RescueException
24
- end
25
25
 
26
- private
26
+ private
27
27
 
28
- def request
29
- client = Net::HTTP.new(
30
- ENV.fetch('WEB_HOST', 'localhost'),
31
- ENV.fetch('WEB_PORT', '8080').to_i
32
- )
28
+ def run
29
+ client = Net::HTTP.new(
30
+ ENV.fetch('WEB_HOST', 'localhost'),
31
+ ENV.fetch('WEB_PORT', '8080').to_i
32
+ )
33
33
 
34
- client.read_timeout = ENV.fetch('WEB_HEALTHCHECK_READ_TIMEOUT', '10').to_i
35
- client.open_timeout = ENV.fetch('WEB_HEALTHCHECK_OPEN_TIMEOUT', '10').to_i
34
+ client.read_timeout = ENV.fetch('WEB_HEALTHCHECK_READ_TIMEOUT', '10').to_i
35
+ client.open_timeout = ENV.fetch('WEB_HEALTHCHECK_OPEN_TIMEOUT', '10').to_i
36
36
 
37
- client.start do |request|
38
- request.get(ENV.fetch('WEB_HEALTHCHECK_PATH') { '/' })
37
+ client.start do |request|
38
+ request.get(ENV.fetch('WEB_HEALTHCHECK_PATH') { '/' })
39
+ end
39
40
  end
40
- end
41
41
 
42
- def success_codes
43
- ENV.fetch('WEB_HEALTHCHECK_SUCCESS_CODES', '200,202,204').split(',')
44
- end
45
-
46
- def success?(code)
47
- success_codes.include?(code.to_s)
48
- end
42
+ def success_codes
43
+ ENV.fetch('WEB_HEALTHCHECK_SUCCESS_CODES', '200,202,204').split(',')
44
+ end
49
45
 
50
- def message(code)
51
- if success?(code)
52
- outcome = 'SUCCESS ✓ '
53
- in_or_not = 'IN'
54
- else
55
- outcome = 'FAILURE ✘ '
56
- in_or_not = 'NOT IN'
46
+ def success?(code)
47
+ success_codes.include?(code.to_s)
57
48
  end
58
49
 
59
- accepted = success_codes.join(', ')
60
- message = "#{in_or_not} [#{accepted}] : #{outcome} [#{__FILE__}]"
50
+ def message(code)
51
+ if success?(code)
52
+ outcome = 'SUCCESS ✓ '
53
+ in_or_not = 'IN'
54
+ else
55
+ outcome = 'FAILURE ✘ '
56
+ in_or_not = 'NOT IN'
57
+ end
61
58
 
62
- "# HTTP_STATUS(#{code}) #{message}"
59
+ accepted = success_codes.join(', ')
60
+ message = "#{in_or_not} [#{accepted}] : #{outcome} [#{__FILE__}]"
61
+
62
+ "# HTTP_STATUS(#{code}) #{message}"
63
+ end
63
64
  end
64
65
  end
@@ -20,10 +20,10 @@ COPY .build/Gemfile .build/Gemfile.lock ./
20
20
  RUN bundle install --without development test --deployment
21
21
  <% if defined?(Webpacker) %>
22
22
  COPY .build/package.json .build/yarn.lock ./
23
- RUN . /root/.bashrc && yarn install
23
+ RUN . /root/.bashrc ; yarn install
24
24
  <% end %>
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=abc123 bundle exec rake assets:precompile<% elsif Rake::Task.tasks.map(&:name).include?('assets:precompile') %>RUN NODE_ENV=production RAILS_ENV=production SECRET_KEY_BASE=abc123 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=abc123 bundle exec rake assets:precompile<% elsif Rake::Task.tasks.map(&:name).include?('assets:precompile') %>RUN NODE_ENV=production RAILS_ENV=production SECRET_KEY_BASE=abc123 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'] %> \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
@@ -23,7 +23,7 @@ namespace :orchestration do
23
23
 
24
24
  desc I18n.t('orchestration.rake.healthcheck')
25
25
  task :healthcheck do
26
- Orchestration::Healthcheck.execute
26
+ Orchestration::DockerHealthcheck.execute
27
27
  end
28
28
 
29
29
  desc I18n.t('orchestration.rake.wait')
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-28 00:00:00.000000000 Z
11
+ date: 2020-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: database_url