dory 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dory +6 -1
- data/lib/dory/config.rb +7 -1
- data/lib/dory/docker_service.rb +13 -1
- data/lib/dory/proxy.rb +21 -5
- data/lib/dory/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71cac368fe70a08b19c094885c8aadf9272036db
|
4
|
+
data.tar.gz: 3e265b1c03f00a374847bcdc60e85a1be40d76f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfd8f71d1ae253e8877503f84ce891d57f731dc4c4703343a4c101fe2b6cc95b81953c3ef7de50f61a3c0b06a352a29e3f3dc373e5de5c933838e616760f394
|
7
|
+
data.tar.gz: 8bb53d03fedd6da7c654431e12a1f99c844654f654a9c682002a362361e8628da5889cf2a7c1847afc6a20efc2719f17b7a5a43a2dcd16f06e577b2d9052b7ff
|
data/bin/dory
CHANGED
@@ -188,8 +188,13 @@ class DoryBin < Thor
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
+
aliases = {
|
192
|
+
'start' => 'up',
|
193
|
+
'stop' => 'down',
|
194
|
+
}
|
195
|
+
|
191
196
|
if !ARGV.empty? && %w[-v --version].include?(ARGV.first)
|
192
197
|
puts "Dory - Version: #{Dory::VERSION}"
|
193
198
|
else
|
194
|
-
DoryBin.start(ARGV)
|
199
|
+
DoryBin.start(ARGV.map { |a| aliases.keys.include?(a) ? aliases[a] : a })
|
195
200
|
end
|
data/lib/dory/config.rb
CHANGED
@@ -25,7 +25,8 @@ module Dory
|
|
25
25
|
:nginx_proxy:
|
26
26
|
:enabled: true
|
27
27
|
:container_name: dory_dinghy_http_proxy
|
28
|
-
:
|
28
|
+
:https_enabled: true
|
29
|
+
:ssl_certs_dir: '' # leave as empty string to use default certs
|
29
30
|
:resolv:
|
30
31
|
:enabled: true
|
31
32
|
:nameserver: 127.0.0.1
|
@@ -43,6 +44,7 @@ module Dory
|
|
43
44
|
[:dnsmasq, :nginx_proxy, :resolv].each do |service|
|
44
45
|
default_settings[:dory][service].merge!(config_file_settings[:dory][service] || {})
|
45
46
|
end
|
47
|
+
default_settings[:dory][:debug] = config_file_settings[:dory][:debug]
|
46
48
|
default_settings
|
47
49
|
else
|
48
50
|
self.default_settings
|
@@ -57,5 +59,9 @@ module Dory
|
|
57
59
|
def self.write_default_settings_file(filename = self.filename)
|
58
60
|
self.write_settings(self.default_yaml, filename, is_yaml: true)
|
59
61
|
end
|
62
|
+
|
63
|
+
def self.debug?
|
64
|
+
self.settings[:dory][:debug]
|
65
|
+
end
|
60
66
|
end
|
61
67
|
end
|
data/lib/dory/docker_service.rb
CHANGED
@@ -5,8 +5,16 @@ module Dory
|
|
5
5
|
def start
|
6
6
|
unless self.running?
|
7
7
|
success = if self.container_exists?
|
8
|
-
|
8
|
+
if Dory::Config.debug?
|
9
|
+
puts "[DEBUG] Container '#{self.container_name}' already exists. " \
|
10
|
+
"Starting with '#{self.start_cmd}'"
|
11
|
+
end
|
12
|
+
Sh.run_command(self.start_cmd).success?
|
9
13
|
else
|
14
|
+
if Dory::Config.debug?
|
15
|
+
puts "[DEBUG] Container '#{self.container_name}' does not exist. " \
|
16
|
+
"Creating/starting with '#{self.run_cmd}'"
|
17
|
+
end
|
10
18
|
Sh.run_command(self.run_cmd).success?
|
11
19
|
end
|
12
20
|
unless success
|
@@ -52,5 +60,9 @@ module Dory
|
|
52
60
|
end
|
53
61
|
!self.container_exists?
|
54
62
|
end
|
63
|
+
|
64
|
+
def start_cmd
|
65
|
+
"docker start #{Shellwords.escape(self.container_name)}"
|
66
|
+
end
|
55
67
|
end
|
56
68
|
end
|
data/lib/dory/proxy.rb
CHANGED
@@ -4,8 +4,10 @@ module Dory
|
|
4
4
|
class Proxy
|
5
5
|
extend Dory::DockerService
|
6
6
|
|
7
|
-
def self.
|
8
|
-
|
7
|
+
def self.dory_http_proxy_image_name
|
8
|
+
setting = Dory::Config.settings[:dory][:nginx_proxy][:image]
|
9
|
+
return setting if setting
|
10
|
+
'freedomben/dory-http-proxy:2.0.4.2'
|
9
11
|
end
|
10
12
|
|
11
13
|
def self.container_name
|
@@ -21,12 +23,26 @@ module Dory
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
def self.tls_arg
|
27
|
+
if [:tls_enabled, :ssl_enabled, :https_enabled].any? { |s|
|
28
|
+
Dory::Config.settings[:dory][:nginx_proxy][s]
|
29
|
+
}
|
30
|
+
"-p 443:443"
|
31
|
+
else
|
32
|
+
''
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
24
36
|
def self.run_cmd
|
25
|
-
"docker run -d -p 80:80
|
26
|
-
"
|
37
|
+
"docker run -d -p 80:80 #{self.tls_arg} #{self.certs_arg} "\
|
38
|
+
"-v /var/run/docker.sock:/tmp/docker.sock -e " \
|
27
39
|
"'CONTAINER_NAME=#{Shellwords.escape(self.container_name)}' --name " \
|
28
40
|
"'#{Shellwords.escape(self.container_name)}' " \
|
29
|
-
"#{Shellwords.escape(
|
41
|
+
"#{Shellwords.escape(dory_http_proxy_image_name)}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.start_cmd
|
45
|
+
"docker start #{Shellwords.escape(self.container_name)}"
|
30
46
|
end
|
31
47
|
end
|
32
48
|
end
|
data/lib/dory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '8.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '8.2'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: codeclimate-test-reporter
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
152
|
version: '0'
|
139
153
|
requirements: []
|
140
154
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.2.5
|
142
156
|
signing_key:
|
143
157
|
specification_version: 4
|
144
158
|
summary: slackbot_frd provides a dirt-simple framework for implementing one or more
|