diff --git a/config/clusters/cloudbank/staging.values.yaml b/config/clusters/cloudbank/staging.values.yaml index 60ca46718b..02f8198cb1 100644 --- a/config/clusters/cloudbank/staging.values.yaml +++ b/config/clusters/cloudbank/staging.values.yaml @@ -1,9 +1,5 @@ jupyterhub: custom: - docs_service: - enabled: true - repo: https://github.com/jupyterhub/nbgitpuller - branch: gh-pages 2i2c: add_staff_user_ids_to_admin_users: true add_staff_user_ids_of_type: "google" diff --git a/docs/howto/customize/docs-service.md b/docs/howto/customize/docs-service.md deleted file mode 100644 index 96d4d2f13b..0000000000 --- a/docs/howto/customize/docs-service.md +++ /dev/null @@ -1,34 +0,0 @@ -# Connect static web content with the hub - -The 2i2c hubs can be configured to provide static web content as a [JupyterHub service](https://jupyterhub.readthedocs.io/en/stable/reference/services.html), available -at `https:///services/docs`. This can be a great tool to provide hub-specific documentation right from inside the hub. - -```{figure} ../../images/docs-service.png -``` - -To enable the docs service service for a hub: - -1. Mark it as *enabled* by setting `jupyterhub.custom.docs_service.enabled` to *True* in the - appropriate file under `config/clusters/`. -2. Specify the GitHub repository where the static HTML files are hosted, by setting `jupyterhub.custom.docs_service.repo`. -3. Specify the GitHub branch of the respository where the static HTML files are hosted, by setting `jupyterhub.custom.docs_service.docs_service.branch`. - -Example config: - -```yaml - jupyterhub: - custom: - docs_service: - enabled: true - repo: https://github.com/ - branch: -``` - -```{note} - -Depending on what Static Site Generator has been used to generate the website's static content, it **may** or **may not** use relative paths routing by default. -For example, [Sphinx](https://www.sphinx-doc.org/en/master/) handles relative paths by default, whereas, [Hugo](https://gohugo.io/) leaves all [relative URLs unchanged](https://gohugo.io/content-management/urls/#relative-urls). - -However, having relative URLS is a **must** in order for the hub docs service to work. Please check with the docs of your SSG of choice and enable relative URLs if they -aren't enabled already. -``` diff --git a/docs/howto/features/static-sites.md b/docs/howto/features/static-sites.md new file mode 100644 index 0000000000..7c10abb920 --- /dev/null +++ b/docs/howto/features/static-sites.md @@ -0,0 +1,83 @@ +# Deploy authenticated static websites along the hub + +We can deploy *authenticated* static websites on the same domain as the hub +that is only accessible to users who have access to the hub. The source +for these come from git repositories that should contain rendered HTML, +and will be updated every 5 minutes. They can be under any prefix on the +same domain as the hub (such as `/docs`, `/textbook`, etc). + +You can enable this with the following config in the `.values.yaml` +file for your hub. + +```yaml + +dex: + # Enable authentication + enabled: true + hubHostName: + +staticSites: + enabled: true + repo: + branch: + host: + path: + +jupyterhub: + hub: + services: + dex: + url: http://dex:5556 + oauth_redirect_url: https:///services/dex/callback + oauth_no_confirm: true + oauth2-proxy: + url: http://dex:9000 + +``` + +```{note} +We manually configure the hub services instead of autogenerating +them in our deploy scripts. This leads to some additional copy-pasting and +duplication, but keeps our config explicit and simple. +``` + +## Example + +Here's a sample that hosts the data8 textbook under `https://staging.2i2c.cloud/textbook`: + +```yaml +dex: + enabled: true + hubHostName: staging.2i2c.cloud + +staticSites: + enabled: true + repo: https://github.com/inferentialthinking/inferentialthinking.github.io + branch: master + host: staging.2i2c.cloud + path: /textbook + +jupyterhub: + hub: + services: + dex: + url: http://dex:5556 + oauth_redirect_uri: https://staging.2i2c.cloud/services/dex/callback + oauth_no_confirm: true + oauth2-proxy: + url: http://dex:9000 +``` + +This clones the [repo]( https://github.com/inferentialthinking/inferentialthinking.github.io), +checks out the `master` branch and keeps it up to date by doing a +`git pull` every 5 minutes. It is made available under `/textbook`, +and requires users be logged-in to the hub before they can access it. + +### Note on relative URLs + +Depending on what Static Site Generator has been used to generate the website's static content, it **may** or **may not** use relative paths routing by default. +For example, [Sphinx](https://www.sphinx-doc.org/en/master/) handles relative paths by default, whereas, [Hugo](https://gohugo.io/) leaves all [relative URLs unchanged](https://gohugo.io/content-management/urls/#relative-urls). + +However, having relative URLS is a **must** in order for the hub docs service to work. Please check with the docs of your SSG of choice and enable relative URLs if they +aren't enabled already. +``` \ No newline at end of file diff --git a/docs/images/docs-service.png b/docs/images/docs-service.png deleted file mode 100644 index d5b6ec49cc..0000000000 Binary files a/docs/images/docs-service.png and /dev/null differ diff --git a/helm-charts/basehub/values.schema.yaml b/helm-charts/basehub/values.schema.yaml index 333cd6ad1f..9109a8db15 100644 --- a/helm-charts/basehub/values.schema.yaml +++ b/helm-charts/basehub/values.schema.yaml @@ -189,7 +189,6 @@ properties: required: - singleuserAdmin - cloudResources - - docs_service - 2i2c properties: homepage: @@ -297,20 +296,6 @@ properties: properties: enabled: type: boolean - docs_service: - type: object - additionalProperties: false - required: - - enabled - - repo - - branch - properties: - enabled: - type: boolean - repo: - type: string - branch: - type: string 2i2c: type: object additionalProperties: false diff --git a/helm-charts/basehub/values.yaml b/helm-charts/basehub/values.yaml index 124281b087..35fe0d301b 100644 --- a/helm-charts/basehub/values.yaml +++ b/helm-charts/basehub/values.yaml @@ -11,7 +11,6 @@ dex: staticSites: enabled: false branch: main - azureFile: enabled: false pv: @@ -62,10 +61,6 @@ jupyterhub: projectId: "" scratchBucket: enabled: false - docs_service: - enabled: false - repo: "" - branch: "" 2i2c: # Should 2i2c engineering staff user IDs be injected to the admin_users # configuration of the JupyterHub's authenticator by our custom @@ -459,12 +454,7 @@ jupyterhub: if authenticator_class == "github" and c.Authenticator.allowed_users: print("WARNING: hub.config.JupyterHub.authenticator_class was set to github and c.Authenticator.allowed_users was set, custom 2i2c jupyterhub config is now resetting allowed_users to an empty set.") c.Authenticator.allowed_users = set() - 05-add-docs-service-if-enabled: | - from z2jh import get_config - - if get_config("custom.docs_service.enabled"): - c.JupyterHub.services.append({"name": "docs", "url": "http://docs-service"}) - 06-gh-teams: | + 05-gh-teams: | from textwrap import dedent from tornado import gen, web from oauthenticator.github import GitHubOAuthenticator