- class binderhub.app.BinderHub(**kwargs)¶
An Application for starting a builder.
- about_message c.BinderHub.about_message = Unicode('')¶
Additional message to display on the about page.
Will be directly inserted into the about page’s source so you can use raw HTML.
- static add_url_prefix(prefix, handlers)¶
add a url prefix to handlers
- appendix c.BinderHub.appendix = Unicode('')¶
Appendix to pass to repo2docker
A multi-line string of Docker directives to run. Since the build context cannot be affected, ADD will typically not be useful.
This should be a Python string template. It will be formatted with at least the following names available:
binder_url: the shareable URL for the current image (e.g. for sharing links to the current Binder)
repo_url: the repository URL used to build the image
- auth_enabled c.BinderHub.auth_enabled = Bool(False)¶
If JupyterHub authentication enabled, require user to login (don’t create temporary users during launch) and start the new server for the logged in user.
- badge_base_url c.BinderHub.badge_base_url = Union()¶
Base URL to use when generating launch badges. Can also be a function that is passed the current handler and returns the badge base URL, or “” for the default.
For example, you could get the badge_base_url from a custom HTTP header, the Referer header, or from a request parameter
- ban_networks c.BinderHub.ban_networks = Dict()¶
Dict of networks from which requests should be rejected with 403
Keys are CIDR notation (e.g. ‘22.214.171.124/32’), values are a label used in log / error messages. CIDR strings will be parsed with
Message to display in a banner on all pages.
The value will be inserted “as is” into a HTML <div> element with grey background, located at the top of the BinderHub pages. Raw HTML is supported.
- base_url c.BinderHub.base_url = Unicode('/')¶
The base URL of the entire application
- build_cleanup_interval c.BinderHub.build_cleanup_interval = Int(60)¶
Interval (in seconds) for how often stopped build pods will be deleted.
- build_docker_config c.BinderHub.build_docker_config = Dict()¶
A dict which will be merged into the .docker/config.json of the build container (repo2docker) Here, you could for example pass proxy settings as described here: https://docs.docker.com/network/proxy/#configure-the-docker-client
Note: if you provide your own push_secret, this values wont have an effect, as the push_secrets will overwrite .docker/config.json In this case, make sure that you include your config in your push_secret
- build_docker_host c.BinderHub.build_docker_host = Unicode('/var/run/docker.sock')¶
The docker URL repo2docker should use to build the images.
Currently, only paths are supported, and they are expected to be available on all the hosts.
- build_image c.BinderHub.build_image = Unicode('jupyter/repo2docker:2021.01.0')¶
The repo2docker image to be used for doing builds
- build_max_age c.BinderHub.build_max_age = Int(14400)¶
Maximum age of builds
Builds that are still running longer than this will be killed.
- build_memory_limit c.BinderHub.build_memory_limit = ByteSpecification(0)¶
Max amount of memory allocated for each image build process.
0 sets no limit.
This is applied to the docker build itself via repo2docker, though it is also applied to our pod that submits the build, even though that pod will rarely consume much memory. Still, it makes it easier to see the resource limits in place via kubernetes.
- build_memory_request c.BinderHub.build_memory_request = ByteSpecification(0)¶
Amount of memory to request when scheduling a build
0 reserves no memory.
This is used as the request for the pod that is spawned to do the building, even though the pod itself will not be using that much memory since the docker building is happening outside the pod. However, it makes kubernetes aware of the resources being used, and lets it schedule more intelligently.
- build_namespace c.BinderHub.build_namespace = Unicode('default')¶
Kubernetes namespace to spawn build pods in.
Note that the push_secret must refer to a secret in this namespace.
- build_node_selector c.BinderHub.build_node_selector = Dict()¶
Select the node where build pod runs on.
- builder_required c.BinderHub.builder_required = Bool(True)¶
If binderhub should try to continue to run without a working build infrastructure.
Build infrastructure is kubernetes cluster + docker. This is useful for pure HTML/CSS/JS local development.
- concurrent_build_limit c.BinderHub.concurrent_build_limit = Int(32)¶
The number of concurrent builds to allow.
- config_file c.BinderHub.config_file = Unicode('binderhub_config.py')¶
Config file to load.
If a relative path is provided, it is taken relative to current directory
- debug c.BinderHub.debug = Bool(False)¶
Turn on debugging.
- executor_threads c.BinderHub.executor_threads = Int(5)¶
The number of threads to use for blocking calls
Should generaly be a small number because we don’t care about high concurrency here, just not blocking the webserver. This executor is not used for long-running tasks (e.g. builds).
Only the values are set up as scripts. Keys are used only for sorting.
Omit the <script> tag. This should be primarily used for analytics code.
- extra_static_path c.BinderHub.extra_static_path = Unicode('')¶
Path to search for extra static files.
- extra_static_url_prefix c.BinderHub.extra_static_url_prefix = Unicode('/extra_static/')¶
Url prefix to serve extra static files.
- google_analytics_code c.BinderHub.google_analytics_code = Unicode(None)¶
The Google Analytics code to use on the main page.
Note that we’ll respect Do Not Track settings, despite the fact that GA does not. We will not load the GA scripts on browsers with DNT enabled.
- google_analytics_domain c.BinderHub.google_analytics_domain = Unicode('auto')¶
The Google Analytics domain to use on the main page.
By default this is set to ‘auto’, which sets it up for current domain and all subdomains. This can be set to a more restrictive domain here for better privacy
- hub_api_token c.BinderHub.hub_api_token = Unicode('')¶
API token for talking to the JupyterHub API
- hub_url c.BinderHub.hub_url = Unicode('')¶
The base URL of the JupyterHub instance where users will run.
- hub_url_local c.BinderHub.hub_url_local = Unicode('')¶
The base URL of the JupyterHub instance for local/internal traffic
If local/internal network connections from the BinderHub process should access JupyterHub using a different URL than public/external traffic set this, default is hub_url
- image_prefix c.BinderHub.image_prefix = Unicode('')¶
Prefix for all built docker images.
- If you are pushing to gcr.io, this would start with:
Set according to whatever registry you are pushing to.
Defaults to “”, which is probably not what you want :)
- initialize(*args, **kwargs)¶
Load configuration settings.
- log_datefmt c.BinderHub.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')¶
The date format used by logging formatters for %(asctime)s
- log_format c.BinderHub.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')¶
The Logging format template
- log_level c.BinderHub.log_level = Enum(30)¶
Set the log level by value or name.
- log_tail_lines c.BinderHub.log_tail_lines = Int(100)¶
Limit number of log lines to show when connecting to an already running build.
- normalized_origin c.BinderHub.normalized_origin = Unicode('')¶
Origin to use when emitting events. Defaults to hostname of request when empty
- per_repo_quota c.BinderHub.per_repo_quota = Int(0)¶
Maximum number of concurrent users running from a given repo.
Limits the amount of Binder that can be consumed by a single repo.
0 (default) means no quotas.
- per_repo_quota_higher c.BinderHub.per_repo_quota_higher = Int(0)¶
Maximum number of concurrent users running from a higher-quota repo.
Limits the amount of Binder that can be consumed by a single repo. This quota is a second limit for repos with special status. See the
high_quota_specsparameter of RepoProvider classes for usage.
0 (default) means no quotas.
- pod_quota c.BinderHub.pod_quota = Int(None)¶
The number of concurrent pods this hub has been designed to support.
This quota is used as an indication for how much above or below the design capacity a hub is running. It is not used to reject new launch requests when usage is above the quota.
The default corresponds to no quota, 0 means the hub can’t accept pods (maybe because it is in maintenance mode), and any positive integer sets the quota.
- port c.BinderHub.port = Int(8585)¶
Port for the builder to listen on.
- push_secret c.BinderHub.push_secret = Unicode('binder-build-docker-config')¶
A kubernetes secret object that provides credentials for pushing built images.
- repo_providers c.BinderHub.repo_providers = Dict()¶
List of Repo Providers to register and try
- show_config c.BinderHub.show_config = Bool(False)¶
Instead of starting the Application, dump configuration to stdout
- show_config_json c.BinderHub.show_config_json = Bool(False)¶
Instead of starting the Application, dump configuration to stdout (as JSON)
Start the app mainloop.
Override in subclasses.
- sticky_builds c.BinderHub.sticky_builds = Bool(False)¶
Attempt to assign builds for the same repository to the same node.
In order to speed up re-builds of a repository all its builds will be assigned to the same node in the cluster.
Note: This feature only works if you also enable docker-in-docker support.
- template_path c.BinderHub.template_path = Unicode('')¶
Path to search for custom jinja templates, before using the default templates.
- template_variables c.BinderHub.template_variables = Dict()¶
Extra variables to supply to jinja templates when rendering.
- tornado_settings c.BinderHub.tornado_settings = Dict()¶
additional settings to pass through to tornado.
can include things like additional headers, etc.
- use_registry c.BinderHub.use_registry = Bool(True)¶
Set to true to push images to a registry & check for images in registry.
Set to false to use only local docker images. Useful when running in a single node.
- async watch_build_pods()¶
Watch build pods
Every build_cleanup_interval: - delete stopped build pods - delete running build pods older than build_max_age