envoy-proxy 0.1.4 → 0.1.5
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 +7 -3
- data/lib/envoy/client/channel.rb +13 -5
- data/lib/envoy/client/command.rb +14 -1
- data/lib/envoy/version.rb +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: b37ea6c959f8c114427789454f1b57839190d78f
|
4
|
+
data.tar.gz: 5160742eaafd4c19c7dc7d5dae52ea9f778840f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7278fc984cc99dfb7761bcaf94a2a2fcef994e468ba46ea53a36976b43c5a2a57c3ad74da662cd2b0e03bf019c5dfed11f149d24e5eb19dc43056916ec9140d0
|
7
|
+
data.tar.gz: fa1f633ac93d12a3a72fe71f21ef9767f80aef9677f263ce839fd24da2030c0b13fdb567a5af8add464566484a424635992f81212590a226315357149af6b24b
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ connection is refused.
|
|
42
42
|
|
43
43
|
Option Description Default
|
44
44
|
---------------------------------------------------------------------------
|
45
|
-
host The domain name prefix None
|
45
|
+
host The domain name prefix Last component of dir, or None
|
46
46
|
local_port The local port to use None
|
47
47
|
local_host The local host to use 127.0.0.1
|
48
48
|
server_host The server host to use p45.eu
|
@@ -50,11 +50,15 @@ connection is refused.
|
|
50
50
|
tls Use TLS in the server connections false
|
51
51
|
verbose Be noisy false
|
52
52
|
command A command to run if a local connection is refused None
|
53
|
-
delay Number of seconds to wait
|
54
|
-
after starting a command
|
53
|
+
delay Number of seconds to wait for a command to start 1
|
55
54
|
dir A directory to change to None
|
55
|
+
rails A directory to change to; contains a Rails app None
|
56
|
+
rackup A directory to change to; contains a Rack app None
|
56
57
|
log A file to log to /dev/stderr
|
57
58
|
|
59
|
+
The `rails` and `rackup` options specify `dir` and `command` options for Rails
|
60
|
+
and Rack applications, respectively.
|
61
|
+
|
58
62
|
If no host is specified, a random one is selected by the server.
|
59
63
|
If no local port is specified, a random one is selected by the client.
|
60
64
|
The command is processed for % substitions against the configuration hash,
|
data/lib/envoy/client/channel.rb
CHANGED
@@ -12,6 +12,7 @@ module Envoy
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def connection_completed
|
15
|
+
@tried_starting = nil
|
15
16
|
send_data @buffer, true
|
16
17
|
@buffer = nil
|
17
18
|
end
|
@@ -35,15 +36,22 @@ module Envoy
|
|
35
36
|
def unbind e
|
36
37
|
if e == Errno::ECONNREFUSED
|
37
38
|
if @tried_starting
|
38
|
-
|
39
|
-
|
39
|
+
if Time.now > @tried_starting + @client.options[:delay]
|
40
|
+
@client.log "Service isn't running, but starting it didn't really work out."
|
41
|
+
@client.send_object :close, @id, 502
|
42
|
+
@tried_starting = false
|
43
|
+
else
|
44
|
+
EM.add_timer 0.1 do
|
45
|
+
reconnect
|
46
|
+
end
|
47
|
+
end
|
40
48
|
elsif cmd = @client.options[:command]
|
41
49
|
cmd = cmd % @client.options
|
42
50
|
@client.log "Service doesn't seem to be running. Trying to start it now..."
|
43
|
-
@tried_starting =
|
51
|
+
@tried_starting = Time.now
|
52
|
+
p @client.options[:dir]
|
44
53
|
Dir.chdir File.expand_path(@client.options[:dir]) do
|
45
54
|
fork do
|
46
|
-
#Process.daemon(true, false)
|
47
55
|
ENV.delete("GEM_HOME")
|
48
56
|
ENV.delete("GEM_PATH")
|
49
57
|
ENV.delete("BUNDLE_BIN_PATH")
|
@@ -51,7 +59,7 @@ module Envoy
|
|
51
59
|
system cmd
|
52
60
|
end
|
53
61
|
end
|
54
|
-
EM.add_timer
|
62
|
+
EM.add_timer 0.1 do
|
55
63
|
reconnect
|
56
64
|
end
|
57
65
|
end
|
data/lib/envoy/client/command.rb
CHANGED
@@ -18,7 +18,20 @@ end
|
|
18
18
|
def load_config
|
19
19
|
if path = find_config
|
20
20
|
conf = YAML.load(File.read(path))
|
21
|
-
conf.
|
21
|
+
Array(conf).each do |conf|
|
22
|
+
if conf["rails"]
|
23
|
+
conf["dir"] = conf["rails"]
|
24
|
+
conf["pidfile"] = "tmp/pids/server.pid"
|
25
|
+
conf["command"] = "rails s -p %{local_port}"
|
26
|
+
conf["delay"] = 10
|
27
|
+
elsif conf["rackup"]
|
28
|
+
conf["dir"] = conf["rackup"]
|
29
|
+
conf["command"] = "rackup -p %{local_port}"
|
30
|
+
conf["delay"] = 10
|
31
|
+
end
|
32
|
+
conf["host"] ||= conf["dir"].split("/")[-1] if conf["dir"]
|
33
|
+
conf["dir"] = File.expand_path(conf["dir"], path + "/..") if conf["dir"]
|
34
|
+
end
|
22
35
|
else
|
23
36
|
[{"local_port" => "80"}]
|
24
37
|
end
|
data/lib/envoy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envoy-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Baum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|