Skip to content

GitHub Codespaces

Note

Recce Cloud is currently in private alpha and scheduled for general availability later this year. Sign up to the Recce newsletter to be notified, or email product@datarecce.io to join our design partnership program for early access.

GitHub Codespaces is a development environment provided by GitHub that allows developers to have identical and isolated environments for development. The GitHub Codespaces uses VS Code Server technology. We can launch it from a GitHub pull request page, and once it is started, the Recce server will run and port forwarding will be set up.

Setup Recce Cloud in GitHub Codespaces

  1. Prepare the two files in your repository
    .devcontainer
    ├── Dockerfile
    └── devcontainer.json
    
  2. Configure the .devcontainer/devcontainer.json

    {
        "name": "Recce CodeSpace",
        "build": {
            "dockerfile": "Dockerfile",
        },
        "containerEnv": {
            "RECCE_STATE_PASSWORD": "${{ secrets.RECCE_STATE_PASSWORD }}",
            "DBT_USER": "${{ secrets.DBT_USER }}",
            "DBT_PASSWORD": "${{ secrets.DBT_PASSWORD }}",
        },
        "postStartCommand": "recce server --cloud --review"
    }
    
    The secrets are Github Codespaces secrets. You can configure them in

  3. Prepare the .devcontainer/Dockerfile

    FROM mcr.microsoft.com/vscode/devcontainers/python:3.11
    
    RUN pip install dbt-bigquery~=1.7.0 recce
    

Note

The GitHub token generated by codespace is sufficient for Recce's use. It's not necessary to configure the GITHUB_TOKEN separately.

How to use

Here, we use GitHub Codespaces for pull requests

  1. Go to the GitHub PR page that is going to be reviewed
  2. Click the Code button and create a Codespace on the PR branch alt text
  3. Starting a Codespace instance usually takes one to several minutes.
  4. When the Recce server starts, an Open Browser notification will appear. Click the button to open the Recce web UI in a new tab.
  5. Or you can go to the PORTS tab to open the page.

FAQ

Q: How long does Codespace generally take to start?

The typical startup time is around 1 to 2 minutes. However, this depends on how your Dockerfile is configured. Codespace builds your image every time it starts, so if your Dockerfile includes multiple pip install , it may take longer.

Once your Codespace instance is already running, you won’t need to wait again when you return to it.

Q: Is there a way to optimize the startup speed?

Codespace offers a prebuild feature, which can significantly improve startup speed. However, you need to ensure that the image is up-to-date. To strike a balance between speed and update frequency, you can consider scheduling a weekly image rebuild.

Q: Can a Codespace environment be shared? Can different people access the same Codespace instance?

A Codespace environment is tied to each individual GitHub user account. Therefore, a Codespace instance opened by User A cannot be directly accessed by User B. However, User A can set a specific port to be public and share the URL with others. However, the server is still running under User A's account.

Q: Personal Codespace vs. Organization Codespace? How is Codespace billed?

By default, Codespace usage is billed to a GitHub personal account. GitHub offers a free tier, allowing each user 120 core hours per month for free.

For GitHub organization accounts, you can configure all Codespace charges to be billed to the organization. In this case, billing is attributed to the organization rather than personal accounts.

For more details on billing, please refer to the official CodeSpace billing documentation.

Q: How to configure codespaces? What's the default dev container spec in Codespaces?

Codespace utilizes VSCode Dev Containers technology, which can be executed either locally (via Docker) or in the cloud (via GitHub Codespace). The configuration above provided are primarily recommendations for the recce cloud setup. For more advanced configuration options, you can refer to the VSCode dev containers or the containers.dev documentation.

The default configuration for GitHub Codespace is explained in the documentation. If you're looking to set up a development environment for dbt/Recce, you can also refer to the Python project configuration documentation.