@@ -107,87 +107,84 @@ You can choose to:
107
107
108
108
If TraefikConsulProxy is used as an externally managed service, then make sure you follow the steps enumerated below:
109
109
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:
111
111
112
- ``` python
113
- c.JupyterHub.proxy_class = " traefik_consul"
114
- ```
112
+ ``` python
113
+ c.JupyterHub.proxy_class = " traefik_consul"
114
+ ```
115
115
116
- 2 . Configure ` TraefikConsulProxy ` in ** jupyterhub_config.py**
116
+ 2 . Configure `TraefikConsulProxy` in ** jupyterhub_config.py**
117
117
118
- JupyterHub configuration file, _ jupyterhub_config.py_ must specify at least:
118
+ JupyterHub configuration file , _jupyterhub_config.py_ must specify at least:
119
119
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)
123
123
124
- Example configuration:
124
+ Example configuration:
125
125
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
129
129
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"
132
132
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"
136
136
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
+ ```
142
140
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
147
142
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/
153
147
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
155
152
156
- ```
157
- defaultentrypoints = ["http"]
158
- debug = true
159
- logLevel = "ERROR"
153
+ Example:
160
154
155
+ ```toml
156
+ # enable the api
161
157
[api]
162
- dashboard = true
163
- entrypoint = "auth_api"
164
158
165
- [wss]
166
- protocol = "http"
159
+ # the public port where traefik accepts http requests
160
+ [entryPoints.web]
161
+ address = " :8000"
167
162
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"
170
166
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
+ ```
173
177
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.:
176
180
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
+ ```
182
186
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
+ ````
191
188
192
189
# # Example setup
193
190
@@ -196,8 +193,6 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
196
193
1 . Configure the proxy through the JupyterHub configuration file , _jupyterhub_config.py_, e.g.:
197
194
198
195
```python
199
- from jupyterhub_traefik_proxy import TraefikConsulProxy
200
-
201
196
# mark the proxy as externally managed
202
197
c.TraefikConsulProxy.should_start = False
203
198
@@ -208,10 +203,10 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
208
203
c.TraefikConsulProxy.traefik_api_username = " 123"
209
204
210
205
# 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 "
212
207
213
208
# configure JupyterHub to use TraefikConsulProxy
214
- c.JupyterHub.proxy_class = TraefikConsulProxy
209
+ c.JupyterHub.proxy_class = " traefik_consul "
215
210
```
216
211
217
212
```{note}
@@ -233,40 +228,27 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
233
228
234
229
3 . Create a traefik static configuration file, _ traefik.toml_ , e.g:.
235
230
236
- ```
237
- # the default entrypoint
238
- defaultentrypoints = ["http"]
239
-
240
- # the api entrypoint
231
+ ``` toml
232
+ # enable the api
241
233
[api ]
242
- dashboard = true
243
- entrypoint = "auth_api"
244
234
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 ]
251
237
address = " :8000"
252
238
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"
260
242
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)
263
247
password = " 456"
264
248
# the consul address
265
- endpoint = "127.0.0.1:8500"
249
+ endpoints = [ " 127.0.0.1:8500" ]
266
250
# the prefix to use for the static configuration
267
- prefix = "traefik/"
268
- # watch consul for changes
269
- watch = true
251
+ rootKey = " traefik"
270
252
```
271
253
272
254
4 . Start traefik with the configuration specified above, e.g.:
0 commit comments