direnv / process-compose

This commit is contained in:
Ashley Yakeley 2026-02-23 15:23:44 -08:00
parent c3093f1030
commit 5d7606f471
3 changed files with 57 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use nix -p nodejs postgresql python3 process-compose

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
dist
*.env
.pgdata
.direnv

55
process-compose.yaml Normal file
View File

@ -0,0 +1,55 @@
version: "0.5"
environment:
- "PGDATA=.pgdata"
- "PGHOST=.pgdata"
- "DATABASE_URL=postgresql:///annotatemap?host=${PWD}/.pgdata"
processes:
postgres-init:
command: |
if [ ! -f .pgdata/PG_VERSION ]; then
initdb -D .pgdata
fi
availability:
restart: "no"
postgres:
command: postgres -D .pgdata -k "$PWD/.pgdata" -c listen_addresses=
depends_on:
postgres-init:
condition: process_completed_successfully
readiness_probe:
exec:
command: pg_isready -h "$PWD/.pgdata"
initial_delay_seconds: 1
period_seconds: 1
db-setup:
command: |
createdb -h "$PWD/.pgdata" annotatemap 2>/dev/null || true
psql -h "$PWD/.pgdata" annotatemap < server/src/schema.sql
depends_on:
postgres:
condition: process_healthy
availability:
restart: "no"
shared-build:
command: npm run build --workspace=shared
availability:
restart: "no"
server:
command: npm run dev:server
depends_on:
db-setup:
condition: process_completed_successfully
shared-build:
condition: process_completed_successfully
client:
command: npm run dev:client
depends_on:
shared-build:
condition: process_completed_successfully