Dev Container Guide
Run OpenPRA in a reproducible VS Code Dev Container or GitHub Codespaces environment.
Overview
This repo includes a ready-to-use Dev Container configuration under .devcontainer/ backed by Docker Compose:
- Services: a primary
devcontainerplus colocatedmongodbandrabbitmq - Forwarded ports: 27017 (MongoDB), 5672/15672 (RabbitMQ)
- Workspace mount:
/workspaces/openpra-monorepo
Key files:
.devcontainer/devcontainer.json— container definition and forwarded ports.devcontainer/docker-compose.yml— Dev service + MongoDB + RabbitMQ.devcontainer/Dockerfile— Node 20 base with build/runtime deps and pnpm/nx
Start the Dev Container (VS Code)
- Ensure Docker is running locally
- Install the "Dev Containers" extension
- Open this repository in VS Code
- When prompted, choose "Reopen in Container" (or run: Command Palette → Dev Containers: Reopen in Container)
VS Code will build the image and start the devcontainer, mongodb, and rabbitmq services.
Start the Dev Container (Codespaces)
- Open the repository in GitHub and click Code → Codespaces → Create codespace on main.
- The
.devcontainerconfig is honored by Codespaces. Ports will be auto-forwarded.
First-run setup
Inside the container:
bash
pnpm install
pnpm nx --versionOptionally start all apps:
bash
pnpm nx run-many -t serve --allOr start specific apps:
bash
pnpm nx serve frontend-web-editor
pnpm nx serve web-backendNotes for tests on Debian 12-based containers
On Debian 12/bookworm images, mongodb-memory-server can fail due to OpenSSL 1.1 binaries. Our Jest setup falls back to a real Mongo instance via MONGO_URI.
Example:
bash
export MONGO_URI="mongodb://127.0.0.1:27017/test"
pnpm nx test web-backend -- --test-timeout=60000The Dev Container launches MongoDB internally on 27017; use 127.0.0.1 from inside the container.
