English | 中文
✍️ Use litestream to automatically backup and restore memos' SQLite database to B2/S3 Bucket. This project is a refactored version of memos-on-fly-build. Feel free to use this project! 🆓
If you wanna run on fly.io directly, please visit https://github.com/hu3rror/memos-on-fly
✈️ The Docker image is not only available on fly.io, you can also run it locally.
This project is based on usememos/memos and litestream. Thank you very much! ✨
- Docker
- BackBlaze B2 / S3-compatible account (The default template is B2-based)
- To Create a BackBlaze B2 bucket and you can get bucket name / endpoint url
- To Create a BackBlaze B2 user and you can get access-key-id / secret-access-key
The image supports linux/amd64, linux/arm64, linux/arm/v7
!!! Make sure to edit the environment variables before running !!!
docker run -d ghcr.io/hu3rror/memos-litestream:latest \
--name memos \
-p 5230:5230 \
-v ~/.memos/:/var/opt/memos \
--env LITESTREAM_REPLICA_PATH=memos_prod.db \
--env LITESTREAM_REPLICA_BUCKET=xxxxxxxxx \
--env LITESTREAM_REPLICA_ENDPOINT=s3.us-west-000.backblazeb2.com \
--env LITESTREAM_ACCESS_KEY_ID=000000001a2b3c40000000001 \
--env LITESTREAM_SECRET_ACCESS_KEY=K000ABCDEFGHiJkLmNoPqRsTuVwXyZ0
or use docker-compose.yml in this repo.
LITESTREAM_REPLICA_PATH
LITESTREAM_REPLICA_BUCKET
: Modify to your S3/B2 bucket nameLITESTREAM_REPLICA_ENDPOINT
: Modify to your S3/B2 endpoint urlLITESTREAM_ACCESS_KEY_ID
: Your S3/B2 access-key-idLITESTREAM_SECRET_ACCESS_KEY
: Your S3/B2 secret-access-key
For more information about litestream, please see https://litestream.io/getting-started/
Your data is store in ~/.memos
by default.
If you delete your data by mistake, you can just restart your docker container, and your database file will be downloaded automatically from your S3/B2 Bucket.
BUT! This project does not support backing up and restoring your local resources (your photos etc.)! Recommended for use with memos' built-in external resource libraries (It is not recommended to use local resource on Cloud VM. )
git clone https://github.com/hu3rror/memos-litestream.git
cd memos-litestream
# modify something
docker buildx build ./ --file ./Dockerfile --tag <your-tag>