Skip to main content

Multi-Domain Setup

vNext Runtime supports running multiple domains simultaneously on the same infrastructure. Teams can run isolated domain environments (core, sales, hr, etc.) sharing the same PostgreSQL, Redis, Vault, and Dapr services.

tip

Each domain has its own orchestration, execution, worker-inbox, worker-outbox, and init containers β€” but shared infrastructure (DB, Redis, Vault, Dapr) runs as a single instance.

Folder Structure​

vnext/docker/
β”œβ”€β”€ templates/ # Template files for new domains
β”‚ β”œβ”€β”€ .env # Main env template with {{PLACEHOLDERS}}
β”‚ β”œβ”€β”€ .env.orchestration # Orchestration template
β”‚ β”œβ”€β”€ .env.execution # Execution template
β”‚ β”œβ”€β”€ .env.worker-inbox # Inbox worker template
β”‚ β”œβ”€β”€ .env.worker-outbox # Outbox worker template
β”‚ └── appsettings.*.Development.json # App settings templates
β”œβ”€β”€ domains/ # Domain configurations
β”‚ β”œβ”€β”€ core/ # Domain: core
β”‚ β”œβ”€β”€ sales/ # Domain: sales
β”‚ └── <domain_name>/ # Your domain
β”‚ β”œβ”€β”€ .env
β”‚ β”œβ”€β”€ .env.orchestration
β”‚ β”œβ”€β”€ .env.execution
β”‚ β”œβ”€β”€ .env.worker-inbox
β”‚ β”œβ”€β”€ .env.worker-outbox
β”‚ └── appsettings.*.Development.json
β”œβ”€β”€ config/ # Shared infrastructure config
β”œβ”€β”€ docker-compose.yml
└── create-domain.sh # Script to create domains from templates

Creating a New Domain​

Use the create-domain command to generate domain configuration from templates:

# Create domain with port offset (to avoid port conflicts)
# Note: core (offset 0) and discovery (offset 5) are pre-configured
# Use offset 10 or higher for custom domains
make create-domain DOMAIN=sales PORT_OFFSET=10
make create-domain DOMAIN=hr PORT_OFFSET=20
make create-domain DOMAIN=finance PORT_OFFSET=30

This generates:

  • Environment files with domain-specific DAPR store names, ports, and app IDs
  • Appsettings files with domain-specific database connection strings
  • Proper OTEL service names for observability

The database name is auto-generated from the domain name:

  • core β†’ vNext_Core
  • sales β†’ vNext_Sales
  • user-management β†’ vNext_User_Management

Port Allocation​

Each domain uses unique ports based on PORT_OFFSET:

OffsetDomain (Example)App PortExecutionInboxOutboxInit
0core (reserved)42014202420342043005
5discovery (reserved)42064207420842093010
10sales42114212421342143015
20hr42214222422342243025
30finance42314232423342343035

Dapr ports use offset * 100 to avoid conflicts.

Reserved Offsets

The core and discovery domains are pre-configured with offsets 0 and 5 respectively. Do not use these offsets for your custom domains. Start with offset 10 or higher for new domains.

Running Multiple Domains​

# 1. Start shared infrastructure
make up-infra

# 2. Pre-configured domains (core and discovery) are ready to use
make up-vnext DOMAIN=core
make up-vnext DOMAIN=discovery

# 3. Create and start your own domain (use offset 10 or higher)
make create-domain DOMAIN=sales PORT_OFFSET=10
make db-create DOMAIN=sales
make up-vnext DOMAIN=sales

# 4. View all running services
make status-all-domains

# 5. Check health of a specific domain
make health DOMAIN=core
make health DOMAIN=sales

Domain Management​

# List all configured domains
make list-domains

# Stop a specific domain
make down-vnext DOMAIN=sales

# Restart a specific domain
make restart-vnext DOMAIN=sales

# Stop all domains but keep infrastructure
make down-all-vnext

# View logs for a specific domain
make logs-vnext DOMAIN=core

Customizing Templates​

Templates live in vnext/docker/templates/. They use {{PLACEHOLDER}} syntax:

PlaceholderDescription
{{DOMAIN_NAME}}Domain name (e.g., core, sales)
{{PORT_OFFSET}}Port offset value
{{DB_NAME}}Database name (e.g., vNext_Core)
{{VNEXT_APP_PORT}}Orchestration port
{{DAPR_*_PORT}}Dapr sidecar ports

Auto-generated environment variables:

VariableDescription
DAPR_STATE_STORE_NAMEDapr state store name (required)
DAPR_SECRET_STORE_NAMEDapr secret store name
DAPR_PUBSUB_STORE_NAMEDapr pubsub store name
DAPR_APP_IDUnique Dapr app identifier per service
OTEL_SERVICE_NAMEOpenTelemetry service name

Legacy Single-Domain Mode​

For backwards compatibility, the legacy change-domain command still works:

make change-domain DOMAIN=mycompany

This updates all domain-related settings but does not support running multiple domains simultaneously.


Distilled from vnext-runtime/README.md.