Overview
The Engineering Knowledge Graph uses Docker Compose for local development and can be deployed to production using containerized infrastructure. The system consists of two main services:- Neo4j: Graph database for storing the knowledge graph
- EKG App: FastAPI application serving the web interface and API
Prerequisites
Before deploying, ensure you have:- Docker and Docker Compose installed
- Python 3.11+ (for local development)
- Gemini API key from Google AI Studio
Docker Compose Deployment
Configuration
The system uses environment variables for configuration. Create a.env file based on .env.example:
.env
Services Configuration
Thedocker-compose.yml defines the complete stack:
docker-compose.yml
Key Features
Health Checks
Health Checks
The Neo4j service includes a health check that ensures the database is ready before the application starts:The
ekg-app service waits for Neo4j to be healthy:Persistent Storage
Persistent Storage
Named volumes ensure data persistence across container restarts:
neo4j_data: Stores graph database dataneo4j_logs: Stores Neo4j logs./data: Mounted for configuration files (docker-compose.yml, teams.yaml, k8s-deployments.yaml)
Development Mode
Development Mode
The application runs with hot-reload enabled for development:The entire source directory is mounted for live code updates:
Starting the System
Quick Start
First-Time Setup
-
Clone the repository
-
Configure environment variables
-
Start the services
-
Wait for initialization
The application will automatically:
- Connect to Neo4j (see main.py:89)
- Load configuration data from
data/directory (see main.py:99-129) - Populate the graph database (see main.py:132-135)
-
Access the application
- Web interface: http://localhost:8000
- Neo4j Browser: http://localhost:7474
- API docs: http://localhost:8000/docs
Dockerfile Structure
The application uses a multi-stage build optimized for Python:Dockerfile
Build Optimization
- Uses
python:3.11-slimfor smaller image size - Installs only required system dependencies (gcc for building Python packages)
- Leverages Docker layer caching by copying
requirements.txtfirst - Cleans up apt cache to reduce image size
- Uses
--no-cache-dirto avoid storing pip cache
Production Deployment
Environment Variables
For production, override the default environment variables:Production Configuration
Create adocker-compose.prod.yml for production overrides:
docker-compose.prod.yml
Stopping and Cleanup
Data Management
Loading Configuration Data
The system automatically loads configuration files from thedata/ directory on startup (see chat/app.py:90-134):
Reloading Data
To reload configuration without restarting:Next Steps
Monitoring
Set up health checks and monitoring
Troubleshooting
Common issues and solutions