feat: database

This commit is contained in:
2025-11-16 10:33:59 +01:00
parent 3cf9601a71
commit 1417023395
14 changed files with 1436 additions and 192 deletions

View File

@@ -1,6 +1,22 @@
version: '3.8'
services:
postgres:
image: postgres:16-alpine
container_name: linkding-postgres
environment:
- POSTGRES_DB=${DB_NAME:-linkding}
- POSTGRES_USER=${DB_USER:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
volumes:
- postgres-data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
interval: 10s
timeout: 3s
retries: 5
linkding:
build: .
container_name: linkding
@@ -13,6 +29,14 @@ services:
- NODE_ENV=production
- PORT=3000
- CHROME_EXECUTABLE_PATH=/usr/bin/chromium
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=${DB_NAME:-linkding}
- DB_USER=${DB_USER:-postgres}
- DB_PASSWORD=${DB_PASSWORD:-postgres}
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/links', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
@@ -21,3 +45,6 @@ services:
retries: 3
start_period: 5s
volumes:
postgres-data: