Ben Potter 5764ff2fdc
feat: add healthcheck and config options to JupyterLab Module (#363)
## Description

Simplified JupyterLab module configuration and added automatic CSP
headers for iFrame embedding for Coder Tasks. The module now works out
of the box without requiring users to manually configure
Content-Security-Policy headers.

**Changes:**
- Removed redundant configuration examples from README that duplicated
existing module variables
- Added fallback CSP configuration when user doesn't provide custom
config
- Cleaned up locals logic with better naming and clearer conditionals
- Updated README to show minimal usage with CSP example for custom
configurations

## Type of Change

- [ ] New module
- [ ] Bug fix
- [x] Feature/enhancement
- [ ] Documentation
- [ ] Other

## Module Information

**Path:** `registry/coder/modules/jupyterlab`  
**New version:** `v1.2.0`  
**Breaking change:** [x] Yes [ ] No

*Breaking change: Config behavior changed - now automatically includes
CSP when no user config provided*

## Testing & Validation

- [x] Tests pass (`bun test`)
- [x] Code formatted (`bun run fmt`)
- [x] Changes tested locally

## Related Issues

Closes #345
2025-08-23 23:43:24 +05:00

1.4 KiB

display_name description icon verified tags
JupyterLab A module that adds JupyterLab in your Coder template. ../../../../.icons/jupyter.svg true
jupyter
ide
web

JupyterLab

A module that adds JupyterLab in your Coder template.

JupyterLab

module "jupyterlab" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/jupyterlab/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
}

Configuration

JupyterLab is automatically configured to work with Coder's iframe embedding. For advanced configuration, you can use the config parameter to provide additional JupyterLab server settings according to the JupyterLab configuration documentation.

module "jupyterlab" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/jupyterlab/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
  config = {
    ServerApp = {
      # Required for Coder Tasks iFrame embedding - do not remove
      tornado_settings = {
        headers = {
          "Content-Security-Policy" = "frame-ancestors 'self' ${data.coder_workspace.me.access_url}"
        }
      }
      # Your additional configuration here
      root_dir = "/workspace/notebooks"
    }
  }
}