diff --git a/.env.production b/.env.production index 090f448..600006f 100644 --- a/.env.production +++ b/.env.production @@ -6,3 +6,6 @@ JWT_SECRET=your-super-secure-jwt-secret-change-this-now-2024 # Domain DOMAIN=zerp.atmata-group.com + +# Prisma / Database pooling +DATABASE_URL=postgresql://postgres:SecurePassword123!ChangeMe@postgres:5432/mind14_crm?schema=public&connection_limit=5&pool_timeout=20&connect_timeout=20 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 598655a..e21ab86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,11 +24,11 @@ services: context: ./backend dockerfile: Dockerfile container_name: zerp_backend - restart: unless-stopped + restart: always environment: PORT: 5001 NODE_ENV: production - DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-postgres123}@postgres:5432/mind14_crm?schema=public + DATABASE_URL: ${DATABASE_URL} JWT_SECRET: ${JWT_SECRET:-z-crm-jwt-secret-change-in-production-NOW} JWT_EXPIRES_IN: 7d JWT_REFRESH_EXPIRES_IN: 30d @@ -39,6 +39,12 @@ services: condition: service_healthy ports: - "5001:5001" + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:5001/api/v1/health || exit 1"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s command: sh -c "npx prisma migrate deploy && node dist/server.js" frontend: