Files
microdao-daarion/infrastructure/ansible/templates/patroni.yml.j2
Apple 90758facae 🧠 Add Agent Memory System with PostgreSQL + Qdrant + Cohere
Features:
- Three-tier memory architecture (short/mid/long-term)
- PostgreSQL schema for conversations, events, memories
- Qdrant vector database for semantic search
- Cohere embeddings (embed-multilingual-v3.0, 1024 dims)
- FastAPI Memory Service with full CRUD
- External Secrets integration with Vault
- Kubernetes deployment manifests

Components:
- infrastructure/database/agent-memory-schema.sql
- infrastructure/kubernetes/apps/qdrant/
- infrastructure/kubernetes/apps/memory-service/
- services/memory-service/ (FastAPI app)

Also includes:
- External Secrets Operator
- Traefik Ingress Controller
- Cert-Manager with Let's Encrypt
- ArgoCD for GitOps
2026-01-10 07:52:32 -08:00

121 lines
3.1 KiB
Django/Jinja

# Patroni Configuration for {{ inventory_hostname }}
# Generated by Ansible
scope: {{ patroni_scope }}
namespace: {{ patroni_namespace }}
name: {{ inventory_hostname }}
restapi:
listen: 0.0.0.0:8008
connect_address: {{ ansible_host }}:8008
consul:
host: {{ consul_host }}:8500
register_service: true
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
use_slots: true
parameters:
# Performance
max_connections: 200
shared_buffers: 256MB
effective_cache_size: 768MB
maintenance_work_mem: 64MB
checkpoint_completion_target: 0.9
wal_buffers: 16MB
default_statistics_target: 100
random_page_cost: 1.1
effective_io_concurrency: 200
work_mem: 2621kB
huge_pages: off
min_wal_size: 1GB
max_wal_size: 4GB
max_worker_processes: 4
max_parallel_workers_per_gather: 2
max_parallel_workers: 4
max_parallel_maintenance_workers: 2
# Replication
wal_level: replica
hot_standby: "on"
max_wal_senders: 10
max_replication_slots: 10
hot_standby_feedback: "on"
# Logging
log_destination: 'stderr'
logging_collector: 'on'
log_directory: 'log'
log_filename: 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age: '1d'
log_rotation_size: '100MB'
log_min_duration_statement: 1000
log_checkpoints: 'on'
log_connections: 'on'
log_disconnections: 'on'
log_lock_waits: 'on'
# Archive (for pgBackRest)
archive_mode: "on"
archive_command: 'pgbackrest --stanza={{ patroni_scope }} archive-push %p'
initdb:
- encoding: UTF8
- data-checksums
pg_hba:
- host replication replicator 0.0.0.0/0 scram-sha-256
- host all all 0.0.0.0/0 scram-sha-256
users:
{{ postgres_user }}:
password: {{ postgres_password }}
options:
- createrole
- createdb
replicator:
password: {{ replicator_password | default('replicator_secret') }}
options:
- replication
postgresql:
listen: 0.0.0.0:5432
connect_address: {{ ansible_host }}:5432
data_dir: {{ postgres_data_dir }}
bin_dir: /usr/lib/postgresql/{{ postgres_version }}/bin
config_dir: {{ postgres_config_dir }}
pgpass: /var/lib/postgresql/.pgpass
authentication:
replication:
username: replicator
password: {{ replicator_password | default('replicator_secret') }}
superuser:
username: postgres
password: {{ postgres_superuser_password | default('postgres_secret') }}
rewind:
username: rewind
password: {{ rewind_password | default('rewind_secret') }}
parameters:
unix_socket_directories: '/var/run/postgresql'
pg_hba:
- local all all peer
- host all all 127.0.0.1/32 scram-sha-256
- host all all 0.0.0.0/0 scram-sha-256
- host replication replicator 0.0.0.0/0 scram-sha-256
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false