This directory contains Docker configurations for both PostgreSQL and Apache Age graph databases.
Uses standard PostgreSQL with pgvector extension.
docker-compose -f docker/docker-compose.yml up -ddocker-compose -f docker/docker-compose.yml downdocker-compose -f docker/docker-compose.yml down -vUses Apache Age extension for PostgreSQL with native graph capabilities.
- Start the Apache Age container:
docker-compose -f docker/docker-compose-age.yml up -d- Initialize the Age extension:
./docker/init-age.shThis will:
- Create the Age extension
- Set up the default
graphitigraph - Verify the installation
- Verify the setup:
docker exec -it graphiti-age psql -U postgres -d postgres -c "SELECT * FROM ag_catalog.ag_graph;"docker-compose -f docker/docker-compose-age.yml downdocker-compose -f docker/docker-compose-age.yml down -vIf you prefer to initialize manually:
docker exec -it graphiti-age psql -U postgres -d postgresThen run:
CREATE EXTENSION IF NOT EXISTS age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;
SELECT create_graph('graphiti');Check logs:
docker logs graphiti-ageThe init script now runs after container startup to avoid permission issues.
Make sure you're using the correct Apache Age image:
docker pull apache/age:latestIf you have both PostgreSQL and Age running, change the port in docker-compose-age.yml:
ports:
- "5433:5432" # Use 5433 on host insteadThen connect with port=5433 in your driver configuration.
To run both PostgreSQL and Apache Age at the same time, modify one of the port mappings:
Option 1: Change Age to use port 5433
Edit docker-compose-age.yml:
ports:
- "5433:5432"Connect to Age:
driver = AgeDriver(host='localhost', port=5433, ...)Option 2: Use Docker networks
Both containers can communicate via Docker network names:
# From host machine
postgres_driver = PostgresDriver(host='localhost', port=5432, ...)
age_driver = AgeDriver(host='localhost', port=5433, ...)
# From another Docker container
postgres_driver = PostgresDriver(host='graphiti-postgres', port=5432, ...)
age_driver = AgeDriver(host='graphiti-age', port=5432, ...)- Image:
pgvector/pgvector:pg16 - Container name:
graphiti-postgres - Default port:
5432 - Extensions: pgvector, uuid-ossp, pg_trgm
- Data volume:
graphiti_postgres_data
- Image:
apache/age:latest - Container name:
graphiti-age - Default port:
5432 - Extensions: age
- Data volume:
graphiti_age_data
Both containers include health checks. Verify status:
# Check PostgreSQL
docker inspect graphiti-postgres | grep -A 5 Health
# Check Apache Age
docker inspect graphiti-age | grep -A 5 HealthOr use the driver health check methods:
import asyncio
from graphiti_postgres import PostgresDriver, AgeDriver
async def check_health():
# PostgreSQL
pg_driver = PostgresDriver(host='localhost', port=5432)
await pg_driver.initialize()
print(f"PostgreSQL healthy: {await pg_driver.health_check()}")
await pg_driver.close()
# Apache Age
age_driver = AgeDriver(host='localhost', port=5432)
await age_driver.initialize()
print(f"Apache Age healthy: {await age_driver.health_check()}")
await age_driver.close()
asyncio.run(check_health())