Docker Setup
Run the full platform (gateway, services, and workers) as Docker containers using the root docker-compose.yml. Each container uses the same image — the SERVICE_NAME environment variable selects which process to start.
Prepare the Environment
Copy the environment template and generate a unique machine ID:
cp .env.example .env
npm run script:machinescript:machine writes a random MACHINE_ID into .env — required before starting any container.
Build the Platform Image
From the repository root:
docker build -t wenex/platform:latest .This runs npm run git:clone, pnpm install --frozen-lockfile, and npm run script:build inside the container, producing a self-contained image with all compiled services and workers under wnx/.
Initialize the Database
Run the initialization commands once using the compose profiles before starting the platform for the first time:
docker-compose run --rm db-seed
docker-compose run --rm db-index
docker-compose run --rm storage-init
docker-compose run --rm utility-init
docker-compose run --rm kafka-connectTIP
To wipe all data and start fresh, use docker-compose run --rm db-clean. This permanently drops all MongoDB collections, Elasticsearch indices, and Redis keys — use with caution.
Start the Platform
The docker-compose.yml uses Docker Compose profiles to control which containers start. Use the platform profile to bring up the full stack — all services, workers, and the gateway:
docker-compose --profile platform up -dTo start only the services (no workers):
docker-compose --profile services up -dTo start only the workers:
docker-compose --profile workers up -dTo start a single component by name:
docker-compose --profile gateway up -d
docker-compose --profile auth up -d
docker-compose --profile dispatcher up -dTIP
Make sure the infrastructure stack is running first (docker-compose -f docker/docker-compose.yml up -d) before starting the platform containers. Services and workers expect MongoDB, Redis, Kafka, and the other infrastructure components to be available.