Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_PORT=8080
DATABASE_URL=
USE_EXTERNAL_POSTGRES=false
# Update the host segment if PostgreSQL runs elsewhere (e.g., the Docker host's LAN IP on Linux).
DATABASE_URL=postgresql://dockpilot:dockpilot@host.docker.internal:5432/dockpilot
SESSION_SECRET=
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change-me-now
Expand Down
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,18 @@ Follow the steps below to install and run DockPilot from a clean machine:
```
Edit `.env` and provide secure values for `SESSION_SECRET`, `ADMIN_PASSWORD`, `APP_PORT`, and optional Docker / AI settings.
4. **Prepare PostgreSQL**
- If you already have a PostgreSQL instance, ensure the database defined by `DATABASE_URL` exists and is reachable from the Docker host. Set `USE_EXTERNAL_POSTGRES=true` in `.env` and skip the bundled database profile when starting Compose.
- Otherwise, use the bundled `postgres` service (enabled via the `local-db` Compose profile).
- DockPilot relies on an existing PostgreSQL instance. Create the database referenced by `DATABASE_URL` and ensure the container can reach it over the network. When Docker runs on the same host as PostgreSQL, `host.docker.internal` (macOS/Windows) or the host's LAN IP (Linux) is typically the correct hostname.
5. **Apply the database schema**
```bash
psql "$DATABASE_URL" -f db/schema.pg.sql
```
This initializes tables, triggers, and optional storage history support.
6. **Build and start the Docker Compose stack**

**A. With the bundled PostgreSQL container**
```bash
docker compose --profile app --profile local-db up -d --build
docker compose up -d --build
```

**B. With an existing PostgreSQL instance**
```bash
# Ensure DATABASE_URL points at your external database and USE_EXTERNAL_POSTGRES=true
docker compose --profile app up -d --build
```

The command launches a single `dockpilot-app` container that hosts the API, UI, and lightweight gateway. Add the `local-db` profile only when you want Compose to run PostgreSQL for you.
This launches the single `dockpilot-app` container that hosts the API, UI, and lightweight gateway.
7. **Verify service health**
```bash
docker compose ps
Expand All @@ -71,11 +62,9 @@ If you update container dependencies (for example, adjusting `api/package.json`
```bash
docker compose down
docker compose build --no-cache
docker compose --profile app --profile local-db up -d
docker compose up -d
```

Remove the `local-db` profile flag if you rely on an external PostgreSQL instance.

## Getting Started

If you already have the prerequisites and configuration in place, the condensed setup is:
Expand All @@ -85,9 +74,9 @@ If you already have the prerequisites and configuration in place, the condensed
psql "$DATABASE_URL" -f db/schema.pg.sql
```
2. Copy `.env.example` to `.env` and fill in secrets.
3. Build and launch the stack (choose the appropriate profile set):
3. Build and launch the stack:
```bash
docker compose --profile app --profile local-db up -d --build
docker compose up -d --build
```
4. Visit the UI and log in with the owner credentials from `.env`. Change the password on first login.

Expand All @@ -96,15 +85,13 @@ If you already have the prerequisites and configuration in place, the condensed
| Service | Description |
| ------- | ----------- |
| `app` | Combined container that runs the API, UI (Nuxt Nitro server), and Express gateway on port 8080. |
| `postgres` | PostgreSQL 16 database, enabled only when the `local-db` profile is used. |

## Environment Variables

See `.env.example` for required configuration. Notable values:

- `APP_PORT`: host port that exposes the combined gateway (defaults to 8080).
- `DATABASE_URL`: PostgreSQL connection string. Leave empty when using the bundled database and it will default to the Compose service.
- `USE_EXTERNAL_POSTGRES`: set to `true` when you do **not** want Compose to start PostgreSQL.
- `DATABASE_URL`: PostgreSQL connection string that points to your existing database. Ensure the hostname is reachable from inside the container (for example, `host.docker.internal`).
- `SESSION_SECRET`: 64-byte secret for encrypted cookies (hex or base64).
- `ADMIN_USERNAME` / `ADMIN_PASSWORD`: bootstrap owner credentials.
- `HEALTH_INTERVAL_MS`, `HEALTH_TIMEOUT_MS`: tweak health check cadence and timeout.
Expand Down
21 changes: 1 addition & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: dockpilot-app
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL:-postgresql://dockpilot:dockpilot@postgres:5432/dockpilot}
DATABASE_URL: ${DATABASE_URL}
NODE_ENV: production
PORT: ${APP_PORT:-8080}
API_PORT: 3001
Expand All @@ -16,27 +16,8 @@ services:
restart: unless-stopped
volumes:
- ./uploads:/app/uploads
profiles:
- app
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:8080/healthz || exit 1"]
interval: 10s
timeout: 3s
retries: 10

postgres:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_DB: dockpilot
POSTGRES_USER: dockpilot
POSTGRES_PASSWORD: dockpilot
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
profiles:
- local-db

volumes:
pgdata: