Complete guide to Oddiya configuration files and environment setup.
| File | Purpose | Use When |
|---|---|---|
docker-compose.yml |
Production deployment | Deploying to AWS EC2 |
docker-compose.local.yml |
Local development | Developing locally with full stack |
Key Differences:
| Feature | docker-compose.yml | docker-compose.local.yml |
|---|---|---|
| Database | None (stateless) | PostgreSQL 17.0 |
| Redis | Included | Included |
| Services | API Gateway, Plan, LLM Agent | All 7 services |
| Nginx | Yes (port 80) | No |
| Health Checks | No | Yes |
| Restart Policy | unless-stopped | unless-stopped |
Each service has its own application.yml:
services/
βββ api-gateway/src/main/resources/application.yml
βββ auth-service/src/main/resources/application.yml
βββ plan-service/src/main/resources/
β βββ application.yml # Default profile
β βββ application-local.yml # Local development profile
βββ user-service/src/main/resources/application.yml
βββ video-service/src/main/resources/application.yml
All services require these environment variables:
# LLM Provider (Google Gemini)
GOOGLE_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash-exp
# OAuth (Optional but recommended)
GOOGLE_CLIENT_ID=your_google_oauth_client_id
GOOGLE_CLIENT_SECRET=your_google_oauth_secret
# Redis
REDIS_HOST=localhost # or 'redis' in Docker
REDIS_PORT=6379Additional variables for local development with docker-compose.local.yml:
# PostgreSQL Database
DB_HOST=localhost # or 'postgres' in Docker
DB_PORT=5432
DB_NAME=oddiya
DB_USER=oddiya_user
DB_PASSWORD=oddiya_password_devFor production deployment with docker-compose.yml:
# Service Configuration
SPRING_PROFILES_ACTIVE=prod
LLM_AGENT_URL=http://llm-agent:8000Start command:
docker-compose -f docker-compose.local.yml up -dWhat runs:
- PostgreSQL (5432)
- Redis (6379)
- Auth Service (8081)
- User Service (8082)
- Plan Service (8083)
- Video Service (8084)
- API Gateway (8080)
- LLM Agent (8000)
Environment setup:
# Create .env file
cat > .env << 'EOF'
GOOGLE_API_KEY=your_key_here
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_secret
REDIS_HOST=redis
DB_HOST=postgres
EOFStart command:
docker-compose up -dWhat runs:
- Nginx (80, 443)
- API Gateway (8080)
- Plan Service (8083)
- LLM Agent (8000)
- Redis (6379)
Environment setup:
# Create .env file on EC2
cat > .env << 'EOF'
GOOGLE_API_KEY=your_production_key
GEMINI_MODEL=gemini-2.0-flash-exp
REDIS_HOST=redis
SPRING_PROFILES_ACTIVE=prod
EOFWhy no database? Production deployment uses stateless architecture:
- No user data persistence (for MVP simplicity)
- Lower resource requirements
- Fits in t2.micro (1GB RAM)
Services support multiple profiles via SPRING_PROFILES_ACTIVE:
Profile: default (no environment variable set)
- Uses embedded H2 database
- Mock external APIs
- For quick testing
Profile: local
- Uses PostgreSQL
- Real Redis
- Local development setup
Profile: prod
- Production-optimized settings
- Real external APIs
- Cache enabled
In Docker Compose:
environment:
- SPRING_PROFILES_ACTIVE=prodIn Command Line:
java -jar app.jar --spring.profiles.active=localIn application.yml:
spring:
profiles:
active: localUse .env file (NOT committed to git):
# .env
GOOGLE_API_KEY=your_key
GOOGLE_CLIENT_ID=your_id
GOOGLE_CLIENT_SECRET=your_secretLoad with:
export $(cat .env | xargs)Or use with Docker Compose (automatic):
docker-compose up -d # Reads .env automaticallyOption 1: Environment variables
export GOOGLE_API_KEY=your_production_keyOption 2: AWS Secrets Manager
# Store secret
aws secretsmanager create-secret \
--name oddiya/google-api-key \
--secret-string "your_key"
# Retrieve in application
# (Requires AWS SDK integration)Option 3: .env file on EC2
# Create on EC2 instance
sudo nano /opt/oddiya/.env
# Restrict permissions
sudo chmod 600 /opt/oddiya/.envTemplate for environment variables:
# Copy this to .env and fill in your values
# DO NOT commit .env to git
# ============================================
# Required - Google Gemini AI
# ============================================
GOOGLE_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash-exp
# ============================================
# Optional - OAuth
# ============================================
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# ============================================
# Infrastructure (Local Development)
# ============================================
DB_HOST=postgres
DB_PORT=5432
DB_NAME=oddiya
DB_USER=oddiya_user
DB_PASSWORD=oddiya_password_dev
REDIS_HOST=redis
REDIS_PORT=6379
# ============================================
# Infrastructure (Production)
# ============================================
# Use 'redis' when running in Docker Compose
# Use 'localhost' when running services directly
REDIS_HOST=redis
SPRING_PROFILES_ACTIVE=prodExpo build configuration:
{
"build": {
"production": {
"android": {
"buildType": "apk"
},
"ios": {
"buildConfiguration": "Release"
}
},
"development": {
"android": {
"buildType": "apk"
},
"developmentClient": true,
"distribution": "internal"
}
}
}Expo app configuration:
{
"expo": {
"name": "Oddiya",
"slug": "oddiya",
"version": "1.0.0",
"ios": {
"bundleIdentifier": "com.oddiya.app",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.oddiya.app",
"versionCode": 1
}
}
}Use the validation script:
./scripts/validate-env.shChecks:
- β Required variables exist
- β Database connectivity
- β Redis connectivity
- β API keys valid
- β Service URLs reachable
# Check variables are set
echo $GOOGLE_API_KEY
# Test Redis
redis-cli ping
# Test PostgreSQL (local dev)
psql -h localhost -U oddiya_user -d oddiya -c "SELECT 1"
# Test service health
curl http://localhost:8080/health# Check if set
echo $GOOGLE_API_KEY
# Set it
export GOOGLE_API_KEY=your_key
# Or add to .env file
echo "GOOGLE_API_KEY=your_key" >> .env# Check PostgreSQL is running
docker ps | grep postgres
# Check connection
psql -h localhost -U oddiya_user -d oddiya
# Restart database
docker-compose -f docker-compose.local.yml restart postgres# Check Redis is running
docker ps | grep redis
# Test connection
redis-cli ping
# Restart Redis
docker-compose restart redis# Check logs
docker-compose logs [service-name]
# Common issues:
# - Port already in use
# - Environment variables missing
# - Dependency services not runningGet your API key:
- Visit https://makersuite.google.com/app/apikey
- Create new API key
- Copy to
.envfile
Free tier: 15 requests/minute
Setup OAuth credentials:
- Visit https://console.cloud.google.com
- Create new project
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs
- Copy Client ID and Secret to
.env
See: OAuth Setup Guide
Last Updated: 2025-11-03