Running multiple Chalie instances simultaneously on the same host.
By default, each Chalie stack runs on the same Docker Compose project with fixed networking. To run multiple independent instances in parallel, configure the following:
Each instance needs its own .env file (or environment variables) with a unique PORT:
# Instance 1: ~/.env or pass to docker compose up
PORT=8081
POSTGRES_PASSWORD=chalie
# Instance 2: separate .env or pass to docker compose up
PORT=8082
POSTGRES_PASSWORD=chalie
# External port for the web interface (http://localhost:)
# Change this to run multiple Chalie instances on the same host.
PORT=8081
# PostgreSQL password
POSTGRES_PASSWORD=chalie
# Session cookie signing secret
# Generate: python3 -c "import secrets; print(secrets.token_hex(32))"
SESSION_SECRET_KEY=changeme-in-production-use-a-long-random-string
# Set to true when serving over HTTPS
COOKIE_SECURE=false
# Instance 1 — home instance on port 8081
COMPOSE_PROJECT_NAME=chalie-home PORT=8081 docker compose up -d
# Instance 2 — work instance on port 8082
COMPOSE_PROJECT_NAME=chalie-work PORT=8082 docker compose up -d
# Instance 3 — separate project on port 8083
COMPOSE_PROJECT_NAME=chalie-demo PORT=8083 docker compose up -d
Create separate .env files for each instance:
~/.chalie-home/.env
COMPOSE_PROJECT_NAME=chalie-home
PORT=8081
POSTGRES_PASSWORD=chalie
SESSION_SECRET_KEY=
COOKIE_SECURE=false
~/.chalie-work/.env
COMPOSE_PROJECT_NAME=chalie-work
PORT=8082
POSTGRES_PASSWORD=chalie
SESSION_SECRET_KEY=
COOKIE_SECURE=false
Then start each from its directory:
cd ~/.chalie-home
docker compose up -d
cd ~/.chalie-work
docker compose up -d
Or pass the .env file explicitly:
docker compose --env-file ~/.chalie-home/.env up -d
Each COMPOSE_PROJECT_NAME gets its own:
chalie-home_postgres_data, chalie-work_postgres_data, etc.chalie-home_redis_data, chalie-work_redis_data, etc.chalie-home_backend_data, chalie-work_backend_data, etc.chalie-home_default, chalie-work_default, etc.Within each project’s network:
postgres, redis, backend, frontendchalie-home-postgres-1, chalie-work-postgres-1, etc.)# Instance 1
http://localhost:8081
# Instance 2
http://localhost:8082
# Instance 3
http://localhost:8083
# Brain dashboard for instance 1
http://localhost:8081/brain/
# Brain dashboard for instance 2
http://localhost:8082/brain/
Since PostgreSQL ports are not exposed to the host, use docker compose exec:
# Access PostgreSQL for chalie-home
docker compose -p chalie-home exec postgres psql -U postgres chalie
# Access PostgreSQL for chalie-work
docker compose -p chalie-work exec postgres psql -U postgres chalie
# Or via explicit env:
docker compose --env-file ~/.chalie-home/.env exec postgres psql -U postgres chalie
If you need direct host access (e.g., for backups or debugging), temporarily add ports back to docker-compose.yml:
postgres:
ports:
- "5432:5432" # chalie-home only
Then change for each project:
postgres:
ports:
- "5432:5432" # chalie-home
- "5433:5432" # chalie-work (map to different host port)
Stop a specific instance:
docker compose -p chalie-home down
docker compose -p chalie-work down
Or with explicit .env:
docker compose --env-file ~/.chalie-home/.env down
Stop all instances:
docker compose -p chalie-home down
docker compose -p chalie-work down
docker compose -p chalie-demo down
View all running instances:
docker ps --filter label=com.docker.compose.project=chalie-home
docker ps --filter label=com.docker.compose.project=chalie-work
docker ps | grep chalie
View logs for a specific instance:
docker compose -p chalie-home logs -f backend
docker compose -p chalie-work logs -f frontend
Or with explicit .env:
docker compose --env-file ~/.chalie-home/.env logs -f backend
After starting a new instance:
http://localhost:<PORT>/http://localhost:<PORT>/on-boarding/http://localhost:<PORT>/brain/docker compose -p <project> exec postgres psql -U postgres chalie\l — only chalie database should exist)docker ps shows <project>-service-N namesSESSION_SECRET_KEY or use unique keys. Using unique keys means sessions don’t transfer between instances (recommended for security).DB_ENCRYPTION_KEY to the same value across instances (or leave unset for isolation).docker stats and adjust limits in docker-compose.yml if needed.