deploy: support localhost-only demo bind

This commit is contained in:
Marco Allegretti 2026-02-03 11:52:32 +01:00
parent 1b75c1aebe
commit 3d46399cfc
3 changed files with 86 additions and 92 deletions

View file

@ -1,23 +1,25 @@
# Demo Environment Configuration # Demo Environment Configuration
# Copy to .env.demo and optionally customize # Copy to .env.demo and optionally customize
# Database (separate from production) # Database (separate from production)
POSTGRES_USER=likwid_demo POSTGRES_USER=likwid_demo
POSTGRES_PASSWORD=demo_secret_change_me POSTGRES_PASSWORD=demo_secret_change_me
POSTGRES_DB=likwid_demo POSTGRES_DB=likwid_demo
DB_PORT=5433 DB_PORT=5433
# Backend # Backend
JWT_SECRET=demo_jwt_secret_not_for_production JWT_SECRET=demo_jwt_secret_not_for_production
BACKEND_PORT=3001 BACKEND_PORT=3001
BACKEND_BIND_HOST=0.0.0.0
# Frontend
FRONTEND_PORT=4322 # Frontend
API_BASE=http://localhost:3001 FRONTEND_PORT=4322
INTERNAL_API_BASE=http://backend:3000 FRONTEND_BIND_HOST=0.0.0.0
API_BASE=http://localhost:3001
# Demo mode is always enabled for this deployment INTERNAL_API_BASE=http://backend:3000
# This enables:
# - Demo accounts (contributor, moderator, observer) with password: demo123 # Demo mode is always enabled for this deployment
# - Pre-seeded communities, proposals, and governance data # This enables:
# - Restricted destructive actions (cannot delete core demo data) # - Demo accounts (contributor, moderator, observer) with password: demo123
# - Pre-seeded communities, proposals, and governance data
# - Restricted destructive actions (cannot delete core demo data)

View file

@ -2,11 +2,3 @@ services:
postgres: postgres:
ports: ports:
- "127.0.0.1:${DB_PORT:-5433}:5432" - "127.0.0.1:${DB_PORT:-5433}:5432"
backend:
ports:
- "127.0.0.1:${BACKEND_PORT:-3001}:3000"
frontend:
ports:
- "127.0.0.1:${FRONTEND_PORT:-4322}:4321"

View file

@ -1,61 +1,61 @@
# Demo deployment - includes demo users, seed data, and restricted actions # Demo deployment - includes demo users, seed data, and restricted actions
# Usage: podman-compose --env-file compose/.env.demo -f compose/demo.yml up -d # Usage: podman-compose --env-file compose/.env.demo -f compose/demo.yml up -d
# Reset: podman-compose --env-file compose/.env.demo -f compose/demo.yml down -v; podman-compose --env-file compose/.env.demo -f compose/demo.yml up -d # Reset: podman-compose --env-file compose/.env.demo -f compose/demo.yml down -v; podman-compose --env-file compose/.env.demo -f compose/demo.yml up -d
services: services:
postgres: postgres:
image: postgres:16 image: postgres:16
container_name: likwid-demo-db container_name: likwid-demo-db
restart: unless-stopped restart: unless-stopped
environment: environment:
POSTGRES_USER: ${POSTGRES_USER:-likwid_demo} POSTGRES_USER: ${POSTGRES_USER:-likwid_demo}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-demo_secret_change_me} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-demo_secret_change_me}
POSTGRES_DB: ${POSTGRES_DB:-likwid_demo} POSTGRES_DB: ${POSTGRES_DB:-likwid_demo}
volumes: volumes:
- likwid_demo_data:/var/lib/postgresql/data - likwid_demo_data:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-likwid_demo}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-likwid_demo}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
backend: backend:
build: build:
context: ../backend context: ../backend
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
INCLUDE_DEMO_SEED: "true" INCLUDE_DEMO_SEED: "true"
container_name: likwid-demo-backend container_name: likwid-demo-backend
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${BACKEND_PORT:-3001}:3000" - "${BACKEND_BIND_HOST:-0.0.0.0}:${BACKEND_PORT:-3001}:3000"
environment: environment:
DATABASE_URL: postgres://${POSTGRES_USER:-likwid_demo}:${POSTGRES_PASSWORD:-demo_secret_change_me}@postgres:5432/${POSTGRES_DB:-likwid_demo} DATABASE_URL: postgres://${POSTGRES_USER:-likwid_demo}:${POSTGRES_PASSWORD:-demo_secret_change_me}@postgres:5432/${POSTGRES_DB:-likwid_demo}
JWT_SECRET: ${JWT_SECRET:-demo_jwt_secret_not_for_production} JWT_SECRET: ${JWT_SECRET:-demo_jwt_secret_not_for_production}
SERVER_HOST: 0.0.0.0 SERVER_HOST: 0.0.0.0
SERVER_PORT: 3000 SERVER_PORT: 3000
DEMO_MODE: "true" DEMO_MODE: "true"
RUST_LOG: info RUST_LOG: info
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy
frontend: frontend:
build: build:
context: ../frontend context: ../frontend
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
API_BASE: ${API_BASE:-http://localhost:3001} API_BASE: ${API_BASE:-http://localhost:3001}
container_name: likwid-demo-frontend container_name: likwid-demo-frontend
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${FRONTEND_PORT:-4322}:4321" - "${FRONTEND_BIND_HOST:-0.0.0.0}:${FRONTEND_PORT:-4322}:4321"
environment: environment:
INTERNAL_API_BASE: http://backend:3000 INTERNAL_API_BASE: http://backend:3000
API_BASE: ${API_BASE:-http://localhost:3001} API_BASE: ${API_BASE:-http://localhost:3001}
PUBLIC_DEMO_SITE: ${PUBLIC_DEMO_SITE:-false} PUBLIC_DEMO_SITE: ${PUBLIC_DEMO_SITE:-false}
depends_on: depends_on:
- backend - backend
volumes: volumes:
likwid_demo_data: likwid_demo_data: