Skip to content

Commit

Permalink
Merge pull request #154 from minrk/deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk authored Feb 22, 2023
2 parents 011559c + e57bb60 commit 9b6bcef
Show file tree
Hide file tree
Showing 13 changed files with 335 additions and 180 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
# Run "pytest tests" for various Python versions
pytest:
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
# Keep running even if one variation of the job fail
fail-fast: false
Expand Down
32 changes: 16 additions & 16 deletions docs/source/consul.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,30 @@ You can choose to:
3. By **default**, TraefikConsulProxy assumes consul accepts client requests on the official **default** consul port `8500` for client requests.
```python
c.TraefikConsulProxy.kv_url = "http://127.0.0.1:8500"
c.TraefikConsulProxy.consul_url = "http://127.0.0.1:8500"
```
If the consul cluster is deployed differently than using the consul defaults, then you **must** pass the consul url to the proxy using
the `kv_url` option in *jupyterhub_config.py*:
If the consul cluster is deployed differently than using the consul defaults, then you **must** pass the consul url to the proxy using
the `consul_url` option in *jupyterhub_config.py*:
```python
c.TraefikConsulProxy.kv_url = "scheme://hostname:port"
c.TraefikConsulProxy.consul_url = "scheme://hostname:port"
```
```{note}
**TraefikConsulProxy does not manage the consul cluster** and assumes it is up and running before the proxy itself starts.
However, based on how consul is configured and started, TraefikConsulProxy needs to be told about
However, based on how consul is configured and started, TraefikConsulProxy needs to be told about
some consul configuration details, such as:
* consul **address** where it accepts client requests
```
c.TraefikConsulProxy.kv_url="scheme://hostname:port"
```python
c.TraefikConsulProxy.consul_url = "scheme://hostname:port"
```
* consul **credentials** (if consul has acl enabled)
```
c.TraefikConsulProxy.kv_password="123"
```python
c.TraefikConsulProxy.consul_password = "123"
```
Checkout the [consul documentation](https://learn.hashicorp.com/consul/)
Checkout the [consul documentation](https://learn.hashicorp.com/consul/)
to find out more about possible consul configuration options.
```
Expand All @@ -118,14 +118,14 @@ If TraefikConsulProxy is used as an externally managed service, then make sure y
c.TraefikConsulProxy.should_start = False
# if not the default:
c.TraefikConsulProxy.kv_url = "http://consul-host:2379"
c.TraefikConsulProxy.consul_url = "http://consul-host:2379"
# traefik api credentials
c.TraefikConsulProxy.traefik_api_username = "abc"
c.TraefikConsulProxy.traefik_api_password = "123"
# consul acl token
c.TraefikConsulProxy.kv_password = "456"
c.TraefikConsulProxy.consul_password = "456"
```

3. Create a *toml* file with traefik's desired static configuration
Expand Down Expand Up @@ -198,17 +198,17 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
c.TraefikConsulProxy.traefik_api_username = "123"
# consul url where it accepts client requests
c.TraefikConsulProxy.kv_url = "path/to/rules.toml"
c.TraefikConsulProxy.consul_url = "path/to/rules.toml"
# configure JupyterHub to use TraefikConsulProxy
c.JupyterHub.proxy_class = TraefikConsulProxy
```

```{note}
If you intend to enable consul acl, add the acl token to *jupyterhub_config.py* under *kv_password*:
If you intend to enable consul acl, add the acl token to *jupyterhub_config.py* under *consul_password*:
# consul token
c.TraefikConsulProxy.kv_password = "456"
c.TraefikConsulProxy.consul_password = "456"
```
2. Starts the agent in development mode on the default port on localhost. e.g.:
Expand Down Expand Up @@ -242,7 +242,7 @@ This is an example setup for using JupyterHub and TraefikConsulProxy managed by
# the port on localhost where the traefik api and dashboard can be found
[entryPoints.auth_api]
address = ":8099"
# authenticate the traefik api entrypoint
[entryPoints.auth_api.auth.basic]
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
Expand Down
34 changes: 17 additions & 17 deletions docs/source/etcd.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,36 @@ You can choose to:
3. By **default**, TraefikEtcdProxy assumes etcd accepts client requests on the official **default** etcd port `2379` for client requests.

```python
c.TraefikEtcdProxy.kv_url = "http://127.0.0.1:2379"
c.TraefikEtcdProxy.etcd_url = "http://127.0.0.1:2379"
```

If the etcd cluster is deployed differently than using the etcd defaults, then you **must** pass the etcd url to the proxy using
the `kv_url` option in *jupyterhub_config.py*:
If the etcd cluster is deployed differently than using the etcd defaults, then you **must** pass the etcd url to the proxy using
the `etcd_url` option in *jupyterhub_config.py*:

```python
c.TraefikEtcdProxy.kv_url = "scheme://hostname:port"
c.TraefikEtcdProxy.etcd_url = "scheme://hostname:port"
```

```{note}

1. **TraefikEtcdProxy does not manage the etcd cluster** and assumes it is up and running before the proxy itself starts.

However, based on how etcd is configured and started, TraefikEtcdProxy needs to be told about
However, based on how etcd is configured and started, TraefikEtcdProxy needs to be told about
some etcd configuration details, such as:
* etcd **address** where it accepts client requests
```
c.TraefikEtcdProxy.kv_url="scheme://hostname:port"
c.TraefikEtcdProxy.etcd_url="scheme://hostname:port"
```
* etcd **credentials** (if etcd has authentication enabled)
```
c.TraefikEtcdProxy.kv_username="abc"
c.TraefikEtcdProxy.kv_password="123"
c.TraefikEtcdProxy.etcd_username="abc"
c.TraefikEtcdProxy.etcd_password="123"
```

2. Etcd has two API versions: the API V3 and the API V2. Traefik suggests using Etcd API V3,
2. Etcd has two API versions: the API V3 and the API V2. Traefik suggests using Etcd API V3,
because the API V2 won't be supported in the future.

Checkout the [etcd documentation](https://coreos.com/etcd/docs/latest/op-guide/configuration.html)
Checkout the [etcd documentation](https://coreos.com/etcd/docs/latest/op-guide/configuration.html)
to find out more about possible etcd configuration options.
```

Expand All @@ -124,15 +124,15 @@ If TraefikEtcdProxy is used as an externally managed service, then make sure you
c.TraefikEtcdProxy.should_start = False

# if not the default:
c.TraefikEtcdProxy.kv_url = "http://etcd-host:2379"
c.TraefikEtcdProxy.etcd_url = "http://etcd-host:2379"

# traefik api credentials
c.TraefikEtcdProxy.traefik_api_username = "abc"
c.TraefikEtcdProxy.traefik_api_password = "123"

# etcd credentials
c.TraefikEtcdProxy.kv_username = "def"
c.TraefikEtcdProxy.kv_password = "456"
c.TraefikEtcdProxy.etcd_username = "def"
c.TraefikEtcdProxy.etcd_password = "456"
```

3. Create a *toml* file with traefik's desired static configuration
Expand Down Expand Up @@ -207,7 +207,7 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
c.TraefikEtcdProxy.traefik_api_username = "123"
# etcd url where it accepts client requests
c.TraefikEtcdProxy.kv_url = "path/to/rules.toml"
c.TraefikEtcdProxy.etcd_url = "http://127.0.0.1:2379"
# configure JupyterHub to use TraefikEtcdProxy
c.JupyterHub.proxy_class = TraefikEtcdProxy
Expand All @@ -218,9 +218,9 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
If you intend to enable authentication on etcd, add the etcd credentials to *jupyterhub_config.py*:
# etcd username
c.TraefikEtcdProxy.kv_username = "def"
c.TraefikEtcdProxy.etcd_username = "def"
# etcd password
c.TraefikEtcdProxy.kv_password = "456"
c.TraefikEtcdProxy.etcd_password = "456"
```
2. Start a single-note etcd cluster on the default port on localhost. e.g.:
Expand Down Expand Up @@ -255,7 +255,7 @@ This is an example setup for using JupyterHub and TraefikEtcdProxy managed by an
# the port on localhost where the traefik api and dashboard can be found
[entryPoints.auth_api]
address = ":8099"
# authenticate the traefik api entrypoint
[entryPoints.auth_api.auth.basic]
users = [ "abc:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./",]
Expand Down
20 changes: 9 additions & 11 deletions docs/source/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can choose to:
Traefik's configuration is divided into two parts:

* The **static** configuration (loaded only at the beginning)
* The **dynamic** configuration (can be hot-reloaded, without restarting the proxy),
* The **dynamic** configuration (can be hot-reloaded, without restarting the proxy),
where the routing table will be updated continuously.

Traefik allows us to have one file for the static configuration file (`traefik.toml` or `traefik.yaml`) and one or several files for the routes, that traefik would watch.
Expand All @@ -55,20 +55,20 @@ By **default**, Traefik will search for `traefik.toml` and `rules.toml` in the f
You can override this in TraefikFileProviderProxy, by modifying the **static_config_file** argument:

```python
c.TraefikFileProviderProxy.static_config_file="/path/to/static_config_filename.toml"
c.TraefikFileProviderProxy.static_config_file = "/path/to/static_config_filename.toml"
```

Similarly, you can override the dynamic configuration file by modifying the **dynamic_config_file** argument:

```python
c.TraefikFileProviderProxy.dynamic_config_file="/path/to/dynamic_config_filename.toml"
c.TraefikFileProviderProxy.dynamic_config_file = "/path/to/dynamic_config_filename.toml"
```

```{note}

* **When JupyterHub starts the proxy**, it writes the static config once, then only edits the dynamic config file.
* **When JupyterHub starts the proxy**, it writes the static config once, then only edits the dynamic config file.

* **When JupyterHub does not start the proxy**, the user is totally responsible for the static config and
* **When JupyterHub does not start the proxy**, the user is totally responsible for the static config and
JupyterHub is responsible exclusively for the routes.

* **When JupyterHub does not start the proxy**, the user should tell `traefik` to get its dynamic configuration
Expand All @@ -79,15 +79,14 @@ will be managed by JupyterHub. This allows e.g., the administrator to configure

## Externally managed TraefikFileProviderProxy

When TraefikFileProviderProxy is externally managed, service managers like [systemd](https://www.freedesktop.org/wiki/Software/systemd/)
When TraefikFileProviderProxy is externally managed, service managers like [systemd](https://www.freedesktop.org/wiki/Software/systemd/)
or [docker](https://www.docker.com/) will be responsible for starting and stopping the proxy.

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

1. Let JupyterHub know that the proxy being used is TraefikFileProviderProxy, using the *proxy_class* configuration option:
```python
from jupyterhub_traefik_proxy.fileprovider import TraefikFileProviderProxy
c.JupyterHub.proxy_class = TraefikFileProviderProxy
c.JupyterHub.proxy_class = "traefik_file"
```

2. Configure `TraefikFileProviderProxy` in **jupyterhub_config.py**
Expand Down Expand Up @@ -152,13 +151,12 @@ If TraefikFileProviderProxy is used as an externally managed service, then make
* Check `tests/config_files/traefik.toml` for an example.

## Example setup

This is an example setup for using JupyterHub and TraefikFileProviderProxy managed by another service than JupyterHub.

1. Configure the proxy through the JupyterHub configuration file, *jupyterhub_config.py*, e.g.:

```python
from jupyterhub_traefik_proxy import TraefikFileProviderProxy

# mark the proxy as externally managed
c.TraefikFileProviderProxy.should_start = False
Expand All @@ -173,7 +171,7 @@ This is an example setup for using JupyterHub and TraefikFileProviderProxy manag
c.TraefikFileProviderProxy.dynamic_config_file = "/var/run/traefik/rules.toml"

# configure JupyterHub to use TraefikFileProviderProxy
c.JupyterHub.proxy_class = TraefikFileProviderProxy
c.JupyterHub.proxy_class = "traefik_file"
```

2. Create a traefik static configuration file, *traefik.toml*, e.g.:
Expand Down
Loading

0 comments on commit 9b6bcef

Please sign in to comment.