fix deployment by adding postgres service to base compose
This commit is contained in:
@@ -6,7 +6,12 @@ NPM_VERSION=latest
|
||||
APP_PORT=3000
|
||||
|
||||
# Better Auth / PostgreSQL
|
||||
# For app running outside Docker, localhost is typical.
|
||||
# In Docker Compose deployment, default internal host is: postgres
|
||||
DATABASE_URL=postgres://postgres:postgres@localhost:5432/fiscal_clone
|
||||
POSTGRES_DB=fiscal_clone
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
BETTER_AUTH_SECRET=replace-with-a-long-random-secret
|
||||
BETTER_AUTH_BASE_URL=http://localhost:3000
|
||||
BETTER_AUTH_ADMIN_USER_IDS=
|
||||
|
||||
@@ -39,8 +39,9 @@ docker compose up --build -d
|
||||
```
|
||||
|
||||
For local Docker, host port mapping comes from `docker-compose.override.yml` (default `http://localhost:3000`, configurable via `APP_PORT`).
|
||||
The local override also starts PostgreSQL and wires `DATABASE_URL` to `postgres://postgres:postgres@postgres:5432/fiscal_clone`.
|
||||
For Coolify/remote Docker Compose, only container port `3000` is exposed internally (no fixed host port bind), avoiding host port collisions.
|
||||
The base Docker Compose now includes an internal PostgreSQL service (`postgres`) used by Better Auth by default.
|
||||
For Coolify/remote Docker Compose, only app container port `3000` is exposed internally (no fixed host port bind), avoiding host port collisions.
|
||||
If you use an external Postgres instance, set `DATABASE_URL` explicitly.
|
||||
Runtime data persists in the `app_data` volume (`/app/data` in container).
|
||||
Docker builds install the npm version from `NPM_VERSION` (default `latest`).
|
||||
|
||||
@@ -52,6 +53,9 @@ Use root `.env` or root `.env.local`:
|
||||
# leave blank for same-origin API
|
||||
NEXT_PUBLIC_API_URL=
|
||||
DATABASE_URL=postgres://postgres:postgres@localhost:5432/fiscal_clone
|
||||
POSTGRES_DB=fiscal_clone
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
BETTER_AUTH_SECRET=replace-with-a-long-random-secret
|
||||
BETTER_AUTH_BASE_URL=http://localhost:3000
|
||||
BETTER_AUTH_ADMIN_USER_IDS=
|
||||
|
||||
@@ -2,28 +2,6 @@ services:
|
||||
app:
|
||||
ports:
|
||||
- '${APP_PORT:-3000}:3000'
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DATABASE_URL: ${DATABASE_URL:-postgres://postgres:postgres@postgres:5432/fiscal_clone}
|
||||
BETTER_AUTH_BASE_URL: ${BETTER_AUTH_BASE_URL:-http://localhost:3000}
|
||||
BETTER_AUTH_TRUSTED_ORIGINS: ${BETTER_AUTH_TRUSTED_ORIGINS:-http://localhost:3000}
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: fiscal_clone
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U postgres -d fiscal_clone']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
PORT: 3000
|
||||
HOSTNAME: 0.0.0.0
|
||||
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-}
|
||||
DATABASE_URL: ${DATABASE_URL:-}
|
||||
DATABASE_URL: ${DATABASE_URL:-postgres://postgres:postgres@postgres:5432/fiscal_clone}
|
||||
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:-}
|
||||
BETTER_AUTH_BASE_URL: ${BETTER_AUTH_BASE_URL:-}
|
||||
BETTER_AUTH_ADMIN_USER_IDS: ${BETTER_AUTH_ADMIN_USER_IDS:-}
|
||||
@@ -23,6 +23,9 @@ services:
|
||||
OPENCLAW_API_KEY: ${OPENCLAW_API_KEY:-}
|
||||
OPENCLAW_MODEL: ${OPENCLAW_MODEL:-zeroclaw}
|
||||
SEC_USER_AGENT: ${SEC_USER_AGENT:-Fiscal Clone <support@fiscal.local>}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1:3000/api/health || exit 1"]
|
||||
interval: 30s
|
||||
@@ -33,5 +36,21 @@ services:
|
||||
volumes:
|
||||
- app_data:/app/data
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-fiscal_clone}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-fiscal_clone}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
app_data:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user