Files
OpenFlare/config.example.yaml
T
ryan 160e63558f fix(clickhouse): harden R/W path P0–P3 (cleanup, durability, rollups)
Honest TTL cleanup semantics; enqueue-safe dedup with flush retry and writer
metrics; model insert hooks; latest-per-node and hourly metric/openresty
rollups; small-host pool/async defaults, traffic hourly TTL, and UV labeling.
2026-07-10 10:34:04 +08:00

116 lines
4.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# openflare — Platform Config
# Copy this file to config.yaml and fill in your values.
# Fields marked with <...> are required; others have sensible defaults.
# ─── Application ────────────────────────────────────────────────────────────────
app:
app_name: "openflare"
env: "production" # development | testing | production
addr: ":3000"
node_id: 1 # Snowflake node ID (0-1023). Must be unique per instance.
graceful_shutdown_timeout: 30
session_cookie_name: "openflare_session_id" # Change to something unique before deploy
session_secret: "<uniq-random-string>" # Cannot be changed after first start
session_domain: "" # e.g. ".yourdomain.com"
session_age: 86400 # Session lifetime in seconds (default: 24h)
session_secure: false
session_http_only: false
api_prefix: "/api"
# ─── PostgreSQL ─────────────────────────────────────────────────────────────────
# Supports Standalone and Primary-Replica (read/write split) modes.
database:
enabled: true
sqlite_path: "openflare.db" # PostgreSQL 禁用时使用此 SQLite 文件路径
host: "127.0.0.1"
port: 5432
username: "openflare"
password: "replace-with-strong-password"
database: "openflare"
max_idle_conn: 16
max_open_conn: 128
conn_max_lifetime: 1800
conn_max_idle_time: 600
log_level: "info" # error | warn | info | debug | silent
ssl_mode: "disable"
time_zone: "UTC"
application_name: "openflare-server"
prefer_simple_protocol: false
search_path: "public"
statement_cache_capacity: 256
default_query_exec_mode: "cache_statement"
slow_threshold: 200ms
# Optional read replicas:
# replicas:
# - host: "replica1.db.internal"
# port: 5432
# - host: "replica2.db.internal"
# port: 5432
# ─── Redis ──────────────────────────────────────────────────────────────────────
# Supports Standalone, Sentinel (HA), and Cluster modes.
redis:
enabled: true
addrs:
- "127.0.0.1:6379"
username: ""
password: ""
db: 0 # Ignored in Cluster mode
cluster_mode: false # Set true to enable Cluster mode
master_name: "" # Set non-empty to enable Sentinel mode
key_prefix: "openflare:"
pool_size: 100
min_idle_conn: 10
dial_timeout: 5
read_timeout: 3
write_timeout: 3
max_retries: 3
pool_timeout: 4
conn_max_idle_time: 300
# ─── Logging ────────────────────────────────────────────────────────────────────
log:
level: "info" # debug | info | warn | error | fatal | panic
format: "console" # console | json
output: "stdout" # stdout | file
file_path: "./logs/app.log"
max_size: 100 # MB per log file
max_age: 30 # Days to retain old log files
max_backups: 10
compress: true
# ─── Async Task Worker ──────────────────────────────────────────────────────────
worker:
concurrency: 20
strict_priority: false
queues:
- name: webhook
priority: 10
- name: whitelist_only
priority: 5
- name: default
priority: 3
# ─── OpenTelemetry Tracing ──────────────────────────────────────────────────────
otel:
sampling_rate: 0.0 # Trace sampling rate (0.0 – 1.0)
tracer_name: "github.com/Rain-kl/OpenFlare" # Global tracer instrumentation name
# ─── ClickHouse (required) ──────────────────────────────────────────────────────
# Client pool sized for small control-plane hosts (e.g. 3c6g). Raise only if
# concurrent analytics queries and writers regularly exhaust the pool.
clickhouse:
enabled: true
hosts:
- "127.0.0.1:9000"
username: "default"
password: "123456"
database: "openflare"
max_idle_conn: 8 # keep warm sockets low to save client + server RAM
max_open_conn: 16 # cap concurrent native sessions on modest CH boxes
conn_max_lifetime: 3600
dial_timeout: 5
block_buffer_size: 32 # rows buffered per block; 32 is enough for our batch sizes