Merge pull request #4124 from AdrianaHelga/AdrianaHelga-patch-1

Update services-basics.md
This commit is contained in:
Min RK
2022-10-20 10:28:07 +02:00
committed by GitHub

View File

@@ -24,7 +24,7 @@ Hub via the REST API.
## API Token basics ## API Token basics
### Create an API token ### Step 1: Generate an API token
To run such an external service, an API token must be created and To run such an external service, an API token must be created and
provided to the service. provided to the service.
@@ -43,12 +43,12 @@ generating an API token is available from the JupyterHub user interface:
![API TOKEN success page](../images/token-request-success.png) ![API TOKEN success page](../images/token-request-success.png)
### Pass environment variable with token to the Hub ### Step 2: Pass environment variable with token to the Hub
In the case of `cull_idle_servers`, it is passed as the environment In the case of `cull_idle_servers`, it is passed as the environment
variable called `JUPYTERHUB_API_TOKEN`. variable called `JUPYTERHUB_API_TOKEN`.
### Use API tokens for services and tasks that require external access ### Step 3: Use API tokens for services and tasks that require external access
While API tokens are often associated with a specific user, API tokens While API tokens are often associated with a specific user, API tokens
can be used by services that require external access for activities can be used by services that require external access for activities
@@ -62,7 +62,7 @@ c.JupyterHub.services = [
] ]
``` ```
### Restart JupyterHub ### Step 4: Restart JupyterHub
Upon restarting JupyterHub, you should see a message like below in the Upon restarting JupyterHub, you should see a message like below in the
logs: logs:
@@ -78,16 +78,15 @@ single-user servers, and only cookies can be used for authentication.
0.8 supports using JupyterHub API tokens to authenticate to single-user 0.8 supports using JupyterHub API tokens to authenticate to single-user
servers. servers.
## Configure the idle culler to run as a Hub-Managed Service ## How to configure the idle culler to run as a Hub-Managed Service
Install the idle culler: ### Step 1: Install the idle culler:
``` ```
pip install jupyterhub-idle-culler pip install jupyterhub-idle-culler
``` ```
In `jupyterhub_config.py`, add the following dictionary for the ### Step 2: In `jupyterhub_config.py`, add the following dictionary for the `idle-culler` Service to the `c.JupyterHub.services` list:
`idle-culler` Service to the `c.JupyterHub.services` list:
```python ```python
c.JupyterHub.services = [ c.JupyterHub.services = [
@@ -127,7 +126,7 @@ It now needs the scopes:
- `admin:servers` to start/stop servers - `admin:servers` to start/stop servers
``` ```
## Run `cull-idle` manually as a standalone script ## How to run `cull-idle` manually as a standalone script
Now you can run your script by providing it Now you can run your script by providing it
the API token and it will authenticate through the REST API to the API token and it will authenticate through the REST API to