Files
flowfish/deployment/docker-compose/docker-compose.local-test.yml
T
2026-03-25 15:50:47 +03:00

260 lines
8.1 KiB
YAML

version: '3.8'
# Flowfish Local Test Environment (Docker Compose)
# Usage: docker-compose -f deployment/docker-compose/docker-compose.local-test.yml up -d
# Requires: schemas/ directory at workspace root
services:
# ============================================================================
# DATABASES
# ============================================================================
postgres:
image: postgres:15-alpine
container_name: flowfish-postgres
environment:
POSTGRES_USER: flowfish
POSTGRES_PASSWORD: flowfish123
POSTGRES_DB: flowfish
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ../../schemas/postgresql-schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U flowfish"]
interval: 5s
timeout: 5s
retries: 5
networks:
- flowfish-network
redis:
image: redis:7-alpine
container_name: flowfish-redis
command: redis-server --requirepass redis123
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis123", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- flowfish-network
neo4j:
image: neo4j:5.15-community
container_name: flowfish-neo4j
environment:
NEO4J_AUTH: neo4j/flowfish123
NEO4J_server_memory_heap_initial__size: 256m
NEO4J_server_memory_heap_max__size: 512m
ports:
- "7474:7474"
- "7687:7687"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:7474"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- flowfish-network
clickhouse:
image: clickhouse/clickhouse-server:23-alpine
container_name: flowfish-clickhouse
environment:
CLICKHOUSE_DB: flowfish
CLICKHOUSE_USER: flowfish
CLICKHOUSE_PASSWORD: flowfish123
ports:
- "8123:8123"
- "9000:9000"
volumes:
- clickhouse_data:/var/lib/clickhouse
- ../../schemas/clickhouse-events-schema.sql:/docker-entrypoint-initdb.d/01-events-schema.sql:ro
- ../../schemas/clickhouse-change-events.sql:/docker-entrypoint-initdb.d/02-change-events.sql:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8123/ping"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
networks:
- flowfish-network
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: flowfish-rabbitmq
environment:
RABBITMQ_DEFAULT_USER: flowfish
RABBITMQ_DEFAULT_PASS: flowfish123
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- flowfish-network
# ============================================================================
# BACKEND
# ============================================================================
backend:
image: taylanbakircioglu/flowfish:backend-latest
# To build locally instead of pulling from Docker Hub, uncomment below:
# build:
# context: ../..
# dockerfile: backend/Dockerfile
# volumes:
# - ../../backend:/app
container_name: flowfish-backend
environment:
# Database connections
DATABASE_URL: postgresql+asyncpg://flowfish:flowfish123@postgres:5432/flowfish
REDIS_URL: redis://:redis123@redis:6379/0
CLICKHOUSE_URL: http://flowfish:flowfish123@clickhouse:8123
CLICKHOUSE_USER: flowfish
CLICKHOUSE_PASSWORD: flowfish123
CLICKHOUSE_DATABASE: flowfish
NEO4J_BOLT_URI: bolt://neo4j:7687
NEO4J_HTTP_URI: http://neo4j:7474
NEO4J_USER: neo4j
NEO4J_PASSWORD: flowfish123
NEO4J_DATABASE: neo4j
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: "5672"
RABBITMQ_USER: flowfish
RABBITMQ_PASSWORD: flowfish123
# Application settings
SECRET_KEY: local-dev-secret-key
JWT_EXPIRATION_HOURS: 24
CORS_ORIGINS: http://localhost:3000
LOG_LEVEL: DEBUG
# Cluster Manager gRPC endpoint
CLUSTER_MANAGER_GRPC: cluster-manager:5001
# Encryption key for cluster credentials (shared with cluster-manager)
FLOWFISH_ENCRYPTION_KEY: "Zo6CfvKB6y4IIPMAUJermGJ7UQm8wgjnvuehRGKY-sA="
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
neo4j:
condition: service_healthy
rabbitmq:
condition: service_healthy
cluster-manager:
condition: service_started
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/v1/health')"]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s
networks:
- flowfish-network
# ============================================================================
# CLUSTER MANAGER (gRPC gateway for Kubernetes API access)
# ============================================================================
cluster-manager:
image: taylanbakircioglu/flowfish:cluster-manager-latest
# To build locally instead of pulling from Docker Hub, uncomment below:
# build:
# context: ../..
# dockerfile: services/cluster-manager/Dockerfile
# volumes:
# - ../../services/cluster-manager/app:/app/app
container_name: flowfish-cluster-manager
environment:
SERVICE_NAME: cluster-manager
GRPC_PORT: "5001"
DATABASE_URL: postgresql://flowfish:flowfish123@postgres:5432/flowfish
REDIS_URL: redis://:redis123@redis:6379/0
LOG_LEVEL: DEBUG
FLOWFISH_ENCRYPTION_KEY: "Zo6CfvKB6y4IIPMAUJermGJ7UQm8wgjnvuehRGKY-sA="
ports:
- "5001:5001"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import grpc; ch=grpc.insecure_channel('localhost:5001'); ch.close()"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
- flowfish-network
# ============================================================================
# FRONTEND
# ============================================================================
frontend:
image: taylanbakircioglu/flowfish:frontend-latest
# To build locally instead of pulling from Docker Hub, uncomment below:
# build:
# context: ../..
# dockerfile: frontend/Dockerfile.production
# volumes:
# - ../../frontend/src:/app/src
container_name: flowfish-frontend
user: "0:0"
environment:
REACT_APP_API_URL: http://localhost:8000
ports:
- "3000:3000"
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000"]
interval: 30s
timeout: 10s
retries: 3
networks:
- flowfish-network
# ============================================================================
# VOLUMES & NETWORKS
# ============================================================================
# ============================================================================
# NOTE: Inspektor Gadget (eBPF Data Collection)
# ============================================================================
# Inspektor Gadget is a Kubernetes-native DaemonSet and CANNOT run in Docker
# Compose. It requires the Kubernetes API for pod/container discovery and
# metadata enrichment. To collect eBPF network/DNS/process events:
# - Use the Kubernetes deployment (deployment/local-test/ or deployment/kubernetes-manifests/)
# - Or run Flowfish here and add a remote Kubernetes cluster via Token method
# in the UI (Clusters > Add Cluster > Token)
# ============================================================================
volumes:
postgres_data:
clickhouse_data:
networks:
flowfish-network:
driver: bridge