### Helm Version Output Example Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-prerequisites.html Example output showing the version details of a Helm installation. This helps in confirming the installed version and build information. ```text version.BuildInfo{Version:"v3.4.0", GitCommit:"7090a89efc8a18f3d8178bf47d2462450349a004", GitTreeState:"clean", GoVersion:"go1.14.10"} ``` -------------------------------- ### Start Local BinderHub Webserver (Mocked Hub) Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Run the BinderHub webserver locally with a mocked JupyterHub. This setup is for developing the user interface without a full Kubernetes or JupyterHub deployment. ```bash python3 -m binderhub -f testing/local-binder-mocked-hub/binderhub_config.py ``` -------------------------------- ### Install BinderHub and Documentation Tools Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Install BinderHub and necessary documentation tools using pip. Ensure you have Python 3 installed. ```bash python3 -m pip install -r docs/requirements.txt python3 -m pip install sphinx-autobuild ``` -------------------------------- ### Start Minikube Cluster Source: https://binderhub.readthedocs.io/en/latest/contribute.html Starts a Minikube Kubernetes cluster. Ensure you have a virtual machine hypervisor like VirtualBox installed. ```bash minikube start ``` -------------------------------- ### Install BinderHub and Documentation Tools Source: https://binderhub.readthedocs.io/en/latest/contribute.html Install BinderHub and necessary documentation tools using pip. This includes installing requirements for documentation and the sphinx-autobuild package. ```bash python3 -m pip install -r docs/requirements.txt python3 -m pip install sphinx-autobuild ``` -------------------------------- ### Install BinderHub Locally Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Install BinderHub as a Python package with its development requirements. ```bash python3 -m pip install -e ".[pycurl]" -r dev-requirements.txt ``` -------------------------------- ### Start Local BinderHub Webserver (Kubernetes Hub) Source: https://binderhub.readthedocs.io/en/latest/contribute.html Start BinderHub with a testing configuration file designed for Kubernetes integration. ```bash python3 -m binderhub -f testing/local-binder-k8s-hub/binderhub_config.py ``` -------------------------------- ### Install Helm 3 Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-prerequisites.html Installs Helm version 3 using the official installation script. This is the recommended method for simplicity. ```bash curl -sf https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 ``` -------------------------------- ### Start BinderHub with Testing Configuration Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Launch BinderHub using the specified testing configuration file. ```bash python3 -m binderhub -f testing/local-binder-k8s-hub/binderhub_config.py ``` -------------------------------- ### Install NodeJS Dependencies Source: https://binderhub.readthedocs.io/en/latest/contribute.html Install the necessary NodeJS dependencies from the package.json file. ```bash npm install ``` -------------------------------- ### Kubectl Version Output Example Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-prerequisites.html Example output displaying the client and server versions of kubectl. This is useful for verifying compatibility with your Kubernetes cluster. ```text Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:32:58Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"} ``` -------------------------------- ### Start Minikube with More Memory Source: https://binderhub.readthedocs.io/en/latest/contribute.html Starts the Minikube VM with 8GB of memory allocated, which can be necessary for resource-intensive builds. ```bash minikube start --memory 8192 ``` -------------------------------- ### Install Helm Source: https://binderhub.readthedocs.io/en/latest/contribute.html Installs the Helm package manager for Kubernetes. This script fetches and executes the official Helm installation script. ```bash curl -sf https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 ``` -------------------------------- ### Install kubectl Source: https://binderhub.readthedocs.io/en/latest/contribute.html Downloads and installs the kubectl command-line tool for interacting with Kubernetes clusters. This command fetches the latest stable version. ```bash curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x kubectl sudo mv kubectl /usr/local/bin/ ``` -------------------------------- ### Install BinderHub Python Package Source: https://binderhub.readthedocs.io/en/latest/contribute.html Install BinderHub as an editable Python package locally. ```bash python3 -m pip install -e . ``` -------------------------------- ### Install Helm 3 Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-prerequisites.rst.txt Use this command to install Helm, the package manager for Kubernetes. This script downloads and installs the latest version of Helm 3. ```bash curl -sf https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 ``` -------------------------------- ### Install NodeJS Dependencies Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Install the necessary NodeJS dependencies for BinderHub's frontend development. ```bash npm install ``` -------------------------------- ### Verify Helm Installation Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-prerequisites.rst.txt Check if Helm has been installed correctly by running the 'helm version' command. This verifies the installation and displays the installed Helm version. ```bash helm version ``` -------------------------------- ### Verify Kubectl Installation Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-prerequisites.rst.txt Confirm that kubectl is installed and configured correctly by running 'kubectl version'. This command displays the client and server versions of kubectl. ```bash kubectl version ``` -------------------------------- ### Start BinderHub Application Source: https://binderhub.readthedocs.io/en/latest/reference/app.html Starts the main event loop for the BinderHub application. This method can be overridden in subclasses. ```python start(_run_loop =True_)# ``` -------------------------------- ### Launcher Launch Method Source: https://binderhub.readthedocs.io/en/latest/reference/launcher.html The core `launch` method for starting a server for a given image and user. It handles user creation, server spawning, token generation, and returns server details. ```python async launch(_image_ , _username_ , _server_name =''_, _repo_url =''_, _extra_args =None_, _event_callback =None_) ``` -------------------------------- ### Install BinderHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Install the BinderHub Helm chart using the specified version and configuration files. Ensure to replace placeholders with your chosen name and namespace. ```bash helm upgrade \ \ jupyterhub/binderhub \ --install \ --version=1.0.0-0.dev.git.3673.h040c9bbe \ --create-namespace \ --namespace= \ -f secret.yaml \ -f config.yaml ``` -------------------------------- ### Configure Show Config JSON for BinderHub Source: https://binderhub.readthedocs.io/en/latest/reference/app.html Similar to `show_config`, but dumps the configuration to stdout in JSON format instead of starting the application. ```python show_config_json c.BinderHub.show_config_json = Bool(False)# ``` -------------------------------- ### Launcher Configuration Examples Source: https://binderhub.readthedocs.io/en/latest/reference/launcher.html Configuration options for the Launcher class, such as enabling named servers, setting timeouts, and defining retry mechanisms. ```python allow_named_servers c.Launcher.allow_named_servers = Bool(False) ``` ```python launch_timeout c.Launcher.launch_timeout = Int(600) ``` ```python named_server_limit_per_user c.Launcher.named_server_limit_per_user = Int(0) ``` ```python retries c.Launcher.retries = Int(4) ``` ```python retry_delay c.Launcher.retry_delay = Int(4) ``` -------------------------------- ### Example OVH Container Registry Configuration Source: https://binderhub.readthedocs.io/en/latest/setup-binderhub.html An example of the `config.yaml` for OVH Container Registry with specific values for hash, region, and project prefix. ```yaml config: BinderHub: use_registry: true image_prefix: abcde.gra7.container-registry.ovh.net/myproject/binder- DockerRegistry: url: https://abcde.gra7.container-registry.ovh.net token_url: https://abcde.gra7.container-registry.ovh.net/service/token?service=harbor-registry ``` -------------------------------- ### Configure Logging to File Source: https://binderhub.readthedocs.io/en/latest/reference/app.html This example demonstrates how to configure BinderHub to write logs to a file in addition to the console. It shows how to define a new file handler and specify which loggers should use it. ```python c.Application.logging_config = { "handlers": { "file": { "class": "logging.FileHandler", "level": "DEBUG", "filename": "", } }, "loggers": { "": { "level": "DEBUG", # NOTE: if you don't list the default "console" # handler here then it will be disabled "handlers": ["console", "file"], }, }, } ``` -------------------------------- ### Install Development Requirements Source: https://binderhub.readthedocs.io/en/latest/contribute.html Installs necessary development tools like pytest and chartpress using pip. ```bash python3 -m pip install -r dev-requirements.txt ``` -------------------------------- ### mybinder.org Deployment Configuration Example Source: https://binderhub.readthedocs.io/en/latest/debug.html Configuration for mybinder.org deployment where BinderHub is a dependency, nesting JupyterHub under the 'binderhub' key. ```yaml binderhub: registry: ... jupyterhub: hub: ... ``` -------------------------------- ### Configure Show Config for BinderHub Source: https://binderhub.readthedocs.io/en/latest/reference/app.html When set to True, BinderHub will dump its configuration to stdout instead of starting the application. ```python show_config c.BinderHub.show_config = Bool(False)# ``` -------------------------------- ### JupyterHub Only Configuration Example Source: https://binderhub.readthedocs.io/en/latest/_sources/debug.rst.txt Shows the configuration structure when deploying only JupyterHub, where many Hub-related keys become top-level. This is relevant for understanding differences when customizing BinderHub. ```yaml auth: type: "github" hub: resources: memory: limit: "1G" ``` -------------------------------- ### Verify Kubectl Installation Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-prerequisites.html Checks the installed version of kubectl, the Kubernetes command-line tool. This ensures you can interact with your Kubernetes cluster. ```bash kubectl version ``` -------------------------------- ### Install BinderHub Python Package Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Install BinderHub as an editable Python package. This is useful for developing the Python components. ```bash python3 -m pip install -e . ``` -------------------------------- ### Waiting Event Structure Source: https://binderhub.readthedocs.io/en/latest/_sources/api.rst.txt Emitted when a build pod has started and is waiting to initialize. ```json { "phase": "waiting", "message": "Human readable message" } ``` -------------------------------- ### Install BinderHub with Pycurl and Dev Requirements Source: https://binderhub.readthedocs.io/en/latest/contribute.html Locally install BinderHub as a Python package, including pycurl support and development requirements. ```bash python3 -m pip install -e ".[pycurl]" -r dev-requirements.txt ``` -------------------------------- ### Launcher Pre-Launch Hook Configuration Source: https://binderhub.readthedocs.io/en/latest/reference/launcher.html Configuration for an optional `pre_launch_hook` function that allows custom checks before a user's server starts. ```python pre_launch_hook c.Launcher.pre_launch_hook = Callable(None) ``` -------------------------------- ### Login to Azure Account Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-registry.html Use this command to log in to your Azure account. Ensure you have the Azure CLI installed. ```bash az login ``` -------------------------------- ### Waiting Event Structure Source: https://binderhub.readthedocs.io/en/latest/api.html Emitted when a build pod has started and the system is waiting for it to become active. ```python {'phase': 'waiting', 'message': 'Human readable message'} ``` -------------------------------- ### Install cert-manager Source: https://binderhub.readthedocs.io/en/latest/https.html Install cert-manager using kubectl to manage TLS certificates. For older Kubernetes versions, use the --validate=false flag. ```bash kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.8.1/cert-manager.yaml ``` -------------------------------- ### Nested Chart Dependency Example (mybinder.org) Source: https://binderhub.readthedocs.io/en/latest/_sources/debug.rst.txt Demonstrates a nested chart dependency structure, similar to how mybinder.org is deployed, where 'binderhub' becomes a top-level key and 'jupyterhub' is nested below it. ```yaml binderhub: registry: ... jupyterhub: hub: ... ``` -------------------------------- ### Install JupyterHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/contribute.html Install the JupyterHub Helm chart into your Kubernetes cluster's current namespace. Append --auth if developing against a non-public BinderHub. ```bash # Append --auth here if you want to develop against a non-public BinderHub # that relies on JupyterHub's configured Authenticator to decide if the users # are allowed access or not. ./testing/local-binder-k8s-hub/install-jupyterhub-chart ``` -------------------------------- ### Install/Upgrade BinderHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Installs or upgrades the BinderHub Helm chart in the current Kubernetes namespace. Ensure validation passed before running this command. ```bash helm upgrade --install binderhub-test helm-chart/binderhub \ --values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \ --set config.BinderHub.hub_url=http://$(minikube ip):30902 \ --set config.GitHubRepoProvider.access_token=$GITHUB_ACCESS_TOKEN echo "BinderHub inside the Minikube based Kubernetes cluster is starting up at http://$(minikube ip):30901" ``` -------------------------------- ### Get Built Image Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Retrieves a pre-built image for a given specification and repository provider. This function utilizes Tornado's GET request functionality. The 'spec' parameter's required information varies by repository provider. ```python get(_provider_prefix_ , __unescaped_spec_) ``` -------------------------------- ### BinderHub Chart Configuration Example Source: https://binderhub.readthedocs.io/en/latest/_sources/debug.rst.txt Illustrates the indentation structure for BinderHub chart configuration when it includes the JupyterHub chart. Ensure JupyterHub specific values are nested under the 'jupyterhub' key. ```yaml # BinderHub chart config is top-level registry: username: "a-username" password: "xxxx" # JupyterHub chart config is now under "jupyterhub" key # This key is dictated by the name of the included chart jupyterhub: hub: resources: memory: limit: '1G' ``` -------------------------------- ### Complete BinderHub Configuration with CORS Enabled Source: https://binderhub.readthedocs.io/en/latest/_sources/cors.rst.txt An example of a `config.yaml` file with CORS enabled, including hub URL and ingress settings. Ensure you replace placeholder values with your specific URLs and names. ```yaml config: BinderHub: hub_url: https:// # e.g. https://hub.binder.example.com cors_allow_origin: '*' jupyterhub: hub: config: BinderSpawner: cors_allow_origin: '*' ingress: enabled: true hosts: - # e.g. hub.binder.example.com annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: "true" cert-manager.io/issuer: letsencrypt-production https: enabled: true type: nginx tls: - secretName: -tls # e.g. hub-binder-example-com-tls hosts: - # e.g. hub.binder.example.com ingress: enabled: true hosts: - # e.g. binder.example.com annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: "true" cert-manager.io/issuer: letsencrypt-production https: enabled: true type: nginx tls: - secretName: -tls # e.g. binder-example-com-tls hosts: - # e.g. binder.example.com ``` -------------------------------- ### BinderHub Configuration with HTTPS and CORS Source: https://binderhub.readthedocs.io/en/latest/cors.html An example of a `config.yaml` file that includes CORS configuration along with HTTPS settings for BinderHub and JupyterHub. ```yaml config: BinderHub: hub_url: https:// # e.g. https://hub.binder.example.com cors_allow_origin: '*' jupyterhub: hub: config: BinderSpawner: cors_allow_origin: '*' ingress: enabled: true hosts: - # e.g. hub.binder.example.com annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: "true" cert-manager.io/issuer: letsencrypt-production https: enabled: true type: nginx tls: - secretName: -tls # e.g. hub-binder-example-com-tls hosts: - # e.g. hub.binder.example.com ingress: enabled: true hosts: - # e.g. binder.example.com annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: "true" cert-manager.io/issuer: letsencrypt-production https: enabled: true type: nginx tls: - secretName: -tls # e.g. binder-example-com-tls hosts: - # e.g. binder.example.com ``` -------------------------------- ### Upgrade BinderHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Command to upgrade or install the BinderHub Helm chart with custom configurations. Ensure you replace with your release name. ```bash helm upgrade \ \ jupyterhub/binderhub \ --install \ --version=1.0.0-0.dev.git.3673.h040c9bbe \ -f secret.yaml \ -f config.yaml ``` -------------------------------- ### Install JupyterHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Deploy the JupyterHub Helm chart into your Kubernetes cluster's current namespace. Consider appending --auth for non-public BinderHubs. ```bash # Append --auth here if you want to develop against a non-public BinderHub # that relies on JupyterHub's configured Authenticator to decide if the users # are allowed access or not. ./testing/local-binder-k8s-hub/install-jupyterhub-chart ``` -------------------------------- ### Create Service Principal and Get Credentials Source: https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-registry.html This command creates a Service Principal, assigns the `AcrPush` role, and directly outputs the password and AppID as tab-separated values. These are crucial for BinderHub's authentication. ```bash SERVICE_PRINCIPAL_PASSWORD=$(az ad sp create-for-rbac --name --role AcrPush --scopes --query password --output tsv) SERVICE_PRINCIPAL_ID=$(az ad sp show --id http:// --query appId --output tsv) ``` -------------------------------- ### Launcher.launch Source: https://binderhub.readthedocs.io/en/latest/reference/launcher.html Launches a server for a given image, creating a temporary user if authentication is not enabled. It spawns a server, generates a token, and returns details about the launched server. ```APIDOC ## `Launcher.launch()` ### Description Launch a server for a given image. * creates a temporary user on the Hub if authentication is not enabled * spawns a server for temporary/authenticated user * generates a token * returns a dict containing: - `url`: the URL of the server - `image`: image spec - `repo_url`: the url of the repo - `extra_args`: Dictionary of extra arguments passed to the server - `token`: the token for the server ### Parameters * **image** (string) - Required - The image to launch. * **username** (string) - Required - The username for whom to launch the server. * **server_name** (string) - Optional - The name of the server to launch. Defaults to '' (anonymous server). * **repo_url** (string) - Optional - The URL of the repository to associate with the server. Defaults to '' (no repository). * **extra_args** (dict) - Optional - A dictionary of extra arguments to pass to the server. Defaults to None. * **event_callback** (callable) - Optional - A callback function to receive launch events. Defaults to None. ### Returns A dictionary containing server details: `url`, `image`, `repo_url`, `extra_args`, and `token`. ``` -------------------------------- ### Ready Event Structure Source: https://binderhub.readthedocs.io/en/latest/_sources/api.rst.txt Emitted when the notebook server is ready, providing the URL and authentication token. ```json { "phase": "ready", "message": "Human readable message", "url": "full-url-of-notebook-server", "token": "notebook-server-token" } ``` -------------------------------- ### Create BinderHub Configuration Directory Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Creates a directory for BinderHub configuration files and navigates into it. This is the first step before creating any configuration files. ```bash mkdir binderhub cd binderhub ``` -------------------------------- ### Build JS and CSS Bundles (Watch Mode) Source: https://binderhub.readthedocs.io/en/latest/contribute.html Create the JS and CSS bundles for BinderHub's webserver, with watch mode enabled for continuous rebuilding. ```bash npm run webpack:watch ``` -------------------------------- ### Upgrade BinderHub with Configuration Changes Source: https://binderhub.readthedocs.io/en/latest/_sources/cors.rst.txt Command to apply your configuration changes using Helm. Replace `` and `` with your specific values. ```bash helm upgrade jupyterhub/binderhub --version= -f secret.yaml -f config.yaml ``` -------------------------------- ### Build Documentation with Sphinx Autobuild Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Build the documentation locally using sphinx-autobuild. Changes to source files will trigger automatic re-builds. ```bash sphinx-autobuild docs/source docs/_build/html ``` -------------------------------- ### Delete JupyterHub Helm Chart Source: https://binderhub.readthedocs.io/en/latest/contribute.html Cleanup the JupyterHub Helm chart that was installed in Kubernetes. ```bash helm delete binderhub-test ``` -------------------------------- ### Launching Event Structure Source: https://binderhub.readthedocs.io/en/latest/api.html Emitted when the repository has been built and the system is waiting for the hub to launch the server. ```python {'phase': 'launching', 'message': 'user friendly message'} ``` -------------------------------- ### BuildHandler.get Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Retrieves a built image for a given spec and repository provider. This method relies on the functionality of a tornado GET request. ```APIDOC ## BuildHandler.get ### Description Get a built image for a given spec and repo provider. Different repo providers will require different spec information. This function relies on the functionality of the tornado `GET` request. ### Method GET ### Endpoint (Not explicitly defined, but implied by GET request) ### Parameters #### Path Parameters None explicitly defined in this method signature. #### Query Parameters None explicitly defined in this method signature. #### Request Body None ### Parameters (from description) * **provider_prefix** (str) - The nickname for a repo provider (i.e. ‘gh’) * **spec** (type not specified) - Specifies information needed by the repo provider (i.e. user, repo, ref, etc.) ### Returns (Not specified, but implies a built image) ### Request Example (Not provided) ### Response (Not provided) ``` -------------------------------- ### Enable Podman-in-Kubernetes (PinK) Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Set the image builder type to 'pink' in your config.yaml to use Podman instead of Docker. ```yaml imageBuilderType: pink ``` -------------------------------- ### Install cert-manager Source: https://binderhub.readthedocs.io/en/latest/_sources/https.rst.txt Apply the cert-manager manifest to your Kubernetes cluster. For older Kubernetes versions (v1.15 or below), include the --validate=false flag. ```bash kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.8.1/cert-manager.yaml ``` -------------------------------- ### NPM Package Release Steps Source: https://binderhub.readthedocs.io/en/latest/contribute.html Commands for publishing BinderHub's NPM packages to the public registry. ```bash npm publish -w js/packages/binderhub-client/ --access public ``` ```bash npm publish -w js/packages/binderhub-react-components/ --access public ``` -------------------------------- ### Clone BinderHub Repository Source: https://binderhub.readthedocs.io/en/latest/contribute.html Clone the BinderHub repository to your local machine and navigate into the directory. This is the first step for setting up your development environment. ```bash git clone https://github.com/jupyterhub/binderhub cd binderhub ``` -------------------------------- ### Launching Event Structure Source: https://binderhub.readthedocs.io/en/latest/_sources/api.rst.txt Emitted when the repository is built and the system is waiting for the hub to launch the server. ```json { "phase": "launching", "message": "user friendly message" } ``` -------------------------------- ### Banning Specific Repositories Source: https://binderhub.readthedocs.io/en/latest/customizing.html Configure `banned_specs` to prevent certain repositories from being launched on your BinderHub instance. This example bans 'spacy-binder' and 'ml-training'. ```yaml config: GitHubRepoProvider: # Add banned repositories to the list below # They should be strings that will match "^/.*" banned_specs: - ^ines/spacy-binder.* - ^aschen/ml-training.* ``` -------------------------------- ### Prepare for Request Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Called at the beginning of a request before other methods like get/post. Override to perform common initialization. Supports asynchronous operations. ```python async prepare() ``` -------------------------------- ### Customizing JupyterHub Spawner Source: https://binderhub.readthedocs.io/en/latest/customizing.html Subclass the spawner in `extraConfig` to customize JupyterHub's behavior. This example shows how to define a custom spawner class. ```yaml binderhub: jupyterhub: hub: extraConfig: 10-binder-customisations: | class MyCustomBinderSpawner(BinderSpawner): ... c.JupyterHub.spawner_class = MyCustomBinderSpawner ``` -------------------------------- ### BuildHandler.prepare Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Called at the beginning of a request before other methods like get/post. Allows for common initialization. Supports asynchronous operations. ```APIDOC ## BuildHandler.prepare ### Description Called at the beginning of a request before `get`/`post`/etc. Override this method to perform common initialization regardless of the request method. There is no guarantee that `prepare` will be called if an error occurs that is handled by the framework. ### Method (Not explicitly defined, part of Tornado lifecycle) ### Parameters None ### Returns (Not specified) ### Asynchronous Support Added in version 3.1: Asynchronous support. Use `async def` or decorate this method with `.gen.coroutine` to make it asynchronous. If this method returns an `Awaitable` execution will not proceed until the `Awaitable` is done. ``` -------------------------------- ### Get Azure Container Registry ID Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-registry.rst.txt Retrieves the unique ID of an Azure Container Registry. This ID is often required for role assignments. ```bash az acr show --name --query "id" -o tsv ``` -------------------------------- ### BuildHandler.emit_launch_event Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Emits a single launch event to the activity log, including provider, spec, and reference information. ```APIDOC ## BuildHandler.emit_launch_event ### Description Emit a single launch event to the activity log. ### Method (Not explicitly defined, likely internal or part of a request lifecycle) ### Parameters * **provider** (type not specified) - Description: The repository provider. * **spec** (type not specified) - Description: The specification for the launch. * **ref** (type not specified) - Description: The reference for the launch. ### Returns (Not specified) ``` -------------------------------- ### Custom Registry Token URL Configuration Source: https://binderhub.readthedocs.io/en/latest/setup-binderhub.html Instruct BinderHub about the token URL for authenticating with a custom registry. This is used in conjunction with the registry setup. ```yaml config: BinderHub: use_registry: true image_prefix: "your-registry.io/-" DockerRegistry: token_url: "https://myregistry.io/v2/token?service=" ``` -------------------------------- ### Python Package Release Steps Source: https://binderhub.readthedocs.io/en/latest/contribute.html Steps for releasing the BinderHub Python package, including building, checking, and uploading to PyPI. ```bash pip install build twine python -m build . twine check dist/* twine upload dist/* ``` -------------------------------- ### Custom Registry Authentication Setup Source: https://binderhub.readthedocs.io/en/latest/setup-binderhub.html Configure BinderHub to authenticate with a custom Docker registry. This involves setting the registry URL, username, and password for the Docker config. ```yaml registry: url: "https://myregistry.io" username: xxx password: yyy ``` -------------------------------- ### Apply BinderHub Configuration Changes Source: https://binderhub.readthedocs.io/en/latest/cors.html Command to upgrade your BinderHub deployment with the modified configuration files. Ensure you replace placeholders with your actual values. ```bash helm upgrade jupyterhub/binderhub --version= -f secret.yaml -f config.yaml ``` -------------------------------- ### Get JupyterHub Service IP (LoadBalancer) Source: https://binderhub.readthedocs.io/en/latest/setup-binderhub.html Retrieve the external IP address of the JupyterHub service when using a LoadBalancer. This IP is needed to configure BinderHub's hub_url. ```bash kubectl --namespace= get svc proxy-public ``` -------------------------------- ### Get BinderHub Service IP Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Retrieve the external IP address of the BinderHub service using kubectl. This IP is used to access your BinderHub deployment in a web browser. ```bash kubectl --namespace= get svc binder ``` -------------------------------- ### Configure Repository Providers for BinderHub Source: https://binderhub.readthedocs.io/en/latest/reference/app.html Defines a list of repository providers to register and attempt to use for BinderHub. ```python repo_providers c.BinderHub.repo_providers = Dict()# ``` -------------------------------- ### Configure Nginx Ingress Controller Source: https://binderhub.readthedocs.io/en/latest/_sources/https.rst.txt Define the Nginx ingress controller configuration, specifying the static IP address acquired for the ingress proxy. This file is used with Helm for installation. ```yaml controller: service: loadBalancerIP: ``` -------------------------------- ### BuildHandler.launch Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Requests JupyterHub to launch the specified image. ```APIDOC ## BuildHandler.launch ### Description Ask JupyterHub to launch the image. ### Method (Not explicitly defined, likely internal or part of a request lifecycle) ### Parameters * **provider** (type not specified) - Description: The repository provider. ### Returns (Not specified) ``` -------------------------------- ### Build JS and CSS Bundles Source: https://binderhub.readthedocs.io/en/latest/contribute.html Create the JS and CSS bundles that BinderHub serves to visitors. This command is required before developing Kubernetes integration. ```bash npm run webpack ``` -------------------------------- ### Configure BinderHub for OVH Container Registry Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-binderhub.rst.txt Configure BinderHub to use OVH Container Registry by specifying the registry hash, region, and image prefix. An example configuration is provided. ```yaml config: BinderHub: use_registry: true image_prefix: ..container-registry.ovh.net/- DockerRegistry: url: https://..container-registry.ovh.net token_url: https://..container-registry.ovh.net/service/token?service=harbor-registry ``` ```yaml config: BinderHub: use_registry: true image_prefix: abcde.gra7.container-registry.ovh.net/myproject/binder- DockerRegistry: url: https://abcde.gra7.container-registry.ovh.net token_url: https://abcde.gra7.container-registry.ovh.net/service/token?service=harbor-registry ``` -------------------------------- ### Configure Local repo2docker Image Source: https://binderhub.readthedocs.io/en/latest/contribute.html Specifies a custom Docker image for repo2docker within the BinderHub configuration file. Ensure the Docker daemon used for building the image is the same as the one used by Minikube. ```python c.BinderHub.build_image = 'jupyter-repo2docker:my_image_tag' ``` -------------------------------- ### Assign Quota to Repositories Source: https://binderhub.readthedocs.io/en/latest/_sources/customizing.rst.txt Assign specific pod quotas to repositories based on matching patterns. This example assigns a quota of 999 to 'spacy-binder' and 1337 to any repository in the 'jupyterhub' organization. ```yaml config: GitHubRepoProvider: spec_config: - pattern: ^ines/spacy-binder.* config: quota: 999 - pattern: ^jupyterhub.* config: quota: 1337 ``` -------------------------------- ### Enable Podman-inside-Kubernetes (PinK) Source: https://binderhub.readthedocs.io/en/latest/setup-binderhub.html Configure BinderHub to use Podman-inside-Kubernetes by setting the image builder type. This is an alternative to Docker. ```yaml imageBuilderType: pink ``` -------------------------------- ### Customize JupyterHub via Helm Chart Source: https://binderhub.readthedocs.io/en/latest/_sources/customizing.rst.txt Use this pattern in your BinderHub's Helm chart (config.yaml) to customize JupyterHub settings. Refer to the mybinder.org Helm Chart for examples. ```yaml binderhub: jupyterhub: ``` -------------------------------- ### List available Azure subscriptions Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-registry.rst.txt Displays a list of available Azure subscriptions in a table format. Useful for identifying the correct subscription ID. ```bash az account list --refresh --output table ``` -------------------------------- ### Check Quota Before Build Source: https://binderhub.readthedocs.io/en/latest/reference/builder.html Checks if the user has sufficient quota before proceeding with a build or launch. Returns ServerQuotaCheck on success or None if no quota is configured. Raises LaunchQuotaExceeded if the quota is exceeded. ```python async check_quota(_provider_) ``` -------------------------------- ### Build JS and CSS Bundles with Webpack Source: https://binderhub.readthedocs.io/en/latest/_sources/contribute.md.txt Create the JavaScript and CSS bundles that BinderHub serves. Use 'webpack:watch' for automatic rebuilding during development. ```bash npm run webpack:watch ``` -------------------------------- ### Assigning Pod Quotas via Repository Configuration Source: https://binderhub.readthedocs.io/en/latest/customizing.html Example of assigning specific pod quotas to repositories using `spec_config`. The first pattern matches 'spacy-binder' with a quota of 999, and the second matches any repository in 'jupyterhub' with a quota of 1337. ```yaml config: GitHubRepoProvider: spec_config: - pattern: ^ines/spacy-binder.* config: quota: 999 - pattern: ^jupyterhub.* config: quota: 1337 ``` -------------------------------- ### Configure Docker for Docker Desktop Source: https://binderhub.readthedocs.io/en/latest/contribute.html Sets the Docker context to 'desktop-linux' for users of Docker Desktop. ```bash docker context use desktop-linux ``` -------------------------------- ### Assign AcrPush role to Service Principal Source: https://binderhub.readthedocs.io/en/latest/_sources/zero-to-binderhub/setup-registry.rst.txt Assigns the 'AcrPush' role to a Service Principal for a specific Azure Container Registry. This allows the Service Principal to push images to the registry. The example shows how to store the ACR ID in a bash variable. ```bash ACR_ID=$(az acr show --name --query "id" -o tsv) ```