Automatic public Codespace creation
Last Updated: January 28, 2025
This page provides information about automatic public Codespace creation.
Overview of automatic public Codespace creation
It's now possible to set up your GitHub account to allow Codespaces to do several steps for you, and to get a public URL that can be viewed automatically with minimal extra steps.
Automatic application startup in Codespaces when the Codespace is first created
Configurable mock server and frontend dev server via secrets
Public port setup for prototype sharing via URL
The codespaces-start.sh
script has been updated in vets-website
to include a new section that automates this application startup process. The GitHub CLI is used in this script to programmatically set the frontend and mock server ports as public, which allows for easy sharing of prototypes with external stakeholders.
New Codespace Secrets
The following Codespace user secrets have been introduced. These secrets are added in the same way as was previously outlined for adding VETS_WEBSITE_BUILD_CONTENT
MOCK_RESPONSES
: Specifies the path to mock server responses.
Default:
src/platform/testing/local-dev-mock-api/common.js
Usage: Set this to use custom mock responses. An engineer should be able to provide you with the path to your app's mock server entry file (if that has been set up). The default common responses are pretty barebones, so don't expect much to work if you use them, besides some feature toggles, user, and maintenance windows endpoints.
2. ENTRY_APPS
: Defines specific apps to be built in watch mode.
Format: Comma-separated list of app names that should be accessible (e.g., "static-pages,auth")
Usage: Optimizes build time by focusing on specific apps, if this is not set, then it will build all applications in the Codespace, and startup time will be extended.
User Adoption
Users can opt-in to running public prototypes through Codespaces by configuring their Codespace settings in their GitHub account. This process is designed to be accessible to non-engineers, enabling them to spin up a Codespace with minimal technical knowledge.
Usage Instructions
Set up Codespaces user secrets
Go to GitHub account settings.
Navigate to Codespaces settings.
Add the desired secrets (
MOCK_RESPONSES
,MAKE_APP_PUBLIC
,ENTRY_APPS
) and their corresponding values.
Create a new Codespace for the project.
Immediately after a Codespace has been created refresh the page, and update the name of the Codespace so that it begins with 'va-public-'. For example, if the Codespace name was 'stunning space xylophone' then it should be renamed as 'va-public-stunning space xylophone'. This naming convention is used during the Codespace startup scripts to detect whether you want a Codespace to be public or not. By utilizing the name of the Codespace, we can have public and private Codespaces running as needed.
The application will automatically start based on your configured secrets.
Access the public prototype using the provided Codespace URL. You can view this public URL in the 'ports' section of the Codespace VS Code instance that runs in your browser, as outlined in the Making the frontend public document.
Navigate to your application's URL like
/profile
,/my-va
, etc
Additional resources
Use the links below for more information:
Help and feedback
Get help from the Platform Support Team in Slack.
Submit a feature idea to the Platform.