diff --git a/.env-example b/.env.example similarity index 66% rename from .env-example rename to .env.example index e940eff..ffc8e06 100644 --- a/.env-example +++ b/.env.example @@ -2,3 +2,8 @@ CERBERUS_HOME=${HOME}/cerberus CERBERUS_KEYSTORE_DIR=${CERBERUS_HOME}/data/keystore CERBERUS_GRPC_PORT=50051 CERBERUS_METRICS_PORT=9081 + +DB_NAME=cerberus +DB_USER=postgres +DB_PASSWORD=postgres +DB_PORT=5432 diff --git a/docker-compose.yml b/docker-compose.yml index baebeb2..e9e328d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.8' services: cerberus: image: ghcr.io/layr-labs/cerberus:latest @@ -9,8 +8,29 @@ services: environment: - "KEYSTORE_DIR=/keystore" - "METRICS_PORT=${CERBERUS_METRICS_PORT}" + - "POSTGRES_DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:5432/${DB_NAME}?sslmode=disable" volumes: - "${CERBERUS_KEYSTORE_DIR}:/keystore" env_file: - .env restart: unless-stopped + depends_on: + - db + + db: + image: postgres:15 + container_name: db + ports: + - "${DB_PORT}:${DB_PORT}" + environment: + - "POSTGRES_PASSWORD=${DB_PASSWORD}" + - "POSTGRES_USER=${DB_USER}" + - "POSTGRES_DB=${DB_NAME}" + volumes: + - postgres_data:/var/lib/postgresql/data + env_file: + - .env + restart: unless-stopped + +volumes: + postgres_data: \ No newline at end of file diff --git a/internal/database/.env.example b/internal/database/.env.example index e2271fb..14f51bc 100644 --- a/internal/database/.env.example +++ b/internal/database/.env.example @@ -1,4 +1,4 @@ DB_PASSWORD=password DB_USER=user -DB_NAME=db +DB_NAME=cerberus DB_PORT=5432