orchestration 0.5.4 → 0.5.5
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 +4 -4
- data/README.md +5 -3
- data/lib/orchestration.rb +1 -1
- data/lib/orchestration/docker_compose/app_service.rb +1 -1
- data/lib/orchestration/docker_healthcheck.rb +1 -1
- data/lib/orchestration/environment.rb +1 -1
- data/lib/orchestration/service_check.rb +2 -0
- data/lib/orchestration/services/database/healthcheck.rb +12 -0
- data/lib/orchestration/services/mixins/healthcheck_base.rb +4 -0
- data/lib/orchestration/templates/application.mk.erb +3 -1
- data/lib/orchestration/templates/deploy.mk.erb +2 -2
- data/lib/orchestration/templates/orchestration.mk.erb +8 -4
- data/lib/orchestration/version.rb +1 -1
- metadata +2 -5
- data/bin/rspec +0 -29
- data/bin/rubocop +0 -29
- data/bin/strong_versions +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e312ede29eb601b4e9413df1b711881997f81629b6f208c0ea7e62102d4a6b44
|
4
|
+
data.tar.gz: 4483fd3532b1bf27bb9a6b76e38c996a02f046164ed23ce85d5df5720e933ff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6539ea72eabd6683691749179cb4bd08c9f9e3f334ced7348236058a2926a6e25f6a09176c47efb1f40a0b22f57f96c9d1fb9ba4274c25036a4cd03e3d3f6ead
|
7
|
+
data.tar.gz: caed0598c1dc565457e0437943a0c031b78c3bef1ab99d5ae313368af6a4e0a84e7451bc46560e454457a5fa5c8e83c5ff6019fc114c3fd22e0a0dfac00d9c61
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
|
|
27
27
|
Add _Orchestration_ to your Gemfile:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
gem 'orchestration', '~> 0.5.
|
30
|
+
gem 'orchestration', '~> 0.5.5'
|
31
31
|
```
|
32
32
|
|
33
33
|
Install:
|
@@ -227,6 +227,8 @@ To connect via _SSH_ to a remote swarm and deploy, pass the `manager` parameter:
|
|
227
227
|
make deploy manager=user@manager.swarm.example.com
|
228
228
|
```
|
229
229
|
|
230
|
+
The file `orchestration/docker-compose.production.yml` is created automatically. If your `RAILS_ENV` is set to something other than `production` then another file will need to be created (e.g. `orchestration/docker-compose.staging.yml`). In most cases this file can be a _symlink_ to the original `production` configuration and environment variables can be used to customise the content.
|
231
|
+
|
230
232
|
#### Roll back a deployment
|
231
233
|
|
232
234
|
Roll back the `app` service of your stack:
|
@@ -270,7 +272,7 @@ Note that the following two variables _must_ be set in the relevant `.env` file
|
|
270
272
|
|
271
273
|
```
|
272
274
|
# Published port for your application service:
|
273
|
-
|
275
|
+
PUBLISH_PORT=3000
|
274
276
|
|
275
277
|
# Number of replicas of your application service:
|
276
278
|
REPLICAS=5
|
@@ -325,7 +327,7 @@ See related documentation:
|
|
325
327
|
| `WEB_HEALTHCHECK_PATH` | Path expected to return a successful response | `/` |
|
326
328
|
| `WEB_HEALTHCHECK_READ_TIMEOUT` | Number of seconds to wait for data before failing healthcheck | `10` |
|
327
329
|
| `WEB_HEALTHCHECK_OPEN_TIMEOUT` | Number of seconds to wait for connection before failing healthcheck | `10` |
|
328
|
-
| `WEB_HEALTHCHECK_SUCCESS_CODES` | Comma-separated list of HTTP status codes that will be deemed a success | `200,202,204` |
|
330
|
+
| `WEB_HEALTHCHECK_SUCCESS_CODES` | Comma-separated list of HTTP status codes that will be deemed a success | `200,201,202,204` |
|
329
331
|
|
330
332
|
If your application does not have a suitable always-available route to use as a healthcheck, the following one-liner may be useful:
|
331
333
|
|
data/lib/orchestration.rb
CHANGED
@@ -19,6 +19,18 @@ module Orchestration
|
|
19
19
|
[ActiveRecord::ConnectionNotEstablished].concat(adapter_errors)
|
20
20
|
end
|
21
21
|
|
22
|
+
def modify_environment
|
23
|
+
@database_url = ENV.delete('DATABASE_URL')
|
24
|
+
@development_database_url = ENV.delete('DEVELOPMENT_DATABASE_URL')
|
25
|
+
@test_database_url = ENV.delete('TEST_DATABASE_URL')
|
26
|
+
end
|
27
|
+
|
28
|
+
def unmodify_environment
|
29
|
+
ENV['DATABASE_URL'] = @database_url
|
30
|
+
ENV['DEVELOPMENT_DATABASE_URL'] = @development_database_url
|
31
|
+
ENV['TEST_DATABASE_URL'] = @test_database_url
|
32
|
+
end
|
33
|
+
|
22
34
|
private
|
23
35
|
|
24
36
|
def adapter_errors
|
@@ -15,8 +15,10 @@ test: test-setup
|
|
15
15
|
|
16
16
|
# Start development containers and create/migrate/seed database
|
17
17
|
.PHONY: develop
|
18
|
-
develop:
|
18
|
+
develop:
|
19
19
|
bundle install
|
20
|
+
@$(MAKE) start env=test
|
21
|
+
@$(MAKE) start env=development
|
20
22
|
bundle exec rake db:create
|
21
23
|
bundle exec rake db:migrate
|
22
24
|
bundle exec rake db:seed
|
@@ -114,7 +114,7 @@ all: build
|
|
114
114
|
ifndef network
|
115
115
|
start: network := ${compose_project_name}_default
|
116
116
|
endif
|
117
|
-
start: _clean-logs
|
117
|
+
start: _create-log-directory _clean-logs
|
118
118
|
@$(call print,'${yellow}Starting ${cyan}${env}${yellow} containers${reset} ...')
|
119
119
|
ifeq (${env},$(filter ${env},test development))
|
120
120
|
@${compose} up --detach --force-recreate --renew-anon-volumes --remove-orphans ${services} ${log} || ${fail}
|
@@ -276,7 +276,7 @@ deploy:
|
|
276
276
|
ifndef manager
|
277
277
|
@$(call println_error,'Missing `manager` parameter: `make deploy manager=swarm-manager.example.com`') ; exit 1
|
278
278
|
endif
|
279
|
-
@$(call println,'${yellow}Deploying stack via${reset} ${green}${manager}${reset} ...') && \
|
279
|
+
@$(call println,'${yellow}Deploying ${green}${env}${reset} stack via${reset} ${green}${manager}${reset} ...') && \
|
280
280
|
( \
|
281
281
|
$(call make,bundle path='${path}/bundle.tar') ${log} && \
|
282
282
|
cd '${path}' ${log} && \
|
@@ -326,7 +326,7 @@ wait-listener:
|
|
326
326
|
.PHONY: build
|
327
327
|
build: build_dir = ${orchestration_dir}/.build
|
328
328
|
build: context = ${build_dir}/context.tar
|
329
|
-
build: check-local-changes
|
329
|
+
build: _create-log-directory check-local-changes
|
330
330
|
@$(call print,'${yellow}Preparing build context from${reset} ${cyan}${git_branch}:${git_version}${reset} ... ')
|
331
331
|
@mkdir -p ${orchestration_dir}/.build ${log} || ${fail}
|
332
332
|
ifndef dev
|
@@ -367,7 +367,7 @@ endif
|
|
367
367
|
@$(call println,'[${green}tag${reset}] ${cyan}${docker_organization}/${docker_repository}:${git_version}${reset}')
|
368
368
|
|
369
369
|
.PHONY: push
|
370
|
-
push:
|
370
|
+
push: _create-log-directory
|
371
371
|
@$(call print,'${yellow}Pushing${reset} ${cyan}${docker_image}${reset} ...')
|
372
372
|
@docker push ${docker_image} ${log_progress} || ${fail}
|
373
373
|
@$(call printrawln,' ${green}complete${reset}. ${tick}')
|
@@ -389,3 +389,7 @@ endif
|
|
389
389
|
_clean-logs:
|
390
390
|
@rm -f '${stdout}' '${stderr}'
|
391
391
|
@touch '${stdout}' '${stderr}'
|
392
|
+
|
393
|
+
.PHONY: _create-log-directory
|
394
|
+
_create-log-directory:
|
395
|
+
@mkdir -p log
|
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.
|
4
|
+
version: 0.5.5
|
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-
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|
@@ -322,10 +322,7 @@ files:
|
|
322
322
|
- README.md
|
323
323
|
- Rakefile
|
324
324
|
- bin/console
|
325
|
-
- bin/rspec
|
326
|
-
- bin/rubocop
|
327
325
|
- bin/setup
|
328
|
-
- bin/strong_versions
|
329
326
|
- config/locales/en.yml
|
330
327
|
- doc/images/example.png
|
331
328
|
- lib/Rakefile
|
data/bin/rspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rspec' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rubocop' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/strong_versions
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'strong_versions' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("strong_versions", "strong_versions")
|