mirror of
https://github.com/Dokploy/templates.git
synced 2026-07-10 00:15:28 +02:00
The template pointed PS_DATA_SOURCE_URI at a placeholder connection string (postgresql://user:password@host:5432/db), so the PowerSync service could never connect and crash-looped, leaving the domain returning Traefik 404s. Changes: - Add a bundled Postgres 17 service with wal_level=logical, a healthcheck, and a persistent volume; powersync waits for it to be healthy before starting. - Replace the base64-encoded config env var with a readable powersync.yaml mounted via [[config.mounts]]. Replication reads from the powersync database and bucket storage uses a separate powersync_storage database (Postgres storage requires a database distinct from the replication source). - Add an init SQL mount that creates the storage database, a demo "lists" table synced by the default sync rules, and the powersync publication required for logical replication. - Replace the unsupported sync_config block with standard sync_rules, and add an HS256 dev key so client auth works out of the box. - Remove host port mapping (Traefik routes to the container port) and point the template domain at /probes/liveness since PowerSync has no route on "/". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
34 lines
950 B
YAML
34 lines
950 B
YAML
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
restart: unless-stopped
|
|
command: ["postgres", "-c", "wal_level=logical"]
|
|
environment:
|
|
POSTGRES_USER: powersync
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: powersync
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
- ../files/init-powersync.sql:/docker-entrypoint-initdb.d/init-powersync.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U powersync -d powersync"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 12
|
|
|
|
powersync:
|
|
image: journeyapps/powersync-service:1.21.0
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
POWERSYNC_CONFIG_PATH: /config/powersync.yaml
|
|
NODE_OPTIONS: --max-old-space-size=1000
|
|
volumes:
|
|
- ../files/powersync.yaml:/config/powersync.yaml:ro
|
|
command: ["start", "-r", "unified"]
|
|
|
|
volumes:
|
|
postgres-data:
|