orchestration 0.6.12 → 0.6.14

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: 1de0a5221b816f60d95a04376bb965de0f6381b585b454f3b8d49f1c0e05086d
4
- data.tar.gz: 811bba578ba6e1166db99f95bf51dbb4e33e349f82e442013725651640d0bb63
3
+ metadata.gz: bcf0bada7cf3b3a134fecda49886fd0a79b8b03d1a8a02a759f60390d6fa8a58
4
+ data.tar.gz: e716bc24dab185c4547c3c6b020e66e34cf5ad9598fded73a071c0aaecb896d0
5
5
  SHA512:
6
- metadata.gz: 8fe95b455287bd1e7c4b874c3bccffc8595b259f11ea892419e23ba074c60235e1a1f48a8eeb71aef8a5a76522e0833717c3b22b06987326b8a67a5d4a0c128e
7
- data.tar.gz: 716c7c3389b69be2d80ee0b1f690d42f66f09f047752c97d5b806aa88bd85998b446bf266b2ef7a57b357ae37337f3cea4a6e391a88456246f4f6fa726306b13
6
+ metadata.gz: 3494b60cc10be3de1ecfb828bdd5e750d039516a43ee4f6d2d28fd5b1c277eb2afc8ec862860d5f48652429413d101fd09b1bcc9d23edbb953f6042de08a002a
7
+ data.tar.gz: c2d8d6b318c16d44bce372012d7c2400ff20d3e465b201d34e24fc3ba8402e7be0b346f0f9fc0ad5e97b616672cb4e2184c265618e60a7882b98e1c89d8ea5a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orchestration (0.6.12)
4
+ orchestration (0.6.14)
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:
@@ -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,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,22 +92,28 @@ 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 env
109
+ return unless build?('.env')
110
+
94
111
  simple_copy('env', @env.root.join('.env'), overwrite: false)
95
112
  end
96
113
 
97
114
  def gitignore
115
+ return unless build?('.gitignore')
116
+
98
117
  path = @env.root.join('.gitignore')
99
118
  globs = %w[.build/ .deploy/ Gemfile Gemfile.lock docker-compose.local.yml]
100
119
  lines = %w[orchestration/.sidecar .env deploy.tar] + globs.map do |line|
@@ -106,6 +125,13 @@ module Orchestration
106
125
 
107
126
  private
108
127
 
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
+
109
135
  def t(key)
110
136
  I18n.t("orchestration.#{key}")
111
137
  end
@@ -182,12 +182,18 @@ ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
182
182
  ifeq (,${sidecar_suffix})
183
183
  $(warning Unable to generate project suffix; project name collisions may occur.)
184
184
  endif
185
- compose_project_name = ${project_base}_${sidecar_suffix}
185
+ compose_project_name_base = ${project_base}_${sidecar_suffix}
186
186
  else
187
- compose_project_name = ${project_base}
187
+ compose_project_name_base = ${project_base}
188
188
  endif
189
189
  else
190
- compose_project_name = ${project_base}
190
+ compose_project_name_base = ${project_base}
191
+ endif
192
+
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}
191
197
  endif
192
198
 
193
199
  compose_base:=env -i \
@@ -196,6 +202,7 @@ compose_base:=env -i \
196
202
  DOCKER_ORGANIZATION="${docker_organization}" \
197
203
  DOCKER_REPOSITORY="${docker_repository}" \
198
204
  COMPOSE_PROJECT_NAME="${compose_project_name}" \
205
+ COMPOSE_PROJECT_NAME_SUFFIX="${COMPOSE_PROJECT_NAME_SUFFIX}" \
199
206
  ${sidecar_compose} \
200
207
  docker-compose \
201
208
  -f ${orchestration_dir}/docker-compose.${env}.yml
@@ -449,6 +456,8 @@ build: _create-log-directory check-local-changes
449
456
  @$(call echo,Preparing build context from ${cyan}${git_branch}${reset} (${cyan}${git_version}${reset})${reset})
450
457
  @$(call system,git archive --format "tar" -o "${context}" "${git_branch}")
451
458
  @mkdir -p ${orchestration_dir}/.build ${log} || ${exit_fail}
459
+ @cp '$(shell bundle info --path orchestration)/lib/orchestration/healthcheck.bash' '${orchestration_dir}/healthcheck'
460
+ @chmod +x '${orchestration_dir}/healthcheck'
452
461
  ifndef dev
453
462
  @git show ${git_branch}:./Gemfile > ${orchestration_dir}/.build/Gemfile 2>${stderr} || ${exit_fail}
454
463
  @git show ${git_branch}:./Gemfile.lock > ${orchestration_dir}/.build/Gemfile.lock 2>${stderr} || ${exit_fail}
@@ -456,6 +465,8 @@ ifndef dev
456
465
  else
457
466
  @tar -cvf '${context}' . ${log} || ${exit_fail}
458
467
  endif
468
+ @tar --append --file '${context}' '${orchestration_dir}/healthcheck'
469
+ @rm '${orchestration_dir}/healthcheck'
459
470
  ifdef include
460
471
  @$(call echo,Including files from: ${cyan}${include}${reset})
461
472
  @(while read line; do \
@@ -2,18 +2,24 @@ 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
+ 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
+ && apt-get install nodejs \
11
18
  && rm -rf /var/lib/apt/lists/* \
12
19
  && gem install bundler \
13
20
  && mkdir /app<%if defined?(Webpacker) %> \
14
21
  && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
15
22
  && . /root/.bashrc \
16
- && nvm install 14.16.0 \
17
23
  && npm config set user 0 \
18
24
  && npm config set unsafe-perm true \
19
25
  && npm install -g yarn<% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.6.12'
4
+ VERSION = '0.6.14'
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.12
4
+ version: 0.6.14
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
@@ -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