Skip to content

Commit 22ec032

Browse files
authored
Merge pull request #189 from minrk/doc-v2
doc: update sample configuration for v2
2 parents bec86ce + 7b9a506 commit 22ec032

File tree

3 files changed

+105
-176
lines changed

3 files changed

+105
-176
lines changed

docs/source/consul.md

Lines changed: 72 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -107,87 +107,84 @@ You can choose to:
107107

108108
If TraefikConsulProxy is used as an externally managed service, then make sure you follow the steps enumerated below:
109109

110-
1. Let JupyterHub know that the proxy being used is TraefikConsulProxy, using the _proxy_class_ configuration option:
110+
1. Let JupyterHub know that the proxy being used is TraefikConsulProxy, using the _proxy_class_ configuration option:
111111

112-
```python
113-
c.JupyterHub.proxy_class = "traefik_consul"
114-
```
112+
```python
113+
c.JupyterHub.proxy_class = "traefik_consul"
114+
```
115115

116-
2. Configure `TraefikConsulProxy` in **jupyterhub_config.py**
116+
2. Configure `TraefikConsulProxy` in **jupyterhub_config.py**
117117

118-
JupyterHub configuration file, _jupyterhub_config.py_ must specify at least:
118+
JupyterHub configuration file, _jupyterhub_config.py_ must specify at least:
119119

120-
- That the proxy is externally managed
121-
- The traefik api credentials
122-
- The consul credentials (if consul acl is enabled)
120+
- That the proxy is externally managed
121+
- The traefik api credentials
122+
- The consul credentials (if consul acl is enabled)
123123

124-
Example configuration:
124+
Example configuration:
125125

126-
```python
127-
# JupyterHub shouldn't start the proxy, it's already running
128-
c.TraefikConsulProxy.should_start = False
126+
```python
127+
# JupyterHub shouldn't start the proxy, it's already running
128+
c.TraefikConsulProxy.should_start = False
129129

130-
# if not the default:
131-
c.TraefikConsulProxy.consul_url = "http://consul-host:2379"
130+
# if not the default:
131+
c.TraefikConsulProxy.consul_url = "http://consul-host:2379"
132132

133-
# traefik api credentials
134-
c.TraefikConsulProxy.traefik_api_username = "abc"
135-
c.TraefikConsulProxy.traefik_api_password = "123"
133+
# traefik api credentials
134+
c.TraefikConsulProxy.traefik_api_username = "abc"
135+
c.TraefikConsulProxy.traefik_api_password = "123"
136136

137-
# consul acl token
138-
c.TraefikConsulProxy.consul_password = "456"
139-
```
140-
141-
3. Create a _toml_ file with traefik's desired static configuration
137+
# consul acl token
138+
c.TraefikConsulProxy.consul_password = "456"
139+
```
142140

143-
Before starting the traefik process, you must create a _toml_ file with the desired
144-
traefik static configuration and pass it to traefik when you launch the process.
145-
Keep in mind that in order for the routes to be stored in **consul**,
146-
this _toml_ file **must** specify consul as the provider/
141+
3. Create a _toml_ file with traefik's desired static configuration
147142

148-
- **Keep in mind that the static configuration must configure at least:**
149-
- The default entrypoint
150-
- The api entrypoint (_and authenticate it_)
151-
- The websockets protocol
152-
- The consul endpoint
143+
Before starting the traefik process, you must create a _toml_ file with the desired
144+
traefik static configuration and pass it to traefik when you launch the process.
145+
Keep in mind that in order for the routes to be stored in **consul**,
146+
this _toml_ file **must** specify consul as the provider/
153147

154-
Example:
148+
- **Keep in mind that the static configuration must configure at least:**
149+
- The default entrypoint
150+
- The api entrypoint
151+
- The consul provider
155152

156-
```
157-
defaultentrypoints = ["http"]
158-
debug = true
159-
logLevel = "ERROR"
153+
Example:
160154

155+
```toml
156+
# enable the api
161157
[api]
162-
dashboard = true
163-
entrypoint = "auth_api"
164158

165-
[wss]
166-
protocol = "http"
159+
# the public port where traefik accepts http requests
160+
[entryPoints.web]
161+
address = ":8000"
167162

168-
[entryPoints.http]
169-
address = "127.0.0.1:8000"
163+
# the port on localhost where the traefik api should be found
164+
[entryPoints.enter_api]
165+
address = "localhost:8099"
170166

171-
[entryPoints.auth_api]
172-
address = "127.0.0.1:8099"
167+
[providers.consul]
168+
# the consul username (if auth is enabled)
169+
username = "def"
170+
# the consul password (if auth is enabled)
171+
password = "456"
172+
# the consul address
173+
endpoints = ["127.0.0.1:8500"]
174+
# the prefix to use for the static configuration
175+
rootKey = "traefik"
176+
```
173177

174-
[entryPoints.auth_api.auth.basic]
175-
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
178+
````{note}
179+
If you choose to enable consul Access Control Lists (ACLs) to secure the UI, API, CLI, service communications, and agent communications, you can use this *toml* file to pass the credentials to traefik, e.g.:
176180

177-
[consul]
178-
endpoint = "127.0.0.1:8500"
179-
prefix = "traefik/"
180-
watch = true
181-
```
181+
```toml
182+
[providers.consul]
183+
password = "admin"
184+
...
185+
```
182186

183-
````{note}
184-
If you choose to enable consul Access Control Lists (ACLs) to secure the UI, API, CLI, service communications, and agent communications, you can use this *toml* file to pass the credentials to traefik, e.g.:
185-
```
186-
[consul]
187-
password = "admin"
188-
...
189-
```
190-
````
187+
````
191188

192189
## Example setup
193190

@@ -196,8 +193,6 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
196193
1. Configure the proxy through the JupyterHub configuration file, _jupyterhub_config.py_, e.g.:
197194

198195
```python
199-
from jupyterhub_traefik_proxy import TraefikConsulProxy
200-
201196
# mark the proxy as externally managed
202197
c.TraefikConsulProxy.should_start = False
203198

@@ -208,10 +203,10 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
208203
c.TraefikConsulProxy.traefik_api_username = "123"
209204

210205
# consul url where it accepts client requests
211-
c.TraefikConsulProxy.consul_url = "path/to/rules.toml"
206+
c.TraefikConsulProxy.consul_url = "http://127.0.0.1:8500"
212207

213208
# configure JupyterHub to use TraefikConsulProxy
214-
c.JupyterHub.proxy_class = TraefikConsulProxy
209+
c.JupyterHub.proxy_class = "traefik_consul"
215210
```
216211

217212
```{note}
@@ -233,40 +228,27 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
233228

234229
3. Create a traefik static configuration file, _traefik.toml_, e.g:.
235230

236-
```
237-
# the default entrypoint
238-
defaultentrypoints = ["http"]
239-
240-
# the api entrypoint
231+
```toml
232+
# enable the api
241233
[api]
242-
dashboard = true
243-
entrypoint = "auth_api"
244234

245-
# websockets protocol
246-
[wss]
247-
protocol = "http"
248-
249-
# the port on localhost where traefik accepts http requests
250-
[entryPoints.http]
235+
# the public port where traefik accepts http requests
236+
[entryPoints.web]
251237
address = ":8000"
252238

253-
# the port on localhost where the traefik api and dashboard can be found
254-
[entryPoints.auth_api]
255-
address = ":8099"
256-
257-
# authenticate the traefik api entrypoint
258-
[entryPoints.auth_api.auth.basic]
259-
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
239+
# the port on localhost where the traefik api should be found
240+
[entryPoints.enter_api]
241+
address = "localhost:8099"
260242

261-
[consul]
262-
# the consul acl token (if acl is enabled)
243+
[providers.consul]
244+
# the username (if auth is enabled)
245+
username = "def"
246+
# the password (if auth is enabled)
263247
password = "456"
264248
# the consul address
265-
endpoint = "127.0.0.1:8500"
249+
endpoints = ["127.0.0.1:8500"]
266250
# the prefix to use for the static configuration
267-
prefix = "traefik/"
268-
# watch consul for changes
269-
watch = true
251+
rootKey = "traefik"
270252
```
271253

272254
4. Start traefik with the configuration specified above, e.g.:

docs/source/etcd.md

Lines changed: 27 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -149,49 +149,35 @@ If TraefikEtcdProxy is used as an externally managed service, then make sure you
149149
- **Keep in mind that the static configuration must configure at least:**
150150

151151
- The default entrypoint
152-
- The api entrypoint (_and authenticate it_)
153-
- The websockets protocol
154-
- The etcd endpoint
152+
- The api entrypoint
153+
- The etcd provider
155154

156155
- **Example:**
157156

158-
```
159-
defaultentrypoints = ["http"]
160-
debug = true
161-
logLevel = "ERROR"
162-
163-
[api]
164-
dashboard = true
165-
entrypoint = "auth_api"
166-
167-
[wss]
168-
protocol = "http"
157+
```toml
158+
[api]
169159

170-
[entryPoints.http]
171-
address = "127.0.0.1:8000"
160+
[entryPoints.http]
161+
address = "127.0.0.1:8000"
172162

173-
[entryPoints.auth_api]
174-
address = "127.0.0.1:8099"
163+
[entryPoints.auth_api]
164+
address = "127.0.0.1:8099"
175165

176-
[entryPoints.auth_api.auth.basic]
177-
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
178-
179-
[etcd]
180-
endpoint = "127.0.0.1:2379"
181-
prefix = "/jupyterhub"
182-
useapiv3 = true
183-
watch = true
166+
[providers.etcd]
167+
endpoints = [ "127.0.0.1:2379",]
168+
rootKey = "traefik"
184169
```
185170

186-
```{note}
171+
````{note}
187172
**If you choose to enable the authentication on etcd**, you can use this *toml* file to pass the credentials to traefik, e.g.:
188173

189-
[etcd]
174+
```toml
175+
[providers.etcd]
190176
username = "root"
191177
password = "admin"
192-
endpoint = "127.0.0.1:2379"
193178
...
194-
```
179+
```
180+
````
195181

196182
## Example setup
197183

@@ -200,8 +186,6 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
200186
1. Configure the proxy through the JupyterHub configuration file, _jupyterhub_config.py_, e.g.:
201187

202188
```python
203-
from jupyterhub_traefik_proxy import TraefikEtcdProxy
204-
205189
# mark the proxy as externally managed
206190
c.TraefikEtcdProxy.should_start = False
207191

@@ -215,7 +199,7 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
215199
c.TraefikEtcdProxy.etcd_url = "http://127.0.0.1:2379"
216200

217201
# configure JupyterHub to use TraefikEtcdProxy
218-
c.JupyterHub.proxy_class = TraefikEtcdProxy
202+
c.JupyterHub.proxy_class = "traefik_etcd"
219203
```
220204

221205
```{note}
@@ -240,44 +224,27 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
240224

241225
3. Create a traefik static configuration file, _traefik.toml_, e.g:.
242226

243-
```
244-
# the default entrypoint
245-
defaultentrypoints = ["http"]
246-
247-
# the api entrypoint
227+
```toml
228+
# enable the api
248229
[api]
249-
dashboard = true
250-
entrypoint = "auth_api"
251-
252-
# websockets protocol
253-
[wss]
254-
protocol = "http"
255230

256-
# the port on localhost where traefik accepts http requests
257-
[entryPoints.http]
231+
# the public port where traefik accepts http requests
232+
[entryPoints.web]
258233
address = ":8000"
259234

260-
# the port on localhost where the traefik api and dashboard can be found
261-
[entryPoints.auth_api]
262-
address = ":8099"
263-
264-
# authenticate the traefik api entrypoint
265-
[entryPoints.auth_api.auth.basic]
266-
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
235+
# the port on localhost where the traefik api should be found
236+
[entryPoints.enter_api]
237+
address = "localhost:8099"
267238

268-
[etcd]
239+
[providers.etcd]
269240
# the etcd username (if auth is enabled)
270241
username = "def"
271242
# the etcd password (if auth is enabled)
272243
password = "456"
273244
# the etcd address
274-
endpoint = "127.0.0.1:2379"
245+
endpoints = ["127.0.0.1:2379"]
275246
# the prefix to use for the static configuration
276-
prefix = "/traefik/"
277-
# tell etcd to use the v3 version of the api
278-
useapiv3 = true
279-
# watch etcd for changes
280-
watch = true
247+
rootKey = "traefik"
281248
```
282249

283250
4. Start traefik with the configuration specified above, e.g.:

0 commit comments

Comments
 (0)