diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index d961beb732..39d7869cf7 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -295,6 +295,14 @@ "safeForSimultaneousRushProcesses": true, "shellCommand": "cd ./dev && docker compose -f docker-compose.yaml -f docker-compose.min.yaml up -d --force-recreate" }, + { + "commandKind": "global", + "name": "docker:up:pg", + "summary": "Up development stack with PostgreSQL", + "description": "Start dev docker compose with PostgreSQL override (docker-compose.yaml + docker-compose.pg.yaml, profile=postgres)", + "safeForSimultaneousRushProcesses": true, + "shellCommand": "cd ./dev && docker compose -f docker-compose.yaml -f docker-compose.pg.yaml --profile postgres up -d --force-recreate" + }, { "commandKind": "global", "name": "docker:local", diff --git a/dev/.env b/dev/.env index b00c96ce2c..fd047df91b 100644 --- a/dev/.env +++ b/dev/.env @@ -1,6 +1,6 @@ STORAGE_CONFIG="datalake|http://huly.local:4030" MONGO_URL=mongodb://mongodb:27017?compressors=snappy -DB_URL_PG=postgresql://postgres:example@postgres:5432 +DB_URL_PG=postgres://postgres:postgres@postgres:5432/postgres BACKUP_STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin" BACKUP_BUCKET_NAME=dev-backups DB_CR_URL=postgresql://root@huly.local:26257/defaultdb?sslmode=disable diff --git a/dev/docker-compose.pg.yaml b/dev/docker-compose.pg.yaml new file mode 100644 index 0000000000..cb52f412c6 --- /dev/null +++ b/dev/docker-compose.pg.yaml @@ -0,0 +1,57 @@ +# PostgreSQL override: adds a local Postgres instance for dev. +# Use with: docker compose -f docker-compose.yaml -f docker-compose.pg.yaml --profile postgres up +# +# This does NOT change any DB_URLs automatically; services will still use whatever +# connection string you configure via env (e.g. DB_URL_PG in dev/.env). + +services: + postgres: + profiles: ["postgres"] + image: postgres:16 + extra_hosts: + - "huly.local:host-gateway" + command: ["postgres", "-p", "5432"] + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -p 5432"] + interval: 5s + timeout: 5s + retries: 10 + ports: + - 5432:5432 + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=postgres + restart: unless-stopped + + account: + environment: + - DB_URL=${DB_URL_PG} + + workspace_cockroach: + environment: + - DB_URL=${DB_URL_PG} + - ACCOUNTS_DB_URL=${DB_URL_PG} + + transactor_cockroach: + environment: + - DB_URL=${DB_URL_PG} + - COMMUNICATION_API_ENABLED=false + + fulltext_cockroach: + environment: + - DB_URL=${DB_URL_PG} + - COMMUNICATION_API_ENABLED=false + + export: + environment: + - DB_URL=${DB_URL_PG} + + datalake: + environment: + - DB_URL=${DB_URL_PG} + + front: + environment: + - COMMUNICATION_API_ENABLED=false +