syncstorage-rs/docker-compose.postgres.yaml
Barry Chen 6c6c06ffbe
chore: run Postgres tests and clippy in CI (#1923)
Update CircleCI config to run and test sync server on Postgres
2025-12-16 12:04:16 -08:00

93 lines
2.5 KiB
YAML

services:
sync-db:
image: docker.io/library/postgres:18.0
volumes:
- sync_db_data:/var/lib/postgresql/18/docker
restart: always
ports:
- "5432"
environment:
POSTGRES_DB: syncstorage
POSTGRES_USER: test
POSTGRES_PASSWORD: test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test -d syncstorage"]
interval: 2s
retries: 10
start_period: 20s
timeout: 2s
sync-db-setup:
image: app:build
depends_on:
sync-db:
condition: service_healthy
restart: "no"
entrypoint:
- /bin/sh
- -c
- sleep infinity
environment:
SYNC_SYNCSTORAGE__DATABASE_URL: postgres://test:test@sync-db:5432/syncstorage
tokenserver-db:
image: docker.io/library/postgres:18.0
volumes:
- tokenserver_db_data:/var/lib/postgresql/18/docker
restart: always
ports:
- "5432"
environment:
POSTGRES_DB: tokenserver
POSTGRES_USER: test
POSTGRES_PASSWORD: test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test -d tokenserver"]
interval: 2s
retries: 10
start_period: 20s
timeout: 2s
mock-fxa-server:
image: app:build
restart: "no"
entrypoint: "sh /app/scripts/start_mock_fxa_server.sh"
environment:
MOCK_FXA_SERVER_HOST: 0.0.0.0
MOCK_FXA_SERVER_PORT: 6000
syncserver:
# NOTE: The naming in the rest of this repository has been updated to reflect the fact
# that Syncstorage and Tokenserver are now part of one repository/server called
# "Syncserver" (updated from "syncstorage-rs"). We keep the legacy naming below for
# backwards compatibility with previous Docker images.
image: ${SYNCSTORAGE_RS_IMAGE:-syncstorage-rs:latest}
restart: always
ports:
- "8000:8000"
depends_on:
sync-db-setup:
condition: service_started
tokenserver-db:
condition: service_healthy
environment:
SYNC_HOST: 0.0.0.0
SYNC_MASTER_SECRET: secret0
SYNC_SYNCSTORAGE__DATABASE_URL: postgres://test:test@sync-db:5432/syncstorage
SYNC_TOKENSERVER__DATABASE_URL: postgres://test:test@tokenserver-db:5432/tokenserver
SYNC_TOKENSERVER__RUN_MIGRATIONS: "true"
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/__heartbeat__ || exit 1"]
interval: 2s
retries: 5
start_period: 30s
timeout: 3s
volumes:
sync_db_data:
tokenserver_db_data:
# Application runs off of port 8000.
# you can test if it's available with
# curl "http://localhost:8000/__heartbeat__"