File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed
Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 11# Linkding Deployment
22
3+ 使用 [ Litestream] ( https://litestream.io/ ) 为 [ Linkding] ( https://github.com/sissbruecker/linkding ) 提供自动化 SQLite 数据库备份到 S3 的部署方案。
4+
5+ ## 功能特性
6+
7+ - 🔖 自托管书签管理器 Linkding
8+ - 💾 自动备份 SQLite 数据库到 S3 兼容存储
9+ - 🔄 容器重启时自动从备份恢复数据库
10+
11+ ## 快速开始
12+
13+ ### 1. 配置环境变量
14+
15+ 复制示例配置文件并填入你的 S3 凭证:
16+
17+ ``` bash
18+ cp .env.example .env
19+ ```
20+
21+ 编辑 ` .env ` 文件:
22+
23+ ``` env
24+ LITESTREAM_ACCESS_KEY_ID=your_access_key_id
25+ LITESTREAM_SECRET_ACCESS_KEY=your_secret_access_key
26+ LITESTREAM_S3_BUCKET=your_bucket_name
27+ LITESTREAM_S3_ENDPOINT=https://s3.us-west-002.backblazeb2.com
28+ LITESTREAM_S3_PATH=linkding
29+ ```
30+
31+ ### 2. 构建并运行
32+
33+ ``` bash
34+ docker build -t linkding-litestream .
35+
36+ docker run -d \
37+ --name linkding \
38+ -p 9090:9090 \
39+ --env-file .env \
40+ -v linkding-data:/etc/linkding/data \
41+ linkding-litestream
42+ ```
43+
44+ ### 3. 访问服务
45+
46+ 打开浏览器访问: ` http://localhost:9090 `
47+
48+ ## 工作原理
49+
50+ - ** 容器启动时** : 如果数据库不存在,自动从 S3 恢复
51+ - ** 运行期间** : Litestream 持续将数据库变更同步到 S3
52+ - ** 灾难恢复** : 使用相同的环境变量启动新容器即可自动恢复所有数据
53+
54+ ## 配置说明
55+
56+ ### Litestream 配置
57+
58+ ` litestream.yml ` 文件配置备份行为:
59+
60+ - 快照间隔: 24 小时
61+ - 保留时间: 7 天
62+
63+ 可根据需要修改 ` litestream.yml ` 中的配置。
You can’t perform that action at this time.
0 commit comments