360 Secure SkillHub
360 安全技能中心

Langfuse Backup

这是针对自托管Langfuse的Docker卷备份恢复工具,核心功能:备份Postgres(轨迹、分数)、MinIO(Blob)核心数据,可选ClickHouse,支持指定日期恢复,自带14天备份留存自动清理。典型场景:日常定时备份、崩溃后恢复、Langfuse迁移。依赖Docker,通过配置环境变量或脚本参数,执行bash命令操作,所有数据处理本地完成,安全可靠。

nissan
nissan
热度 69.25
最近更新 2026-05-11 17:28:01
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add langfuse-backup
Metadata
name
langfuse-backup
version
1.0.2
metadata
{"openclaw":{"emoji":"💾","requires":{"bins":["docker"],"env":[]},"network":{"outbound":false,"reason":"Backs up local Docker volumes only. No data is sent to remote servers."},"security_notes":"All operations are local Docker volume copies. No data leaves the local machine. Backup files are stored in a local directory specified by the user."}}
description
Docker volume backup and restore for self-hosted Langfuse. Use when: backing up a self-hosted Langfuse instance, restoring Langfuse after a crash or migration, setting up daily cron backups for Langfuse postgres/clickhouse/minio/redis volumes. Backs up postgres (traces, scores), minio (blobs), with optional clickhouse and redis. Includes restore script with validation and 14-day retention pruning.

Last used: 2026-03-24 Memory references: 2 Status: Active

langfuse-backup

Backup and restore Docker volumes for a self-hosted Langfuse instance.

Scripts

  • scripts/backup_langfuse.sh — back up postgres + minio volumes (primary data)
  • scripts/restore_langfuse.sh — restore from a specific backup date

Quick start

# Configure (env vars or edit the script defaults)
export LANGFUSE_BACKUP_DIR="$HOME/.langfuse-backups"
export LANGFUSE_COMPOSE_DIR="/path/to/langfuse"   # directory with docker-compose.yml
export LANGFUSE_DB_CONTAINER="langfuse-db-1"       # postgres container name
export LANGFUSE_MINIO_CONTAINER="langfuse-minio-1" # minio container name
export LANGFUSE_DB_NAME="langfuse"                  # postgres database name
export LANGFUSE_DB_USER="langfuse"                  # postgres user

# Run a backup
bash scripts/backup_langfuse.sh

# List available backups
ls "$LANGFUSE_BACKUP_DIR"

# Restore from a date
bash scripts/restore_langfuse.sh 2026-02-27

Env vars

Var Default Description
LANGFUSE_BACKUP_DIR ~/.langfuse-backups Root backup directory
LANGFUSE_COMPOSE_DIR ~/langfuse Docker Compose project directory
LANGFUSE_DB_CONTAINER langfuse-db-1 Postgres container name
LANGFUSE_MINIO_CONTAINER langfuse-minio-1 MinIO container name
LANGFUSE_DB_NAME langfuse Postgres database name
LANGFUSE_DB_USER langfuse Postgres user
LANGFUSE_RETENTION_DAYS 14 How many days of backups to keep

What gets backed up

Volume Backed up? Notes
Postgres ✅ Yes pg_dump → .sql.gz — traces, scores, evals
MinIO ✅ Yes tar.gz — uploaded blobs
ClickHouse ⚠️ Optional Large; many users skip (replayed from traces)
Redis ⚠️ Skip Cache only — safe to skip

Cron setup (macOS LaunchAgent)

<!-- ~/Library/LaunchAgents/com.yourname.langfuse-backup.plist -->
<key>StartCalendarInterval</key>
<dict>
  <key>Hour</key><integer>2</integer>
  <key>Minute</key><integer>0</integer>
</dict>
<key>ProgramArguments</key>
<array>
  <string>/bin/bash</string>
  <string>/path/to/scripts/backup_langfuse.sh</string>
</array>
<key>StandardOutPath</key>
<string>/tmp/langfuse-backup.log</string>

Restore procedure

# 1. Stop Langfuse
cd $LANGFUSE_COMPOSE_DIR && docker compose down

# 2. Restore from backup
bash scripts/restore_langfuse.sh 2026-02-27

# 3. Start Langfuse
cd $LANGFUSE_COMPOSE_DIR && docker compose up -d