From 92971a3983c948dc3b27889fe1d1d233a99fecd4 Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sat, 21 Feb 2026 18:29:23 -0600 Subject: [PATCH] Add docker-compose for local dev stack Add a docker-compose.yml to run a local development stack: Postgres (with mounted init scripts), Redis, MinIO, Keycloak (start-dev) and pgAdmin, plus a bridge network and persistent volumes. Also add init/init.sql to create the keycloak database and grant privileges to the admin user so Keycloak can connect to its dedicated DB. Default credentials and port mappings are provided for development convenience. --- docker-compose.yml | 90 ++++++++++++++++++++++++++++++++++++++++++++++ init/init.sql | 2 ++ 2 files changed, 92 insertions(+) create mode 100644 docker-compose.yml create mode 100644 init/init.sql diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d48e40c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,90 @@ +version: '3.8' + +services: + postgres: + image: postgres:15-alpine + container_name: postgres + restart: unless-stopped + ports: + - "5432:5432" + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: admin + POSTGRES_DB: postgres + volumes: + - postgres_data:/var/lib/postgresql/data + - ./init:/docker-entrypoint-initdb.d # place init.sql here to create additional databases + networks: + - backend + + redis: + image: redis:7-alpine + container_name: redis + restart: unless-stopped + ports: + - "6379:6379" + volumes: + - redis_data:/data + networks: + - backend + + minio: + image: minio/minio:latest + container_name: minio + restart: unless-stopped + ports: + - "9000:9000" # API + - "9001:9001" # Web console + environment: + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin + volumes: + - minio_data:/data + command: server /data --console-address ":9001" + networks: + - backend + + keycloak: + image: quay.io/keycloak/keycloak:latest + container_name: keycloak + restart: unless-stopped + ports: + - "8180:8080" # Host port 8180 → container 8080 (Keycloak default) + environment: + KEYCLOAK_ADMIN: admin + KEYCLOAK_ADMIN_PASSWORD: admin + KC_DB: postgres + KC_DB_URL: jdbc:postgresql://postgres:5432/keycloak + KC_DB_USERNAME: admin + KC_DB_PASSWORD: admin + command: start-dev # Use start-dev for development mode + depends_on: + - postgres + networks: + - backend + + pgadmin: + image: dpage/pgadmin4:latest + container_name: pgadmin + restart: unless-stopped + ports: + - "5050:80" # pgAdmin web UI + environment: + PGADMIN_DEFAULT_EMAIL: admin@example.com + PGADMIN_DEFAULT_PASSWORD: admin + volumes: + - pgadmin_data:/var/lib/pgadmin + depends_on: + - postgres + networks: + - backend + +networks: + backend: + driver: bridge + +volumes: + postgres_data: + redis_data: + minio_data: + pgadmin_data: \ No newline at end of file diff --git a/init/init.sql b/init/init.sql new file mode 100644 index 0000000..c09c80d --- /dev/null +++ b/init/init.sql @@ -0,0 +1,2 @@ +CREATE DATABASE keycloak; +GRANT ALL PRIVILEGES ON DATABASE keycloak TO admin; \ No newline at end of file