orchestration 0.3.3 → 0.3.4
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 +5 -5
- data/README.md +1 -1
- data/TODO +2 -12
- data/config/locales/en.yml +10 -13
- data/lib/orchestration/docker_compose/{application_service.rb → app_service.rb} +6 -5
- data/lib/orchestration/docker_compose/configuration.rb +69 -0
- data/lib/orchestration/docker_compose/database_service.rb +18 -25
- data/lib/orchestration/docker_compose/install_generator.rb +113 -0
- data/lib/orchestration/docker_compose/mongo_service.rb +15 -5
- data/lib/orchestration/docker_compose/nginx_proxy_service.rb +3 -2
- data/lib/orchestration/docker_compose/rabbitmq_service.rb +9 -5
- data/lib/orchestration/docker_compose.rb +3 -2
- data/lib/orchestration/environment.rb +32 -11
- data/lib/orchestration/errors.rb +3 -1
- data/lib/orchestration/file_helpers.rb +10 -5
- data/lib/orchestration/install_generator.rb +38 -51
- data/lib/orchestration/services/{application → app}/configuration.rb +5 -5
- data/lib/orchestration/services/{application → app}/healthcheck.rb +4 -4
- data/lib/orchestration/services/app.rb +13 -0
- data/lib/orchestration/services/configuration_base.rb +3 -1
- data/lib/orchestration/services/database/adapters/mysql2.rb +19 -0
- data/lib/orchestration/services/database/adapters/postgresql.rb +20 -0
- data/lib/orchestration/services/database/adapters/sqlite3.rb +4 -0
- data/lib/orchestration/services/database/configuration.rb +23 -13
- data/lib/orchestration/services/healthcheck_base.rb +1 -1
- data/lib/orchestration/services/nginx_proxy/configuration.rb +7 -2
- data/lib/orchestration/services.rb +1 -1
- data/lib/orchestration/templates/Makefile.erb +99 -40
- data/lib/orchestration/templates/application.mk.erb +14 -0
- data/lib/orchestration/templates/deploy.mk.erb +34 -0
- data/lib/orchestration/templates/docker-compose.override.yml.erb +1 -0
- data/lib/orchestration/templates/env.erb +6 -0
- data/lib/orchestration/templates/unicorn.rb.erb +1 -1
- data/lib/orchestration/terminal.rb +17 -1
- data/lib/orchestration/version.rb +1 -1
- data/lib/orchestration.rb +2 -1
- data/lib/tasks/orchestration.rake +7 -17
- metadata +13 -8
- data/lib/orchestration/docker_compose/services.rb +0 -59
- data/lib/orchestration/services/application.rb +0 -13
@@ -0,0 +1,6 @@
|
|
1
|
+
# Set VIRTUAL_HOST to whatever host(s) your application will be available on.
|
2
|
+
# See https://github.com/jwilder/nginx-proxy for more details on this variable.
|
3
|
+
VIRTUAL_HOST=localhost
|
4
|
+
|
5
|
+
# Set the port your application will be available on (via Nginx proxy)
|
6
|
+
LISTEN_PORT=3000
|
@@ -15,6 +15,10 @@ module Orchestration
|
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
class Terminal
|
18
|
+
def initialize(settings)
|
19
|
+
@settings = settings
|
20
|
+
end
|
21
|
+
|
18
22
|
def write(desc, message, color_name = nil, newline = true)
|
19
23
|
output = newline ? "#{message}\n" : message.to_s
|
20
24
|
STDOUT.print colorize(desc, output, color_name)
|
@@ -28,12 +32,20 @@ module Orchestration
|
|
28
32
|
result
|
29
33
|
end
|
30
34
|
|
35
|
+
def ask_setting(setting, default = nil)
|
36
|
+
return unless @settings.get(setting).nil?
|
37
|
+
|
38
|
+
write(:setup, t("settings.#{setting}.description"))
|
39
|
+
prompt = t("settings.#{setting}.prompt")
|
40
|
+
@settings.set(setting, read(prompt, default))
|
41
|
+
end
|
42
|
+
|
31
43
|
private
|
32
44
|
|
33
45
|
def prompt(message, default)
|
34
46
|
return "(#{message}): " if default.nil?
|
35
47
|
|
36
|
-
"(#{message}) [#{
|
48
|
+
"(#{message}) [#{t('default')}: #{default}]: "
|
37
49
|
end
|
38
50
|
|
39
51
|
def colorize(desc, message, color_name)
|
@@ -48,5 +60,9 @@ module Orchestration
|
|
48
60
|
.colorize(mode: :default, color: color)
|
49
61
|
.concat(' ' + message)
|
50
62
|
end
|
63
|
+
|
64
|
+
def t(key)
|
65
|
+
I18n.t("orchestration.#{key}")
|
66
|
+
end
|
51
67
|
end
|
52
68
|
end
|
data/lib/orchestration.rb
CHANGED
@@ -8,10 +8,11 @@ require 'rails'
|
|
8
8
|
I18n.load_path += Dir[File.join(File.expand_path('..', __dir__),
|
9
9
|
'config', 'locales', '**', '*.yml')]
|
10
10
|
|
11
|
+
require 'orchestration/file_helpers'
|
12
|
+
|
11
13
|
require 'orchestration/docker_compose'
|
12
14
|
require 'orchestration/environment'
|
13
15
|
require 'orchestration/errors'
|
14
|
-
require 'orchestration/file_helpers'
|
15
16
|
require 'orchestration/install_generator'
|
16
17
|
require 'orchestration/railtie'
|
17
18
|
require 'orchestration/service_check'
|
@@ -8,51 +8,41 @@ namespace :orchestration do
|
|
8
8
|
Orchestration::InstallGenerator.start
|
9
9
|
end
|
10
10
|
|
11
|
-
namespace :
|
12
|
-
desc I18n.t('orchestration.
|
11
|
+
namespace :app do
|
12
|
+
desc I18n.t('orchestration.rake.app.wait')
|
13
13
|
task :wait do
|
14
|
-
Orchestration::Services::
|
14
|
+
Orchestration::Services::App::Healthcheck.start
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
namespace :database do
|
19
|
-
desc I18n.t('orchestration.database.wait')
|
19
|
+
desc I18n.t('orchestration.rake.database.wait')
|
20
20
|
task :wait do
|
21
21
|
Orchestration::Services::Database::Healthcheck.start
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
namespace :mongo do
|
26
|
-
desc I18n.t('orchestration.mongo.wait')
|
26
|
+
desc I18n.t('orchestration.rake.mongo.wait')
|
27
27
|
task :wait do
|
28
28
|
Orchestration::Services::Mongo::Healthcheck.start
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
namespace :nginx_proxy do
|
33
|
-
desc I18n.t('orchestration.
|
33
|
+
desc I18n.t('orchestration.rake.nginx_proxy.wait')
|
34
34
|
task :wait do
|
35
35
|
Orchestration::Services::NginxProxy::Healthcheck.start
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
namespace :rabbitmq do
|
40
|
-
desc I18n.t('orchestration.rabbitmq.wait')
|
40
|
+
desc I18n.t('orchestration.rake.rabbitmq.wait')
|
41
41
|
task :wait do
|
42
42
|
Orchestration::Services::RabbitMQ::Healthcheck.start
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
namespace :docker do
|
47
|
-
desc I18n.t('orchestration.rake.docker.username')
|
48
|
-
task :username do
|
49
|
-
STDOUT.write(
|
50
|
-
Orchestration::Environment.new.settings.get('docker.username')
|
51
|
-
)
|
52
|
-
STDOUT.flush
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
46
|
namespace :listener do
|
57
47
|
desc I18n.t('orchestration.rake.listener.wait')
|
58
48
|
task :wait do
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -307,12 +307,13 @@ files:
|
|
307
307
|
- lib/Rakefile
|
308
308
|
- lib/orchestration.rb
|
309
309
|
- lib/orchestration/docker_compose.rb
|
310
|
-
- lib/orchestration/docker_compose/
|
310
|
+
- lib/orchestration/docker_compose/app_service.rb
|
311
|
+
- lib/orchestration/docker_compose/configuration.rb
|
311
312
|
- lib/orchestration/docker_compose/database_service.rb
|
313
|
+
- lib/orchestration/docker_compose/install_generator.rb
|
312
314
|
- lib/orchestration/docker_compose/mongo_service.rb
|
313
315
|
- lib/orchestration/docker_compose/nginx_proxy_service.rb
|
314
316
|
- lib/orchestration/docker_compose/rabbitmq_service.rb
|
315
|
-
- lib/orchestration/docker_compose/services.rb
|
316
317
|
- lib/orchestration/environment.rb
|
317
318
|
- lib/orchestration/errors.rb
|
318
319
|
- lib/orchestration/file_helpers.rb
|
@@ -320,9 +321,9 @@ files:
|
|
320
321
|
- lib/orchestration/railtie.rb
|
321
322
|
- lib/orchestration/service_check.rb
|
322
323
|
- lib/orchestration/services.rb
|
323
|
-
- lib/orchestration/services/
|
324
|
-
- lib/orchestration/services/
|
325
|
-
- lib/orchestration/services/
|
324
|
+
- lib/orchestration/services/app.rb
|
325
|
+
- lib/orchestration/services/app/configuration.rb
|
326
|
+
- lib/orchestration/services/app/healthcheck.rb
|
326
327
|
- lib/orchestration/services/configuration_base.rb
|
327
328
|
- lib/orchestration/services/database.rb
|
328
329
|
- lib/orchestration/services/database/adapters.rb
|
@@ -347,7 +348,11 @@ files:
|
|
347
348
|
- lib/orchestration/settings.rb
|
348
349
|
- lib/orchestration/templates/Dockerfile.erb
|
349
350
|
- lib/orchestration/templates/Makefile.erb
|
351
|
+
- lib/orchestration/templates/application.mk.erb
|
352
|
+
- lib/orchestration/templates/deploy.mk.erb
|
353
|
+
- lib/orchestration/templates/docker-compose.override.yml.erb
|
350
354
|
- lib/orchestration/templates/entrypoint.sh.erb
|
355
|
+
- lib/orchestration/templates/env.erb
|
351
356
|
- lib/orchestration/templates/nginx.tmpl.erb
|
352
357
|
- lib/orchestration/templates/unicorn.rb.erb
|
353
358
|
- lib/orchestration/templates/yaml.bash.erb
|
@@ -374,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
374
379
|
version: '0'
|
375
380
|
requirements: []
|
376
381
|
rubyforge_project:
|
377
|
-
rubygems_version: 2.
|
382
|
+
rubygems_version: 2.7.6
|
378
383
|
signing_key:
|
379
384
|
specification_version: 4
|
380
385
|
summary: Docker orchestration toolkit
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Orchestration
|
4
|
-
module DockerCompose
|
5
|
-
class Services
|
6
|
-
def initialize(env, options = {})
|
7
|
-
@env = env
|
8
|
-
@configurations = {
|
9
|
-
'application' => options.fetch(:application, nil),
|
10
|
-
'database' => options.fetch(:database, nil),
|
11
|
-
'mongo' => options.fetch(:mongo, nil),
|
12
|
-
'rabbitmq' => options.fetch(:rabbitmq, nil),
|
13
|
-
'nginx-proxy' => options.fetch(:nginx_proxy, nil)
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
def structure
|
18
|
-
{
|
19
|
-
'version' => '3.7',
|
20
|
-
'services' => services,
|
21
|
-
'volumes' => {
|
22
|
-
@env.public_volume => nil
|
23
|
-
}
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
def services
|
28
|
-
Hash[filtered_services]
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def filtered_services
|
34
|
-
services_enabled.compact.reject { |_name, definition| definition.nil? }
|
35
|
-
end
|
36
|
-
|
37
|
-
def services_available
|
38
|
-
[
|
39
|
-
{ name: 'application', class: ApplicationService },
|
40
|
-
{ name: 'database', class: DatabaseService },
|
41
|
-
{ name: 'mongo', class: MongoService },
|
42
|
-
{ name: 'rabbitmq', class: RabbitMQService },
|
43
|
-
{ name: 'nginx-proxy', class: NginxProxyService }
|
44
|
-
]
|
45
|
-
end
|
46
|
-
|
47
|
-
def services_enabled
|
48
|
-
services_available.map do |service|
|
49
|
-
config = @configurations[service[:name]]
|
50
|
-
# REVIEW: This is mostly here for testing - we may not need it once
|
51
|
-
# everything's implemented.
|
52
|
-
next if config.nil?
|
53
|
-
|
54
|
-
[service[:name], service[:class].new(config).definition]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Orchestration
|
4
|
-
module Services
|
5
|
-
module Application
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'net/http'
|
11
|
-
|
12
|
-
require 'orchestration/services/application/configuration'
|
13
|
-
require 'orchestration/services/application/healthcheck'
|