orchestration 0.7.9 → 0.7.11

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: a7f2c48f8cea2252de2052ebe5f7f5a668b1fc61163cc08e299f14c0029dce8e
4
- data.tar.gz: b886c269f560b78e6123285b476dd30ceee7c234a530e5ba6bbfc5eeb83b9e2a
3
+ metadata.gz: 76a744cb6cc82929bcaea021634c1af4b7b34392659e1a3d799ddd61854e6dee
4
+ data.tar.gz: d42940c62fa5488a64cf3e6c245938de8d1cf8e47536fd9a0075903dcd54d272
5
5
  SHA512:
6
- metadata.gz: 4d4e59b7abdeabc3b354b6826a5d3fcceb8f4dcdfd7ce76008e765a6a94e334a335589374ee5dca2da7ee762ffc615c9d789ad469149cdadca25408c958c986e
7
- data.tar.gz: b17ebc5095a553993b64df89d56671cc61852d136e1dcc8c1a0217d74a4cd355d9d513401259e59143158ce91c220a765ad17083c66c596a190b10fb4904fd14
6
+ metadata.gz: 0ad4095426917667b72150004b57525ffedaedf84be6c68b727ca782814c5a053a45f6e33c8cc36bcc95825863bbe36684862b3c31f501ad3938f40217d3f39e
7
+ data.tar.gz: fa5d209da39d650a7bbb52b786d900f3e5ebcce7ea69a9c662cbc3ddadbd318be82f3764d744420215a67e569436870c157ed244670d4471e00cdf16f9b8a23c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orchestration (0.7.9)
4
+ orchestration (0.7.11)
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:
@@ -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,6 +17,8 @@ module Orchestration
17
17
  end
18
18
 
19
19
  def orchestration_configuration
20
+ return unless build?('.orchestration.yml')
21
+
20
22
  configure_orchestration_settings
21
23
  relpath = relative_path(@env.orchestration_configuration_path)
22
24
  return @terminal.write(:create, relpath) unless @settings.exist? || force?
@@ -26,11 +28,15 @@ module Orchestration
26
28
  end
27
29
 
28
30
  def application_makefile
31
+ return unless build?('Makefile')
32
+
29
33
  path = @env.root.join('Makefile')
30
34
  simple_copy('application.mk', path) unless File.exist?(path)
31
35
  end
32
36
 
33
37
  def dockerfile
38
+ return unless build?('Dockerfile')
39
+
34
40
  create_file(
35
41
  orchestration_dir.join('Dockerfile'),
36
42
  dockerfile_content,
@@ -39,6 +45,8 @@ module Orchestration
39
45
  end
40
46
 
41
47
  def entrypoint_sh
48
+ return unless build?('entrypoint.sh')
49
+
42
50
  content = template('entrypoint.sh')
43
51
  path = orchestration_dir.join('entrypoint.sh')
44
52
  create_file(path, content, overwrite: false)
@@ -46,12 +54,15 @@ module Orchestration
46
54
  end
47
55
 
48
56
  def docker_compose
57
+ return unless build?('docker-compose.yml')
58
+
49
59
  @docker_compose.docker_compose_test_yml
50
60
  @docker_compose.docker_compose_development_yml
51
61
  @docker_compose.docker_compose_deployment_yml
52
62
  end
53
63
 
54
64
  def puma
65
+ return unless build?('puma.rb')
55
66
  return nil unless @env.web_server == 'puma'
56
67
 
57
68
  content = template('puma.rb')
@@ -60,6 +71,7 @@ module Orchestration
60
71
  end
61
72
 
62
73
  def unicorn
74
+ return unless build?('unicorn.rb')
63
75
  return nil unless @env.web_server == 'unicorn'
64
76
 
65
77
  content = template('unicorn.rb')
@@ -70,6 +82,7 @@ module Orchestration
70
82
  end
71
83
 
72
84
  def database_yml
85
+ return unless build?('database.yml')
73
86
  return unless defined?(::ActiveRecord)
74
87
 
75
88
  adapter = DockerCompose::ComposeConfiguration.database_adapter_name
@@ -79,28 +92,35 @@ module Orchestration
79
92
  end
80
93
 
81
94
  def mongoid_yml
95
+ return unless build?('mongoid.yml')
82
96
  return unless defined?(::Mongoid)
83
97
 
84
98
  service_config('mongoid.yml', Services::Mongo::Configuration)
85
99
  end
86
100
 
87
101
  def rabbitmq_yml
102
+ return unless build?('rabbitmq.yml')
88
103
  return unless defined?(::Bunny)
89
104
 
90
105
  service_config('rabbitmq.yml', Services::RabbitMQ::Configuration)
91
106
  end
92
107
 
93
108
  def redis_yml
109
+ return unless build?('redis.yml')
94
110
  return unless defined?(::Redis)
95
111
 
96
112
  service_config('redis.yml', Services::Redis::Configuration)
97
113
  end
98
114
 
99
115
  def env
116
+ return unless build?('.env')
117
+
100
118
  simple_copy('env', @env.root.join('.env'), overwrite: false)
101
119
  end
102
120
 
103
121
  def gitignore
122
+ return unless build?('.gitignore')
123
+
104
124
  path = @env.root.join('.gitignore')
105
125
  globs = %w[.build/ .deploy/ Gemfile Gemfile.lock docker-compose.local.yml]
106
126
  lines = %w[orchestration/.sidecar .env deploy.tar] + globs.map do |line|
@@ -112,6 +132,13 @@ module Orchestration
112
132
 
113
133
  private
114
134
 
135
+ def build?(filename)
136
+ return true unless ENV.key?('build')
137
+ return true if ENV.fetch('build') == filename
138
+
139
+ false
140
+ end
141
+
115
142
  def t(key)
116
143
  I18n.t("orchestration.#{key}")
117
144
  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 \
@@ -2,18 +2,25 @@ FROM ruby:<%= ruby_version %>
2
2
  ARG BUNDLE_BITBUCKET__ORG
3
3
  ARG BUNDLE_GITHUB__COM
4
4
  ARG GIT_COMMIT
5
- RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
6
- && apt-get update \
5
+ ENV NODE_MAJOR=20
6
+ RUN apt-get update \
7
7
  && DEBIAN_FRONTEND=noninteractive apt-get install -y \
8
- nodejs \
9
8
  gosu \
10
9
  sendmail \
10
+ cron \
11
+ ca-certificates \
12
+ curl \
13
+ gnupg \
14
+ && mkdir -p /etc/apt/keyrings \
15
+ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
16
+ && 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 \
17
+ && apt-get update \
18
+ && apt-get install nodejs \
11
19
  && rm -rf /var/lib/apt/lists/* \
12
20
  && gem install bundler \
13
21
  && mkdir /app<%if defined?(Webpacker) %> \
14
22
  && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
15
23
  && . /root/.bashrc \
16
- && nvm install 14.16.0 \
17
24
  && npm config set user 0 \
18
25
  && npm config set unsafe-perm true \
19
26
  && npm install -g yarn<% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.7.9'
4
+ VERSION = '0.7.11'
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.9
4
+ version: 0.7.11
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-30 00:00:00.000000000 Z
11
+ date: 2023-11-02 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