Browse Source

Use an override file for config + update README.

Closes #6
pull/9/head
Chris Smith 8 years ago
parent
commit
fd70200aba
4 changed files with 58 additions and 18 deletions
  1. 1
    0
      .gitignore
  2. 35
    5
      README.md
  3. 18
    0
      docker-compose.override.example.yml
  4. 4
    13
      docker-compose.yml

+ 1
- 0
.gitignore View File

1
+/docker-compose.override.yml

+ 35
- 5
README.md View File

7
 More details will be added here in due course. For now, the full process
7
 More details will be added here in due course. For now, the full process
8
 is described in [this blog post](https://www.chameth.com/2016/05/21/docker-automatic-nginx-proxy).
8
 is described in [this blog post](https://www.chameth.com/2016/05/21/docker-automatic-nginx-proxy).
9
 
9
 
10
-## Adding extra config to Nginx
10
+## Getting started
11
+
12
+The out-of-the-box setup uses [Lexicon](https://github.com/AnalogJ/lexicon)
13
+to perform DNS updates. This will work if you use one DNS provider for all
14
+the domains you wish to use, and Lexicon supports that provider. If that
15
+is the case, then getting started is very easy:
16
+
17
+ 1. Copy docker-compose.override.example.yml to docker-compose.override.yml
18
+ 2. Change the e-mail address, provider, and provider auth details
19
+ 3. Run `docker-compose up -d`
20
+
21
+If you have existing containers with the appropriate labels, the certificates
22
+will be requested for them straight away, and proxy rules added. To launch
23
+a new container and have it be proxied, add the following labels:
24
+
25
+    com.chameth.proxy=<port>
26
+    com.chameth.proxy.protocol=<protocol> # defaults to http
27
+    com.chameth.vhost=<primary vhost>,<secondary vhost>,<...>
28
+
29
+For example:
30
+
31
+    docker run \
32
+        --label com.chameth.proxy=80 \
33
+        --label com.chameth.vhost=example.domain.com \
34
+        tutum/hello-world
35
+
36
+It may take a minute or two for the certificate to be obtained and for
37
+Nginx to be reconfigured. You can see output from the various tools
38
+by running `docker-compose logs -f`.
39
+
40
+## Advanced / Tips and Tricks
41
+
42
+### Adding extra config to Nginx
11
 
43
 
12
 Out of the box, the Nginx server will only handle HTTPS requests,
44
 Out of the box, the Nginx server will only handle HTTPS requests,
13
 with a very minimal config. The [extra](extra/) directory contains
45
 with a very minimal config. The [extra](extra/) directory contains
17
 Once you have the services running, you can copy additional config
49
 Once you have the services running, you can copy additional config
18
 using the cp command:
50
 using the cp command:
19
 
51
 
20
-```
21
-docker cp file.conf autoproxy_nginx:/etc/nginx/conf.d/
22
-```
52
+    docker cp file.conf autoproxy_nginx:/etc/nginx/conf.d/
23
 
53
 
24
 The following config files are available in the extra directory:
54
 The following config files are available in the extra directory:
25
 
55
 
35
    disable old protocols and ciphers, enable stapling, etc. This will prevent
65
    disable old protocols and ciphers, enable stapling, etc. This will prevent
36
    access from older browsers and operating systems!
66
    access from older browsers and operating systems!
37
 
67
 
38
-## Hosting static content
68
+### Hosting static content
39
 
69
 
40
 If you're serving static content, it's not desirable to have lots of
70
 If you're serving static content, it's not desirable to have lots of
41
 instances of nginx running just to handle requests from the proxy.
71
 instances of nginx running just to handle requests from the proxy.

+ 18
- 0
docker-compose.override.example.yml View File

1
+---
2
+version: '2'
3
+
4
+services:
5
+
6
+  letsencrypt-lexicon:
7
+    environment:
8
+      # For testing purposes, use the Let's Encrypt staging server.
9
+      # Remove this for production use!
10
+      - STAGING=yes
11
+      # The e-mail address to provide to Let's Encrypt.
12
+      - EMAIL=your@email.addr
13
+      # The Lexicon provider to use
14
+      - PROVIDER=cloudflare
15
+      # Provider-specific authentication details
16
+      - LEXICON_CLOUDFLARE_USERNAME=your@email.addr
17
+      - LEXICON_CLOUDFLARE_TOKEN=1234567890123456789012345678901234567890
18
+

+ 4
- 13
docker-compose.yml View File

9
 #   com.chameth.proxy.protocol=http [optional, defaults to http]
9
 #   com.chameth.proxy.protocol=http [optional, defaults to http]
10
 #
10
 #
11
 # To prove ownership of domains to Let's Encrypt, we add a DNS entry when
11
 # To prove ownership of domains to Let's Encrypt, we add a DNS entry when
12
-# required. You will need to configure one of the letsencrypt-* services
13
-# below to make these changes.
12
+# required. This requires you to provide authentication details (e-mail
13
+# address, API key, password, etc). These should be specified in a
14
+# docker-compose.override.yml file.
14
 
15
 
15
 version: '2'
16
 version: '2'
16
 
17
 
67
       - etcd
68
       - etcd
68
 
69
 
69
   # letsencrypt-lexicon obtains Let's Encrypt certificates by modifying
70
   # letsencrypt-lexicon obtains Let's Encrypt certificates by modifying
70
-  # DNS records. It supports several major cloud DNS providers. You
71
-  # need to set the provider and auth tokens below.
71
+  # DNS records. It supports several major cloud DNS providers.
72
   letsencrypt-lexicon:
72
   letsencrypt-lexicon:
73
     image: csmith/letsencrypt-lexicon:latest
73
     image: csmith/letsencrypt-lexicon:latest
74
     container_name: autoproxy_letsencrypt-lexicon
74
     container_name: autoproxy_letsencrypt-lexicon
75
     restart: always
75
     restart: always
76
     volumes:
76
     volumes:
77
       - letsencrypt-data:/letsencrypt
77
       - letsencrypt-data:/letsencrypt
78
-    environment:
79
-      - STAGING=yes
80
-      - EMAIL=your@email.addr
81
-      - PROVIDER=cloudflare
82
-      - LEXICON_CLOUDFLARE_USERNAME=your@email.addr
83
-      - LEXICON_CLOUDFLARE_TOKEN=1234567890123456789012345678901234567890
84
 
78
 
85
   # letsencrypt-generic uses a user-defined hook to update DNS entries.
79
   # letsencrypt-generic uses a user-defined hook to update DNS entries.
86
   # You need to supply your own hook, available at /dns/hook. See the
80
   # You need to supply your own hook, available at /dns/hook. See the
92
   #  volumes:
86
   #  volumes:
93
   #    - letsencrypt-data:/letsencrypt
87
   #    - letsencrypt-data:/letsencrypt
94
   #    - /my/hook/script:/dns/hook
88
   #    - /my/hook/script:/dns/hook
95
-  #  environment:
96
-  #    - STAGING=yes
97
-  #    - EMAIL=your@email.addr
98
 
89
 
99
   # service-nginx reads proxy information and vhosts from etcd and
90
   # service-nginx reads proxy information and vhosts from etcd and
100
   # creates an nginx vhost config to enable SSL-terminated reverse
91
   # creates an nginx vhost config to enable SSL-terminated reverse

Loading…
Cancel
Save