version: '3.8' services: app: build: . ports: - "7860:7860" volumes: # Persist audit logs generated by the app container to the host # The path inside the container is /app/tensorus_audit.log as defined in tensorus/audit.py (implicitly if WORKDIR is /app) - ./tensorus_audit.log:/app/tensorus_audit.log environment: # Python settings PYTHONUNBUFFERED: 1 # Tensorus App Settings TENSORUS_STORAGE_BACKEND: postgres TENSORUS_POSTGRES_HOST: db # Service name of the postgres container TENSORUS_POSTGRES_PORT: 5432 # Default postgres port, container to container TENSORUS_POSTGRES_USER: tensorus_user_compose TENSORUS_POSTGRES_PASSWORD: tensorus_password_compose TENSORUS_POSTGRES_DB: tensorus_db_compose # TENSORUS_POSTGRES_DSN: "" # Can be set if preferred over individual params TENSORUS_API_KEY_HEADER_NAME: "X-API-KEY" TENSORUS_VALID_API_KEYS: "compose_key1,another_secure_key" # Comma-separated or JSON list of keys TENSORUS_AUTH_JWT_ENABLED: "False" # TENSORUS_AUTH_JWT_ISSUER: "your_issuer_here" # TENSORUS_AUTH_JWT_AUDIENCE: "tensorus_api_audience" # TENSORUS_AUTH_JWT_ALGORITHM: "RS256" # TENSORUS_AUTH_JWT_JWKS_URI: "your_jwks_uri_here" TENSORUS_AUTH_DEV_MODE_ALLOW_DUMMY_JWT: "False" depends_on: db: condition: service_healthy # Wait for db to be healthy (Postgres specific healthcheck needed in db service) # For simpler startup without healthcheck, just `depends_on: - db` is fine, # but app might start before DB is ready. Entrypoint script in app can handle retries then. db: image: postgres:15-alpine volumes: - postgres_data:/var/lib/postgresql/data/ # Persist data environment: POSTGRES_USER: tensorus_user_compose # Must match app's TENSORUS_POSTGRES_USER POSTGRES_PASSWORD: tensorus_password_compose # Must match app's TENSORUS_POSTGRES_PASSWORD POSTGRES_DB: tensorus_db_compose # Must match app's TENSORUS_POSTGRES_DB ports: - "5433:5432" # Expose Postgres on host port 5433 to avoid conflict if local PG runs on 5432 healthcheck: # Basic healthcheck for Postgres test: ["CMD-SHELL", "pg_isready -U tensorus_user_compose -d tensorus_db_compose"] interval: 10s timeout: 5s retries: 5 volumes: postgres_data: # Defines the named volume for data persistence driver: local