diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..c56be7e --- /dev/null +++ b/.env.production.example @@ -0,0 +1,86 @@ +# ParentFlow Production Environment Variables +# Copy this file to .env.production and update with your secure values + +# Database Configuration (PostgreSQL) +POSTGRES_PASSWORD=parentflow_secure_password_2024 + +# Redis Configuration +REDIS_PASSWORD=parentflow_redis_password_2024 + +# MongoDB Configuration +MONGO_PASSWORD=parentflow_mongo_password_2024 + +# MinIO (Object Storage) Configuration +MINIO_ROOT_USER=parentflow_minio_admin +MINIO_ROOT_PASSWORD=parentflow_minio_password_2024 + +# Backend Application Configuration +NODE_ENV=production +API_PORT=3020 +PORT=3020 + +# Database Connection +DATABASE_HOST=parentflow-postgres-prod +DATABASE_PORT=5432 +DATABASE_NAME=parentflow_production +DATABASE_USER=parentflow_user +DATABASE_PASSWORD=parentflow_secure_password_2024 +DATABASE_SSL=false + +# Redis Connection +REDIS_HOST=parentflow-redis-prod +REDIS_PORT=6379 +REDIS_PASSWORD=parentflow_redis_password_2024 + +# MongoDB Connection +MONGODB_URI=mongodb://parentflow_admin:parentflow_mongo_password_2024@parentflow-mongodb-prod:27017/parentflow_ai_chat?authSource=admin + +# MinIO Connection +MINIO_ENDPOINT=parentflow-minio-prod +MINIO_PORT=9000 +MINIO_USE_SSL=false +MINIO_ACCESS_KEY=parentflow_minio_admin +MINIO_SECRET_KEY=parentflow_minio_password_2024 + +# JWT Secrets (CHANGE THESE!) +JWT_SECRET=CHANGE_THIS_TO_A_SECURE_RANDOM_STRING_64_CHARS +JWT_REFRESH_SECRET=CHANGE_THIS_TO_ANOTHER_SECURE_RANDOM_STRING_64_CHARS + +# CORS Configuration +CORS_ORIGIN=https://web.parentflowapp.com,https://api.parentflowapp.com + +# API Configuration +API_URL=https://api.parentflowapp.com + +# Frontend Configuration +NEXT_PUBLIC_API_URL=https://api.parentflowapp.com +NEXT_PUBLIC_GRAPHQL_URL=https://api.parentflowapp.com/graphql +NEXT_PUBLIC_WS_URL=wss://api.parentflowapp.com/ws + +# OpenAI API (for AI features) +OPENAI_API_KEY=your-openai-api-key-here + +# Email Configuration (for notifications) +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_USER=noreply@parentflowapp.com +SMTP_PASSWORD=your-smtp-password +SMTP_FROM=ParentFlow + +# Application Settings +APP_URL=https://web.parentflowapp.com +APP_NAME=ParentFlow + +# Logging +LOG_LEVEL=info +LOG_FORMAT=json + +# Security +SESSION_SECRET=CHANGE_THIS_TO_A_SECURE_RANDOM_STRING +RATE_LIMIT_MAX=100 +RATE_LIMIT_WINDOW_MS=60000 + +# Feature Flags +ENABLE_ANALYTICS=true +ENABLE_AI_CHAT=true +ENABLE_VOICE_COMMANDS=true \ No newline at end of file diff --git a/docker-compose.production.yml b/docker-compose.production.yml new file mode 100644 index 0000000..1442401 --- /dev/null +++ b/docker-compose.production.yml @@ -0,0 +1,98 @@ +version: '3.8' + +services: + postgres: + image: pgvector/pgvector:pg15 + container_name: parentflow-postgres-prod + environment: + POSTGRES_DB: parentflow_production + POSTGRES_USER: parentflow_user + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-parentflow_secure_password_2024} + ports: + - "5432:5432" + volumes: + - postgres_prod_data:/var/lib/postgresql/data + - ./maternal-app/maternal-app-backend/src/database/migrations:/docker-entrypoint-initdb.d:ro + networks: + - parentflow-network + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U parentflow_user -d parentflow_production"] + interval: 10s + timeout: 5s + retries: 5 + + redis: + image: redis:7-alpine + container_name: parentflow-redis-prod + ports: + - "6379:6379" + volumes: + - redis_prod_data:/data + networks: + - parentflow-network + command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-parentflow_redis_password_2024} + restart: unless-stopped + healthcheck: + test: ["CMD", "redis-cli", "--raw", "incr", "ping"] + interval: 10s + timeout: 3s + retries: 5 + + mongodb: + image: mongo:4.4 + container_name: parentflow-mongodb-prod + environment: + MONGO_INITDB_ROOT_USERNAME: parentflow_admin + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD:-parentflow_mongo_password_2024} + MONGO_INITDB_DATABASE: parentflow_ai_chat + ports: + - "27017:27017" + volumes: + - mongodb_prod_data:/data/db + - mongodb_prod_config:/data/configdb + networks: + - parentflow-network + restart: unless-stopped + healthcheck: + test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet + interval: 10s + timeout: 5s + retries: 5 + + minio: + image: minio/minio:RELEASE.2023-01-25T00-19-54Z + container_name: parentflow-minio-prod + environment: + MINIO_ROOT_USER: ${MINIO_ROOT_USER:-parentflow_minio_admin} + MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-parentflow_minio_password_2024} + ports: + - "9000:9000" + - "9001:9001" + volumes: + - minio_prod_data:/data + networks: + - parentflow-network + command: server /data --console-address ":9001" + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + +networks: + parentflow-network: + driver: bridge + +volumes: + postgres_prod_data: + driver: local + redis_prod_data: + driver: local + mongodb_prod_data: + driver: local + mongodb_prod_config: + driver: local + minio_prod_data: + driver: local \ No newline at end of file