inmemory to postgres
This commit is contained in:
@@ -1,4 +1,25 @@
|
||||
services:
|
||||
# PostgreSQL database for real-world testing
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
- POSTGRES_DB=gridpilot_test
|
||||
- POSTGRES_USER=gridpilot_test_user
|
||||
- POSTGRES_PASSWORD=gridpilot_test_pass
|
||||
ports:
|
||||
- "5433:5432" # Use different port to avoid conflicts with dev
|
||||
volumes:
|
||||
- test_db_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- gridpilot-test-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U gridpilot_test_user -d gridpilot_test"]
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 10
|
||||
start_period: 5s
|
||||
restart: "no"
|
||||
|
||||
# Ready check - simple service that verifies dependencies are available
|
||||
ready:
|
||||
image: node:20-alpine
|
||||
@@ -15,26 +36,32 @@ services:
|
||||
- gridpilot-test-network
|
||||
restart: "no"
|
||||
|
||||
# Real API server (not mock)
|
||||
# Real API server with TypeORM/PostgreSQL
|
||||
api:
|
||||
image: node:20-alpine
|
||||
working_dir: /app/apps/api
|
||||
environment:
|
||||
- NODE_ENV=test
|
||||
- PORT=3000
|
||||
- GRIDPILOT_API_PERSISTENCE=inmemory
|
||||
- GRIDPILOT_API_PERSISTENCE=postgres
|
||||
- GRIDPILOT_API_BOOTSTRAP=true
|
||||
- GRIDPILOT_API_FORCE_RESEED=true
|
||||
- GRIDPILOT_FEATURES_JSON={"sponsors.portal":"enabled","admin.dashboard":"enabled"}
|
||||
- DATABASE_URL=postgres://gridpilot_test_user:gridpilot_test_pass@db:5432/gridpilot_test
|
||||
- POSTGRES_DB=gridpilot_test
|
||||
- POSTGRES_USER=gridpilot_test_user
|
||||
- POSTGRES_PASSWORD=gridpilot_test_pass
|
||||
ports:
|
||||
- "3101:3000"
|
||||
volumes:
|
||||
- ./:/app
|
||||
- /Users/marcmintel/Projects/gridpilot/node_modules:/app/node_modules:ro
|
||||
command: ["sh", "-lc", "echo '[api] Starting real API...'; npm run start:dev"]
|
||||
command: ["sh", "-lc", "echo '[api] Starting real API with TypeORM...'; npm run start:dev"]
|
||||
depends_on:
|
||||
ready:
|
||||
condition: service_completed_successfully
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- gridpilot-test-network
|
||||
restart: unless-stopped
|
||||
@@ -88,4 +115,7 @@ services:
|
||||
|
||||
networks:
|
||||
gridpilot-test-network:
|
||||
driver: bridge
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
test_db_data:
|
||||
Reference in New Issue
Block a user