orchestration 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/locales/en.yml +0 -1
- data/lib/orchestration/docker_compose/mongo_service.rb +2 -0
- data/lib/orchestration/services/configuration_base.rb +1 -1
- data/lib/orchestration/services/database/configuration.rb +2 -23
- data/lib/orchestration/services/healthcheck_base.rb +4 -0
- data/lib/orchestration/services/mongo/configuration.rb +31 -3
- data/lib/orchestration/services/mongo/healthcheck.rb +22 -1
- data/lib/orchestration/services/rabbitmq/healthcheck.rb +0 -6
- data/lib/orchestration/templates/Makefile.erb +2 -2
- data/lib/orchestration/templates/entrypoint.sh.erb +2 -1
- data/lib/orchestration/version.rb +1 -1
- data/orchestration.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7371c8d7691770e73a17feb1c67095e5ff6d4f68
|
4
|
+
data.tar.gz: 6438dc68182cf8673c25137ac3b9676f69284fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0888c846560554ea5b5d767b764af902c60902344501b18786283d033050d96f76a6a4ecc5906da48c00e959c22a3f8d1c318a1c3ee25651538fad932285d841'
|
7
|
+
data.tar.gz: 313e67474a01c8a3f9014fa914af1be67df44c94ec947b5dfd5c62bf62a109cd06964117764c6193cce940d079bf06e2a579b98926d7e2dd6fc5e97ac24533a1
|
data/README.md
CHANGED
data/config/locales/en.yml
CHANGED
@@ -34,7 +34,7 @@ module Orchestration
|
|
34
34
|
@adapter = adapter_object(base['adapter'])
|
35
35
|
@settings = base.merge(@adapter.credentials)
|
36
36
|
.merge(
|
37
|
-
'scheme' =>
|
37
|
+
'scheme' => base['adapter'],
|
38
38
|
'port' => DockerCompose::DatabaseService::PORT
|
39
39
|
)
|
40
40
|
end
|
@@ -90,37 +90,16 @@ module Orchestration
|
|
90
90
|
|
91
91
|
{
|
92
92
|
'host' => uri.hostname,
|
93
|
-
'adapter' =>
|
93
|
+
'adapter' => uri.scheme,
|
94
94
|
'port' => uri.port
|
95
95
|
}.merge(query_params(uri))
|
96
96
|
end
|
97
97
|
|
98
|
-
def scheme_name(adapter_name)
|
99
|
-
adapter_mapping.invert.fetch(adapter_name)
|
100
|
-
end
|
101
|
-
|
102
|
-
def adapter_name(scheme)
|
103
|
-
name = adapter_mapping.fetch(scheme, nil)
|
104
|
-
|
105
|
-
return name unless name.nil?
|
106
|
-
|
107
|
-
raise ArgumentError,
|
108
|
-
I18n.t('orchestration.unknown_scheme', scheme: scheme)
|
109
|
-
end
|
110
|
-
|
111
98
|
def query_params(uri)
|
112
99
|
return {} if uri.query.nil?
|
113
100
|
|
114
101
|
Hash[URI.decode_www_form(uri.query)]
|
115
102
|
end
|
116
|
-
|
117
|
-
def adapter_mapping
|
118
|
-
{
|
119
|
-
'mysql' => 'mysql2',
|
120
|
-
'postgres' => 'postgresql',
|
121
|
-
'sqlite3' => 'sqlite3'
|
122
|
-
}
|
123
|
-
end
|
124
103
|
end
|
125
104
|
end
|
126
105
|
end
|
@@ -14,17 +14,45 @@ module Orchestration
|
|
14
14
|
return unless defined?(Mongoid)
|
15
15
|
return unless File.exist?(@env.mongoid_configuration_path)
|
16
16
|
|
17
|
-
@settings =
|
17
|
+
@settings = { clients_key => hosts_config }
|
18
18
|
end
|
19
19
|
|
20
20
|
def friendly_config
|
21
|
-
"[mongoid] #{host}:#{local_port}"
|
21
|
+
"[mongoid] #{host}:#{local_port}/#{database}"
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
+
def hosts_config
|
27
|
+
{
|
28
|
+
'default' => {
|
29
|
+
'hosts' => ["#{host}:#{port}"],
|
30
|
+
'database' => database
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def database
|
36
|
+
config
|
37
|
+
.fetch(@env.environment)
|
38
|
+
.fetch(clients_key)
|
39
|
+
.fetch('default')
|
40
|
+
.fetch('database')
|
41
|
+
end
|
42
|
+
|
43
|
+
def port
|
44
|
+
DockerCompose::MongoService::PORT
|
45
|
+
end
|
46
|
+
|
47
|
+
def clients_key
|
48
|
+
return 'clients' if config.fetch(@env.environment).key?('clients')
|
49
|
+
|
50
|
+
# Support older Mongoid versions
|
51
|
+
'sessions'
|
52
|
+
end
|
53
|
+
|
26
54
|
def config
|
27
|
-
YAML.safe_load(
|
55
|
+
@config ||= YAML.safe_load(
|
28
56
|
File.read(@env.mongoid_configuration_path), [], [], true
|
29
57
|
)
|
30
58
|
end
|
@@ -9,14 +9,35 @@ module Orchestration
|
|
9
9
|
dependencies 'mongoid'
|
10
10
|
|
11
11
|
def connection_errors
|
12
|
+
return [Moped::Errors::ConnectionFailure] if defined?(Moped)
|
13
|
+
|
12
14
|
[::Mongo::Error::NoServerAvailable]
|
13
15
|
end
|
14
16
|
|
15
17
|
def connect
|
18
|
+
silence_warnings
|
19
|
+
|
16
20
|
# REVIEW: For some reason this is extremely slow. Worth trying
|
17
21
|
# to see if there's a faster way to fail.
|
18
22
|
Mongoid.load_configuration(@configuration.settings)
|
19
|
-
!
|
23
|
+
!default_client.database_names.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def default_client
|
29
|
+
return Mongoid.default_client if Mongoid.respond_to?(:default_client)
|
30
|
+
|
31
|
+
# Support older versions of Mongoid
|
32
|
+
Mongoid.default_session
|
33
|
+
end
|
34
|
+
|
35
|
+
def silence_warnings
|
36
|
+
if defined?(Moped)
|
37
|
+
Moped.logger = Logger.new(devnull)
|
38
|
+
else
|
39
|
+
Mongoid.logger = Logger.new(devnull)
|
40
|
+
end
|
20
41
|
end
|
21
42
|
end
|
22
43
|
end
|
@@ -57,10 +57,10 @@ wait-rabbitmq:
|
|
57
57
|
|
58
58
|
docker: build push
|
59
59
|
|
60
|
-
GIT_BRANCH
|
60
|
+
GIT_BRANCH:=$(if $(BRANCH),$(BRANCH),$(shell git rev-parse --abbrev-ref HEAD))
|
61
61
|
|
62
62
|
build:
|
63
|
-
@echo "Preparing build
|
63
|
+
@echo "Preparing build from ${GIT_BRANCH}"
|
64
64
|
@mkdir -p ./docker/.build
|
65
65
|
@git show ${GIT_BRANCH}:./Gemfile > ./docker/Gemfile
|
66
66
|
@git show ${GIT_BRANCH}:./Gemfile.lock > ./docker/Gemfile.lock
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
set -u
|
3
|
-
useradd -u ${HOST_UID} -m -o owner
|
3
|
+
id owner >/dev/null 2>&1 || useradd -u ${HOST_UID} -m -o owner
|
4
4
|
mkdir -p /application/tmp/pids
|
5
5
|
chown -R owner:owner /application/tmp /application/log /application/db
|
6
|
+
rm -f /application/tmp/pids/unicorn.pid
|
6
7
|
exec gosu owner "$@"
|
data/orchestration.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'orchestration/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
url = 'https://
|
8
|
+
url = 'https://github.com/bobf/orchestration'
|
9
9
|
spec.name = 'orchestration'
|
10
10
|
spec.version = Orchestration::VERSION
|
11
11
|
spec.authors = ['Bob Farrell']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
@@ -336,7 +336,7 @@ files:
|
|
336
336
|
- lib/orchestration/version.rb
|
337
337
|
- lib/tasks/orchestration.rake
|
338
338
|
- orchestration.gemspec
|
339
|
-
homepage: https://
|
339
|
+
homepage: https://github.com/bobf/orchestration
|
340
340
|
licenses: []
|
341
341
|
metadata: {}
|
342
342
|
post_install_message:
|