Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

4.3 KB
Raw Blame
# Freeze the Docker Compose project name so every checkout/worktree uses the
# same local database containers and Compose-managed resources.
# Local setup is single-instance by design.
name: macro

services: 
  postgres:
    image: pgvector/pgvector:pg18
    # The default 100 max_connections is exhausted when every service's pool
    # fills under load (e.g. a large email backfill): workers then die on
    # "pool timed out" / "too many clients". Local-only headroom.
    # The migration installs pg_stat_statements; preload it so local query
    # profiling can separate database execution from application timings.
    command: postgres -c max_connections=500 -c shared_preload_libraries=pg_stat_statements
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user"]
      interval: 2s
      timeout: 5s
      retries: 15
    ports:
      - '5432:5432'
    expose:
      - '5432'
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password
      - PGPASSWORD=password
    volumes:
      # pg18+ images keep PGDATA in a version-specific subdir; mount the parent
      # so the data dir lands inside the volume (see docker-library/postgres#1259).
      - db:/var/lib/postgresql
    networks:
      - databases
  redis:
    image: 'redis/redis-stack:latest'
    ports:
      - '6379:6379' # Expose Redis on the default port
      - '8001:8001' # Expose Redis Stack Server UI/tools
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    volumes:
      - cache:/data
    networks:
      - databases
  kafka:
    # Local analog of the MSK cluster's `3.9.x.kraft` version: single-node
    # KRaft where this node is both broker and controller.
    image: apache/kafka:3.9.1
    environment:
      KAFKA_NODE_ID: 1
      KAFKA_PROCESS_ROLES: broker,controller
      KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:29093
      KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
      # Dual listeners: `kafka:29092` for containers on the databases network,
      # `localhost:9092` for processes on the host.
      KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,PLAINTEXT_HOST://0.0.0.0:9092,CONTROLLER://0.0.0.0:29093
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      # Single broker: internal topics can't replicate beyond 1.
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
      KAFKA_LOG_DIRS: /var/lib/kafka/data
      # Fixed cluster id (base64url UUID) so the persistent volume survives
      # container recreation without a cluster-id mismatch on restart.
      CLUSTER_ID: TWFjcm9Mb2NhbEthZmthMQ
    healthcheck:
      test: /opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092 > /dev/null 2>&1
      interval: 5s
      timeout: 10s
      retries: 20
    ports:
      - '9092:9092'
    volumes:
      - kafka_data:/var/lib/kafka/data
    networks:
      - databases
  search:
    build:
      context: ../infra/local/opensearch
    image: macro-local-opensearch:dev
    environment:
      cluster.name: search 
      discovery.type: single-node
      node.name: search
      plugins.security.disabled: true
      bootstrap.memory_lock: true
      OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
      OPENSEARCH_INITIAL_ADMIN_PASSWORD: "yourStrongPassword123!"
    healthcheck:
      interval: 10s
      retries: 80
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:9200/
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    ports:
      - 9200:9200 # REST API
      - 9600:9600 # Performance Analyzer
    networks:
      - databases
    volumes:
      - opensearch_data:/usr/share/opensearch/data

networks:
  databases:
    external: true
volumes:
  db:
    name: macro_postgres_data
    external: true
  cache:
    name: macro_redis_data
    external: true
  opensearch_data:
    name: macro_opensearch_data
    external: true
  kafka_data:
    name: macro_kafka_data
    external: true