Skip to content

First-Run Setup Guide

Version: 1.0 Last Updated: 2026-01-31 Status: Active


Overview

This guide covers the first-time setup of the Sorcha platform. The setup wizard handles:

  • Environment Detection: Checks for Docker, .NET SDK, and port availability
  • Configuration Generation: Creates .env file with secure credentials
  • Infrastructure Provisioning: Creates Docker volumes and starts database services
  • Service Startup: Builds and starts all application services
  • Validation: Verifies all services are healthy and accessible

Prerequisites

Required

ComponentVersionDownload
Docker Desktop4.0+docker.com
Docker Compose2.0+ (plugin) or 1.29+ (standalone)Included with Docker Desktop

Optional (for development)

ComponentVersionDownload
.NET SDK10.0+dotnet.microsoft.com
Git2.30+git-scm.com
Sorcha CLILatestdotnet tool install -g Sorcha.Cli

Quick Start

Windows (PowerShell)

powershell
# Clone the repository
git clone https://github.com/sorcha-platform/sorcha.git
cd Sorcha

# Run the setup wizard
.\scripts\setup.ps1

Linux / macOS (Bash)

bash
# Clone the repository
git clone https://github.com/sorcha-platform/sorcha.git
cd Sorcha

# Make scripts executable
chmod +x scripts/*.sh

# Run the setup wizard
./scripts/setup.sh

Setup Wizard Steps

The setup wizard performs these steps automatically:

1. Prerequisites Check

Verifies that required software is installed:

[1/8] Checking Prerequisites
--------------------------------------------------
  [OK] Docker CLI found
  [OK] Docker daemon is running
  [OK] Docker Compose found (plugin)
  [OK] .NET SDK 10.0.100 found
  [OK] Git found

2. Port Availability

Checks that required ports are not in use:

PortService
80API Gateway (HTTP)
443API Gateway (HTTPS)
5000Blueprint Service
5380Register Service
5400UI Web
5432PostgreSQL
5450Tenant Service
5800Validator Service
16379Redis
18888Aspire Dashboard
27017MongoDB

3. First-Run Detection

Detects if this is a fresh installation by checking for:

  • Missing .env file
  • Missing Docker volumes
  • Missing Sorcha containers

4. Configuration Generation

Creates .env file with:

  • Installation name: Used for JWT issuer (default: localhost)
  • JWT signing key: Auto-generated 256-bit key
  • Database credentials: Development defaults
env
# Generated .env file
INSTALLATION_NAME=localhost
JWT_SIGNING_KEY=<auto-generated-256-bit-key>
POSTGRES_USER=sorcha
POSTGRES_PASSWORD=sorcha_dev_password

5. Docker Volumes

Creates persistent storage volumes:

  • sorcha_redis-data
  • sorcha_postgres-data
  • sorcha_mongodb-data
  • sorcha_dataprotection-keys
  • sorcha_wallet-encryption-keys

6. Infrastructure Services

Starts and waits for infrastructure services:

  • Redis (caching, session, pub/sub)
  • PostgreSQL (Tenant, Wallet databases)
  • MongoDB (Register database)
  • Aspire Dashboard (observability)

7. Application Services

Builds and starts all microservices:

  • Blueprint Service
  • Wallet Service
  • Register Service
  • Tenant Service
  • Validator Service
  • Peer Service
  • API Gateway
  • UI Web

8. Validation

Verifies all services are healthy and accessible.

Post-Setup: Bootstrap

After setup completes, run the bootstrap script to create the initial organization:

Using the Bootstrap Script

powershell
# PowerShell
.\scripts\bootstrap-sorcha.ps1 -Profile docker

# Bash
./scripts/bootstrap-sorcha.sh --profile docker

Using the CLI

bash
# Interactive mode
sorcha bootstrap --profile docker

# Non-interactive mode
sorcha bootstrap --profile docker --non-interactive \
  --org-name "My Organization" \
  --subdomain "myorg" \
  --admin-email "admin@myorg.com" \
  --admin-name "Administrator" \
  --admin-password "SecureP@ss123!"

Service URLs

After setup and bootstrap, access services at:

ServiceURLPurpose
Main UIhttp://localhost/appPrimary user interface
API Gatewayhttp://localhostREST API endpoints
API Documentationhttp://localhost/scalarOpenAPI/Scalar docs
Aspire Dashboardhttp://localhost:18888Observability

Troubleshooting

Docker Not Running

[X] Docker Desktop is not running

Solution: Start Docker Desktop and wait for it to initialize.

Port Already in Use

[X] Port 80 in use (API Gateway HTTP)

Solution: Stop the conflicting service or modify docker-compose.yml to use a different port:

bash
# Find what's using the port
netstat -ano | findstr :80  # Windows
lsof -i :80                  # Linux/macOS

# Kill the process
taskkill /PID <pid> /F       # Windows
kill -9 <pid>                # Linux/macOS

Wallet Encryption Permissions

[!] Could not set wallet permissions

Solution: Run the permissions fix script:

powershell
# PowerShell
.\scripts\fix-wallet-encryption-permissions.ps1

# Bash
./scripts/fix-wallet-encryption-permissions.sh

Services Not Starting

Check the logs for specific errors:

bash
# View all logs
docker-compose logs -f

# View specific service logs
docker-compose logs -f tenant-service

HTTPS Not Working

HTTPS requires a certificate. Generate one with:

powershell
# PowerShell
.\scripts\setup-https-docker.ps1

# Bash
./scripts/setup-https-docker.sh

Environment Validation

Run the validation script to check environment health:

powershell
# Full validation
.\scripts\validate-environment.ps1

# Quick check (summary only)
.\scripts\validate-environment.ps1 -Quiet

# JSON output (for CI/CD)
.\scripts\validate-environment.ps1 -JsonOutput

Advanced Options

Non-Interactive Setup

For CI/CD or scripted deployments:

powershell
.\scripts\setup.ps1 -NonInteractive

Skip Docker Checks

For environments where Docker validation should be skipped:

powershell
.\scripts\setup.ps1 -SkipDocker

Force Re-initialization

To regenerate configuration even if already set up:

powershell
.\scripts\setup.ps1 -Force

Verbose Output

For detailed troubleshooting:

powershell
.\scripts\setup.ps1 -Verbose

Configuration Reference

The setup wizard creates a .env file with these variables:

VariableDescriptionDefault
INSTALLATION_NAMEJWT issuer identifierlocalhost
JWT_SIGNING_KEY256-bit signing keyAuto-generated
POSTGRES_USERPostgreSQL usernamesorcha
POSTGRES_PASSWORDPostgreSQL passwordsorcha_dev_password
MONGO_USERNAMEMongoDB usernamesorcha
MONGO_PASSWORDMongoDB passwordsorcha_dev_password
ASPNETCORE_ENVIRONMENTRuntime environmentDevelopment

Production Configuration

For production deployments, update these values:

  1. Generate new secrets:

    powershell
    # Generate new JWT key
    [Convert]::ToBase64String((1..32 | ForEach-Object { Get-Random -Maximum 256 }))
  2. Update .env:

    env
    INSTALLATION_NAME=sorcha.mycompany.com
    JWT_SIGNING_KEY=<new-256-bit-key>
    POSTGRES_PASSWORD=<strong-password>
    MONGO_PASSWORD=<strong-password>
    ASPNETCORE_ENVIRONMENT=Production
  3. Enable HTTPS (see HTTPS Setup)


Document Owner: Sorcha Contributors Last Review: 2026-01-31

Released under the MIT License.