orchestration 0.4.5 → 0.4.6
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 +17 -1
- data/lib/orchestration/service_check.rb +10 -0
- data/lib/orchestration/services/mixins/configuration_base.rb +9 -1
- data/lib/orchestration/templates/Dockerfile.erb +4 -1
- data/lib/orchestration/templates/entrypoint.sh.erb +2 -3
- data/lib/orchestration/templates/mongoid.yml.erb +2 -6
- data/lib/orchestration/templates/orchestration.mk.erb +7 -6
- data/lib/orchestration/templates/rabbitmq.yml.erb +2 -2
- data/lib/orchestration/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0e5ee806929f885562e72f8d9b646a2c4b349ea9d43efc8d40185de8fc1bd21
|
4
|
+
data.tar.gz: 22d24ea9b0ac4bf3ee4764c74f52bd4721dbb7b96b12de94fd8509998cb6df78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2c0b88548df5da741069990629bfa2d02c6439cdf2c68cc7e9addc8f0d6dbe4074d0ec107f10f7ac235f440c4a422cb6c68eb7d57829c41263cd3ca556edc32
|
7
|
+
data.tar.gz: 63a5b30a5674aef12c730c67cc19e04b64470ae1724516f3bcb9e9fc39bfcc70291c8af1389d1930b4e8dd0fceb844656191d2ee324d50b6ed3aeb0b0f3c1390
|
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.4.
|
38
|
+
gem 'orchestration', '~> 0.4.6'
|
39
39
|
```
|
40
40
|
|
41
41
|
Install:
|
@@ -184,6 +184,14 @@ Note that _Orchestration_ will wait for all services to become fully available (
|
|
184
184
|
|
185
185
|
_(See [sidecar containers](#sidecar-containers) if you are running your test/development server inside _Docker_)_.
|
186
186
|
|
187
|
+
### (Local) Production
|
188
|
+
|
189
|
+
Run a production environment locally to simulate your deployment platform:
|
190
|
+
|
191
|
+
```
|
192
|
+
make start env=production
|
193
|
+
```
|
194
|
+
|
187
195
|
### Deployment to Docker Swarm
|
188
196
|
|
189
197
|
To deploy your application to a local _Docker Swarm_ use:
|
@@ -207,6 +215,14 @@ To override this default, pass the `project_name` parameter:
|
|
207
215
|
make deploy project_name=acme_anvil_production
|
208
216
|
```
|
209
217
|
|
218
|
+
This variable will also be available as `COMPOSE_PROJECT_NAME` for use within your `docker-compose.yml`. e.g. to explicitly name a network after the project name:
|
219
|
+
|
220
|
+
```yaml
|
221
|
+
networks:
|
222
|
+
myapp:
|
223
|
+
name: "${COMPOSE_PROJECT_NAME}"
|
224
|
+
```
|
225
|
+
|
210
226
|
#### Use a custom `.env` file
|
211
227
|
|
212
228
|
Specify a path to a local `.env` file (see [Docker Compose documentation](https://docs.docker.com/compose/environment-variables/#the-env-file)):
|
@@ -16,6 +16,8 @@ module Orchestration
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
|
+
return echo_missing unless @service.configuration.configured?
|
20
|
+
|
19
21
|
echo_start
|
20
22
|
success = attempt_connection
|
21
23
|
echo_ready if success
|
@@ -37,6 +39,14 @@ module Orchestration
|
|
37
39
|
false
|
38
40
|
end
|
39
41
|
|
42
|
+
def echo_missing
|
43
|
+
@terminal.write(
|
44
|
+
@service_name.to_sym,
|
45
|
+
"#{@service.configuration.error} (skipping)",
|
46
|
+
:error
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
40
50
|
def echo_start
|
41
51
|
@terminal.write(@service_name.to_sym, '', :status)
|
42
52
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Orchestration
|
4
4
|
module Services
|
5
5
|
module ConfigurationBase
|
6
|
-
attr_reader :service_name, :env
|
6
|
+
attr_reader :service_name, :env, :error
|
7
7
|
|
8
8
|
def self.included(base)
|
9
9
|
base.extend(ClassMethods)
|
@@ -33,6 +33,14 @@ module Orchestration
|
|
33
33
|
@service_name
|
34
34
|
end
|
35
35
|
|
36
|
+
def configured?
|
37
|
+
port
|
38
|
+
true
|
39
|
+
rescue KeyError => error
|
40
|
+
@error = error
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
36
44
|
def port
|
37
45
|
return @env.app_port if @service_name == 'app'
|
38
46
|
|
@@ -3,7 +3,10 @@ ARG BUNDLE_BITBUCKET__ORG
|
|
3
3
|
ARG BUNDLE_GITHUB__COM
|
4
4
|
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
5
5
|
&& apt-get update \
|
6
|
-
&& apt-get install -y
|
6
|
+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
7
|
+
nodejs \
|
8
|
+
gosu \
|
9
|
+
sendmail \
|
7
10
|
&& rm -rf /var/lib/apt/lists/* \
|
8
11
|
&& gem install bundler \
|
9
12
|
&& mkdir /app<%if defined?(Webpacker) %> \
|
@@ -1,16 +1,12 @@
|
|
1
1
|
development:
|
2
2
|
clients:
|
3
3
|
default:
|
4
|
-
|
5
|
-
- 127.0.0.1:<%= compose.call('development').local_port('mongo') %>
|
6
|
-
database: development_db
|
4
|
+
uri: <%= "#{'<' + '%' + '='} ENV.fetch('MONGO_URL', 'mongodb://127.0.0.1:#{compose.call('development').local_port('mongo')}/development_db') #{'%' + '>'}" %>
|
7
5
|
|
8
6
|
test:
|
9
7
|
clients:
|
10
8
|
default:
|
11
|
-
|
12
|
-
- 127.0.0.1:<%= compose.call('test').local_port('mongo') %>
|
13
|
-
database: test_db
|
9
|
+
uri: <%= "#{'<' + '%' + '='} ENV.fetch('MONGO_URL', 'mongodb://127.0.0.1:#{compose.call('test').local_port('mongo')}/test_db') #{'%' + '>'}" %>
|
14
10
|
|
15
11
|
production:
|
16
12
|
clients:
|
@@ -39,11 +39,15 @@ endif
|
|
39
39
|
docker_organization=$(shell bash ${orchestration_dir}/yaml.bash docker_organization)
|
40
40
|
docker_repository=$(shell bash ${orchestration_dir}/yaml.bash docker_repository)
|
41
41
|
|
42
|
+
ifeq (,$(project_name))
|
43
|
+
project_name = ${docker_repository}_${env}
|
44
|
+
endif
|
45
|
+
|
42
46
|
compose_base=env HOST_UID=$(shell id -u) \
|
43
47
|
DOCKER_ORGANIZATION="${docker_organization}" \
|
44
48
|
DOCKER_REPOSITORY="${docker_repository}" \
|
49
|
+
COMPOSE_PROJECT_NAME="${project_name}" \
|
45
50
|
docker-compose \
|
46
|
-
-p "${docker_repository}_${env}" \
|
47
51
|
-f "${orchestration_dir}/docker-compose.yml"
|
48
52
|
|
49
53
|
git_branch ?= $(if $(branch),$(branch),$(shell git rev-parse --abbrev-ref HEAD))
|
@@ -68,7 +72,7 @@ endif
|
|
68
72
|
start: _clean-logs
|
69
73
|
@$(call print,'${yellow}Starting containers${reset} ...')
|
70
74
|
ifeq (${env},$(filter ${env},test development))
|
71
|
-
@${compose} up
|
75
|
+
@${compose} up --detach --force-recreate --renew-anon-volumes ${services} ${log} || ${fail}
|
72
76
|
@[ -n '${sidecar}' ] && \
|
73
77
|
( \
|
74
78
|
docker network connect '${network}' '$(shell hostname)' ${log} \
|
@@ -77,7 +81,7 @@ ifeq (${env},$(filter ${env},test development))
|
|
77
81
|
) \
|
78
82
|
|| ( [ -z '${sidecar}' ] || ${fail} )
|
79
83
|
else
|
80
|
-
@${compose} up
|
84
|
+
@${compose} up --detach --scale app=$${instances:-1} ${services} ${log} || ${fail}
|
81
85
|
endif
|
82
86
|
@$(call printrawln,' ${green}started${reset} ${tick}')
|
83
87
|
@$(call println,'${yellow}Waiting for services to become available${reset} ...')
|
@@ -207,9 +211,6 @@ endif
|
|
207
211
|
ifndef manager
|
208
212
|
@$(call println_error,'Missing `manager` parameter: `make deploy manager=swarm-manager.example.com`')
|
209
213
|
endif
|
210
|
-
ifeq (,${project_name})
|
211
|
-
deploy: project_name = ${docker_repository}_${env}
|
212
|
-
endif
|
213
214
|
deploy: path := $(shell mktemp -d)
|
214
215
|
deploy: RAILS_ENV := ${env}
|
215
216
|
deploy: RACK_ENV := ${env}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<% if compose.call('development').services.key?('rabbitmq') %>
|
2
2
|
development:
|
3
|
-
url: amqp://127.0.0.1
|
3
|
+
url: <%= "#{'<' + '%' + '='} ENV.fetch('RABBITMQ_URL', 'amqp://127.0.0.1:#{compose.call('development').local_port('rabbitmq')}') #{'%' + '>'}" %>
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% if compose.call('test').services.key?('rabbitmq') %>
|
7
7
|
test:
|
8
|
-
url: amqp://127.0.0.1
|
8
|
+
url: <%= "#{'<' + '%' + '='} ENV.fetch('RABBITMQ_URL', 'amqp://127.0.0.1:#{compose.call('test').local_port('rabbitmq')}') #{'%' + '>'}" %>
|
9
9
|
<% end %>
|
10
10
|
|
11
11
|
production:
|
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.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|