orchestration 0.5.7 → 0.5.12

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: a9dd4904167052dde3f1cbf5f441225f2719c42467204077d943534f73bb2873
4
- data.tar.gz: 873bea476a74979aa917e87449c0da23a1c63128c1257a6c0ab40414e464a2ef
3
+ metadata.gz: 80872dc0b6d1fe6a0e4223915a047c9ed6b3461540b64842613b4d8a0ba72f3d
4
+ data.tar.gz: b33f4a5c305fd48f952a92a4f98748d1dae64eae62d5b222b4831f80cc2dbe9f
5
5
  SHA512:
6
- metadata.gz: bf66b2842c17ed6cb43d7a02045f9c35f7a4bf6fe70e8c7d4425ddee8c72c24a810ab64175fa00430da2c38b3c9e66dde62cedc31b65a68b5b51ba65e53c87c9
7
- data.tar.gz: 4e3aa0a3ba1f8b2f9b7bd58e6a553a86924cbf0805657de8b5b6c63eeefc8ee38bea13a560f093410778690c5c0d9228359e9d8a0f38bd6e600b1c42e80bd253
6
+ metadata.gz: 4d83d6166ce64feb661d3952431d4b26569c96568308008f0070960343cb7959847ae5217cf30e780fa0228387cdb4e4404091ac6934996492cda355eec9b932
7
+ data.tar.gz: 6c78278a30cd2489e229900560c583731e29e4f88f4309530d6ff09095d59e426d6a500896d20dadcb03eca8dfdd3786b0c68d43c7b675209d7cdf4f374acbf1
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.7'
30
+ gem 'orchestration', '~> 0.5.12'
31
31
  ```
32
32
 
33
33
  Install:
@@ -191,12 +191,20 @@ make serve server='-p 3001 -b 192.168.0.1'
191
191
  A default `test` target is provided in your application's main `Makefile`. You are encouraged to modify this target to suit your application's requirements.
192
192
 
193
193
  To launch all dependency containers, run database migrations, and run tests:
194
- ```
194
+ ```bash
195
195
  make test
196
196
  ```
197
197
 
198
- If you prefer to run tests manually (e.g. if you want to run tests for a specific file) then the `test-setup` target can be used:
198
+ The default `test` command can (and should) be extended. This command is defined in the root `Makefile` in the project and, by defaults, runs `rspec` and `rubocop`.
199
+
200
+ To run only the `test` command, without test setup (i.e. without restarting containers etc.), pass the `light` option:
201
+
202
+ ```bash
203
+ make test light=1
199
204
  ```
205
+
206
+ If you prefer to run tests manually (e.g. if you want to run tests for a specific file) then the `test-setup` target can be used:
207
+ ```bash
200
208
  make test-setup
201
209
  bundle exec rspec spec/my_class_spec.rb
202
210
  ```
@@ -227,7 +235,7 @@ To connect via _SSH_ to a remote swarm and deploy, pass the `manager` parameter:
227
235
  make deploy manager=user@manager.swarm.example.com
228
236
  ```
229
237
 
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.
238
+ The file `orchestration/docker-compose.production.yml` is created automatically. This file will always be used for deployment, regardless of _Rails_ environment. Other environments should be configured using a separate [`.env` file](#env-file) for each environment.
231
239
 
232
240
  #### Roll back a deployment
233
241
 
@@ -262,6 +270,7 @@ networks:
262
270
  ```
263
271
 
264
272
  #### Use a custom `.env` file
273
+ <a name="env-file"></a>
265
274
 
266
275
  Specify a path to a local `.env` file (see [Docker Compose documentation](https://docs.docker.com/compose/environment-variables/#the-env-file)):
267
276
  ```
@@ -62,6 +62,7 @@ module Orchestration
62
62
  .fetch(service)
63
63
  .new(config, @environment)
64
64
  .definition
65
+ &.tap { |definition| definition['networks'] ||= { 'local' => {} } }
65
66
  end
66
67
  end
67
68
  end
@@ -42,7 +42,7 @@ module Orchestration
42
42
  'version' => compose_config(environment).version,
43
43
  'services' => services(environment),
44
44
  'volumes' => volumes(environment),
45
- 'networks' => networks(environment)
45
+ 'networks' => compose_config(environment).networks
46
46
  }
47
47
  end
48
48
 
@@ -56,12 +56,6 @@ module Orchestration
56
56
  compose_config(environment).volumes
57
57
  end
58
58
 
59
- def networks(environment)
60
- return {} unless environment == :production
61
-
62
- compose_config(environment).networks
63
- end
64
-
65
59
  def compose_config(environment)
66
60
  DockerCompose::Configuration.new(
67
61
  @env,
@@ -82,37 +82,31 @@ module Orchestration
82
82
  end
83
83
 
84
84
  def host
85
- url_config['host'] || file_config['host'] || super
85
+ chained_config('host') || super
86
86
  end
87
87
 
88
88
  def port
89
89
  return nil if sqlite?
90
90
 
91
- url_config['port'] || file_config['port'] || super
91
+ chained_config('port') || super
92
92
  end
93
93
 
94
94
  def username
95
- (
96
- url_config['username'] ||
97
- file_config['username'] ||
98
- (adapter && adapter.credentials['username'])
99
- )
95
+ chained_config('username') || (adapter && adapter.credentials['username'])
100
96
  end
101
97
 
102
98
  def password
103
- (
104
- url_config['password'] ||
105
- file_config['password'] ||
106
- (adapter && adapter.credentials['password'])
107
- )
99
+ chained_config('password') || (adapter && adapter.credentials['password'])
108
100
  end
109
101
 
110
102
  def database
111
- (
112
- url_config['database'] ||
113
- file_config['database'] ||
114
- (adapter && adapter.credentials['database'])
115
- )
103
+ chained_config('database') || (adapter && adapter.credentials['database'])
104
+ end
105
+
106
+ def chained_config(key)
107
+ return url_config[key] || file_config[key] if @env.environment == 'test'
108
+
109
+ file_config[key] || url_config[key]
116
110
  end
117
111
 
118
112
  def adapter_by_name(name)
@@ -2,5 +2,3 @@
2
2
  # e.g.:
3
3
  #
4
4
  # DISABLE_SPRING=1
5
-
6
- PUBLISH_PORT=3000
@@ -112,7 +112,7 @@ all: build
112
112
 
113
113
  .PHONY: start
114
114
  ifndef network
115
- start: network := ${compose_project_name}_default
115
+ start: network := ${compose_project_name}
116
116
  endif
117
117
  start: _create-log-directory _clean-logs
118
118
  @$(call print,'${yellow}Starting ${cyan}${env}${yellow} containers${reset} ...')
@@ -144,7 +144,7 @@ start-<%= service %>:
144
144
  <% end %>
145
145
 
146
146
  .PHONY: stop
147
- stop: network := ${compose_project_name}_default
147
+ stop: network := ${compose_project_name}
148
148
  stop:
149
149
  @$(call print,'${yellow}Stopping ${cyan}${env}${yellow} containers${reset} ...')
150
150
  @if docker ps --format "{{.ID}}" | grep -q $(shell hostname) ; \
@@ -264,7 +264,7 @@ deploy: RAILS_ENV := ${env}
264
264
  deploy: RACK_ENV := ${env}
265
265
  deploy: DOCKER_TAG = ${git_version}
266
266
  deploy: base_vars = DOCKER_ORGANIZATION=${docker_organization} DOCKER_REPOSITORY=${docker_repository} DOCKER_TAG=${git_version}
267
- deploy: compose_deploy := ${base_vars} COMPOSE_PROJECT_NAME=${project_base} HOST_UID=$(shell id -u) docker-compose ${env_file_option} --project-name ${project_base} -f orchestration/docker-compose.${env}.yml
267
+ deploy: compose_deploy := ${base_vars} COMPOSE_PROJECT_NAME=${project_base} HOST_UID=$(shell id -u) docker-compose ${env_file_option} --project-name ${project_base} -f orchestration/docker-compose.production.yml
268
268
  deploy: compose_config := ${compose_deploy} config
269
269
  deploy: deploy_cmd := echo "$${config}" | ssh "${manager}" "/bin/bash -lc 'cat | docker stack deploy --prune --with-registry-auth -c - ${project_base}'"
270
270
  deploy: out_of_sequence_error := rpc error: code = Unknown desc = update out of sequence
@@ -282,7 +282,7 @@ endif
282
282
  export config="$$(${compose_config} 2>${stderr})" ; \
283
283
  config_exit_code=$$? ; \
284
284
  if [[ "$${config_exit_code}" != "0" ]]; then exit ${config_exit_code}; fi ; \
285
- output="$$(${deploy_cmd} | tee /dev/tty)" ; \
285
+ output="$$(${deploy_cmd} | tee)" ; \
286
286
  deploy_exit_code=$$? ; \
287
287
  if [[ "$${deploy_exit_code}" == 0 ]] ; then exit 0 ; fi ; \
288
288
  if ! echo "$${output}" | grep -q '${out_of_sequence_error}' ; then exit ${deploy_exit_code} ; fi ; \
@@ -1,6 +1,6 @@
1
1
  environment ENV.fetch('RAILS_ENV') { 'development' }
2
2
 
3
- port ENV.fetch('WEB_PORT') { 3000 }
3
+ port ENV.fetch('WEB_PORT') { 8080 }
4
4
  workers ENV.fetch('WEB_CONCURRENCY') { 4 }
5
5
  threads_count = ENV.fetch('RAILS_MAX_THREADS') { 8 }
6
6
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.5.7'
4
+ VERSION = '0.5.12'
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.5.7
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-14 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: database_url