Browse Source

Allow protocols to be specified, add labels to README.

pull/4/head
Chris Smith 8 years ago
parent
commit
562dc3802a
2 changed files with 15 additions and 1 deletions
  1. 13
    0
      README.md
  2. 2
    1
      generate.py

+ 13
- 0
README.md View File

@@ -12,6 +12,19 @@ known containers.
12 12
 This container monitors `etcd` for a label specifying vhosts and proxy ports,
13 13
 and puts them into a template file for nginx to use. 
14 14
 
15
+## Labels
16
+
17
+You must label any container that you wish to proxy. The following labels
18
+are understood:
19
+
20
+* `com.chameth.proxy=<port>` -- specifies the port on the container that the
21
+  proxy should connect to
22
+* `com.chameth.proxy.protocol=<protocol>` -- the protocol to use when
23
+  connecting to the container. Optional, defaults to HTTP.
24
+* `com.chameth.vhost=<host>` -- the virtual host that the proxy will accept
25
+  connections on. You can specify alternate hosts/aliases by separating them
26
+  with commas.
27
+
15 28
 ## Usage
16 29
 
17 30
 TODO: Finish this!

+ 2
- 1
generate.py View File

@@ -20,10 +20,11 @@ fetcher = etcdlib.Connection(args.etcd_host, args.etcd_port, args.etcd_prefix)
20 20
 while True:
21 21
   services = []
22 22
   domains = fetcher.get_label('com.chameth.vhost')
23
+  protocols = fetcher.get_label('com.chameth.proxy.protocol')
23 24
   for container, values in fetcher.get_label('com.chameth.proxy').items():
24 25
     networks = fetcher.get_networks(container)
25 26
     services.append({
26
-      'protocol': 'http', # TODO: Support HTTPS
27
+      'protocol': protocols[container] if container in protocols else 'http',
27 28
       'vhosts': domains[container].split(','),
28 29
       'host': next(iter(networks.values())), # TODO: Pick a bridge sensibly?
29 30
       'port': values      

Loading…
Cancel
Save