Sandbox Environment¶
The development sandbox serves as an isolated environment for local development and testing, separate from the live system. This setup grants full control over local data and mock interfaces.
Pre-requisites¶
Due to BC Government procurement restrictions, Docker Desktop is not permitted. However, the following alternatives are approved:
- Docker Engine (with Docker CLI)
- Podman
- Rancher Desktop
Docker Setup¶
brew install dockerbrew install docker-composebrew install docker-buildx- Add symlinks in
~/.docker/cli-pluginsln -s $HOMEBREW_PREFIX/lib/docker/cli-plugins/docker-buildx docker-buildxln -s $HOMEBREW_PREFIX/lib/docker/cli-plugins/docker-compose docker-compose
- Login to docker
docker login
- Start VM. Example (using podman):
podman machine initpodman machine start
Refer to these blog posts on how to install Docker without Docker Desktop:
Getting Started¶
- Switch to sandbox folder
- Create three directories to mount volumns for
mongodb,postgresandmailpit.
If you have data version conflict errors due to existing mount volumes, please delete the directories and recreate them.
- Set environment variable MACHINE_HOST_IP to your ip address using the command
For WSL/Linux:
or For Mac M1/M2:
- To create the sandbox environment, utilize local Docker container instances with
docker-compose:
For WSL/Linux:
or For Mac M1/M2:
You can add the -d flag to run the containers in daemon mode.
Ensure that neither MongoDB nor Mongosh is installed on your local machine, as they may interfere with the database schema managed by Prisma, which connects to the MongoDB Docker container. If you have either installed, you can remove them by following the instruction provided in this link: uninstall mongodb and mongosh
Services¶
Within the local Docker container environment, 10 services are available:
-
Keycloak Handles user authentication for the application via browser-based login.
-
Keycloak Provision Provisions the local Keycloak realm, clients, and users.
-
PostgreSQL Serves as the database for Keycloak.
-
MongoDB Serves as the database for the local application; you can use MongoDB Compass to explore the local database.
-
Microsoft 365 Mock A mock server for Microsoft Graph API endpoints.
-
CHES Mock Simulates the Common Hosted Email Service (CHES) for local email delivery and testing.
-
NATS Acts as the message broker for communication with the Provisioner.
-
NATS Provision A mock Provisioner service for handling provisioning requests.
-
WeasyPrint Server Converts HTML and CSS content into downloadable PDF documents.
-
Mailpit A lightweight email testing tool that captures and inspects outgoing emails.
- See Mailpit GitHub Repository for more details.
For complete service definitions, refer to the docker-compose.yml file.
Access Details¶
- Keycloak (HTTP): http://localhost:8080
- Keycloak (HTTPS): https://localhost:8443
- Keycloak Realm:
platform-services - Keycloak Client ID:
pltsvc - Keycloak Client Secret:
testsecret - MongoDB URL:
mongodb://localhost:27017 - Microsoft 365 Proxy URL: http://localhost:8000
- CHES Mock URL: http://localhost:3025
- Mailpit URL: http://localhost:8025
Mock user details can be found in the mock-users.json file. Passwords are derived by converting user email addresses to lowercase.