diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..d3e100d --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix -p nodejs postgresql python3 process-compose diff --git a/.gitignore b/.gitignore index 43fb149..a442400 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules dist *.env .pgdata +.direnv diff --git a/process-compose.yaml b/process-compose.yaml new file mode 100644 index 0000000..e42d6e3 --- /dev/null +++ b/process-compose.yaml @@ -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