From b3c2708a5307ea42523ede8c88b23a992cc8dcd4 Mon Sep 17 00:00:00 2001 From: Sun-ZhenXing <1006925066@qq.com> Date: Wed, 14 Jan 2026 14:12:41 +0800 Subject: [PATCH] feat: add memos --- README.md | 1 + README.zh.md | 1 + src/memos/.env.example | 37 +++++++++++++++ src/memos/README.md | 89 +++++++++++++++++++++++++++++++++++ src/memos/README.zh.md | 89 +++++++++++++++++++++++++++++++++++ src/memos/docker-compose.yaml | 43 +++++++++++++++++ 6 files changed, 260 insertions(+) create mode 100644 src/memos/.env.example create mode 100644 src/memos/README.md create mode 100644 src/memos/README.zh.md create mode 100644 src/memos/docker-compose.yaml diff --git a/README.md b/README.md index 47a0f00..4d19907 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ These services require building custom Docker images from source. | [LiteLLM](./src/litellm) | main-stable | | [Logstash](./src/logstash) | 8.16.1 | | [MariaDB Galera Cluster](./src/mariadb-galera) | 11.7.2 | +| [Memos](./src/memos) | 0.25.3 | | [Milvus Standalone Embed](./src/milvus-standalone-embed) | v2.6.7 | | [Milvus Standalone](./src/milvus-standalone) | v2.6.7 | | [Minecraft Bedrock Server](./src/minecraft-bedrock-server) | latest | diff --git a/README.zh.md b/README.zh.md index 81fa074..b51f62a 100644 --- a/README.zh.md +++ b/README.zh.md @@ -68,6 +68,7 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件, | [LiteLLM](./src/litellm) | main-stable | | [Logstash](./src/logstash) | 8.16.1 | | [MariaDB Galera Cluster](./src/mariadb-galera) | 11.7.2 | +| [Memos](./src/memos) | 0.25.3 | | [Milvus Standalone Embed](./src/milvus-standalone-embed) | v2.6.7 | | [Milvus Standalone](./src/milvus-standalone) | v2.6.7 | | [Minecraft Bedrock Server](./src/minecraft-bedrock-server) | latest | diff --git a/src/memos/.env.example b/src/memos/.env.example new file mode 100644 index 0000000..f141dfe --- /dev/null +++ b/src/memos/.env.example @@ -0,0 +1,37 @@ +# Memos Version +MEMOS_VERSION=0.25.3 + +# Server mode: dev, prod, or demo +MEMOS_MODE=prod + +# Server address +MEMOS_ADDR=0.0.0.0 + +# Server port (inside container) +MEMOS_PORT=5230 + +# Port to bind to on the host machine +MEMOS_PORT_OVERRIDE=5230 + +# Data directory path (inside container) +MEMOS_DATA=/var/opt/memos + +# Database driver: sqlite, postgres, or mysql +MEMOS_DRIVER=sqlite + +# Database connection string (DSN) - required for postgres/mysql +# PostgreSQL example: postgres://user:password@host:port/dbname?sslmode=disable +# MySQL example: user:password@tcp(host:port)/dbname?charset=utf8mb4&parseTime=True&loc=Local +# MEMOS_DSN= + +# Public URL of your Memos instance (optional) +# MEMOS_INSTANCE_URL=https://memos.example.com + +# Timezone +TZ=UTC + +# Resource Limits +MEMOS_CPU_LIMIT=1.0 +MEMOS_MEMORY_LIMIT=512M +MEMOS_CPU_RESERVATION=0.25 +MEMOS_MEMORY_RESERVATION=128M diff --git a/src/memos/README.md b/src/memos/README.md new file mode 100644 index 0000000..af821d6 --- /dev/null +++ b/src/memos/README.md @@ -0,0 +1,89 @@ +# Memos + +[English](./README.md) | [中文](./README.zh.md) + +This service deploys Memos, a privacy-first, lightweight note-taking service. Easily capture and share your great thoughts. + +## Services + +- `memos`: The Memos note-taking service. + +## Configuration + +- `MEMOS_VERSION`: The version of the Memos image, default is `0.25.3`. +- `MEMOS_PORT_OVERRIDE`: The host port for Memos, default is `5230`. +- `MEMOS_MODE`: Server mode (`dev`, `prod`, or `demo`), default is `prod`. +- `MEMOS_ADDR`: Server address, default is `0.0.0.0`. +- `MEMOS_PORT`: Server port inside the container, default is `5230`. +- `MEMOS_DATA`: Data directory path inside the container, default is `/var/opt/memos`. +- `MEMOS_DRIVER`: Database driver (`sqlite`, `postgres`, or `mysql`), default is `sqlite`. +- `MEMOS_DSN`: Database connection string (required for PostgreSQL or MySQL). +- `MEMOS_INSTANCE_URL`: Public URL of your Memos instance (optional). + +## Volumes + +- `memos_data`: A volume for storing Memos data. + +## Usage + +### Quick Start with SQLite (Default) + +1. Start the service: + + ```bash + docker compose up -d + ``` + +2. Access Memos at `http://localhost:5230`. + +### Using PostgreSQL or MySQL + +To use PostgreSQL or MySQL instead of SQLite: + +1. Edit `.env` file and set: + + ```env + MEMOS_DRIVER=postgres # or mysql + MEMOS_DSN=postgres://user:password@host:port/dbname?sslmode=disable + ``` + +2. Start the service: + + ```bash + docker compose up -d + ``` + +## First-Time Setup + +After starting Memos for the first time: + +1. Open `http://localhost:5230` in your browser. +2. Create your admin account. +3. Start taking notes! + +## Data Persistence + +All data is stored in the `memos_data` volume, which persists across container restarts and upgrades. + +## Updates + +To update Memos: + +1. Edit `.env` and change `MEMOS_VERSION` to the desired version. +2. Restart the service: + +```bash +docker compose down +docker compose pull +docker compose up -d +``` + +## Official Documentation + +- [Memos Official Website](https://usememos.com/) +- [Memos Documentation](https://usememos.com/docs) +- [Memos GitHub Repository](https://github.com/usememos/memos) + +## License + +Memos is licensed under the [MIT License](https://github.com/usememos/memos/blob/main/LICENSE). diff --git a/src/memos/README.zh.md b/src/memos/README.zh.md new file mode 100644 index 0000000..aca8bd6 --- /dev/null +++ b/src/memos/README.zh.md @@ -0,0 +1,89 @@ +# Memos + +[English](./README.md) | [中文](./README.zh.md) + +此服务用于部署 Memos,一个隐私优先的轻量级笔记服务。轻松捕捉和分享你的灵感。 + +## 服务 + +- `memos`: Memos 笔记服务。 + +## 配置 + +- `MEMOS_VERSION`: Memos 镜像的版本,默认为 `0.25.3`。 +- `MEMOS_PORT_OVERRIDE`: Memos 的主机端口,默认为 `5230`。 +- `MEMOS_MODE`: 服务器模式(`dev`、`prod` 或 `demo`),默认为 `prod`。 +- `MEMOS_ADDR`: 服务器地址,默认为 `0.0.0.0`。 +- `MEMOS_PORT`: 容器内的服务器端口,默认为 `5230`。 +- `MEMOS_DATA`: 容器内的数据目录路径,默认为 `/var/opt/memos`。 +- `MEMOS_DRIVER`: 数据库驱动(`sqlite`、`postgres` 或 `mysql`),默认为 `sqlite`。 +- `MEMOS_DSN`: 数据库连接字符串(使用 PostgreSQL 或 MySQL 时必需)。 +- `MEMOS_INSTANCE_URL`: Memos 实例的公网 URL(可选)。 + +## 卷 + +- `memos_data`: 用于存储 Memos 数据的卷。 + +## 使用 + +### 快速开始(使用默认 SQLite) + +1. 启动服务: + + ```bash + docker compose up -d + ``` + +2. 在浏览器中访问 `http://localhost:5230`。 + +### 使用 PostgreSQL 或 MySQL + +如果要使用 PostgreSQL 或 MySQL 替代 SQLite: + +1. 编辑 `.env` 文件并设置: + + ```env + MEMOS_DRIVER=postgres # 或 mysql + MEMOS_DSN=postgres://user:password@host:port/dbname?sslmode=disable + ``` + +2. 启动服务: + + ```bash + docker compose up -d + ``` + +## 首次设置 + +首次启动 Memos 后: + +1. 在浏览器中打开 `http://localhost:5230`。 +2. 创建你的管理员账户。 +3. 开始记笔记! + +## 数据持久化 + +所有数据都存储在 `memos_data` 卷中,在容器重启和升级时会保留。 + +## 更新 + +更新 Memos: + +1. 编辑 `.env` 文件,将 `MEMOS_VERSION` 改为所需版本。 +2. 重启服务: + +```bash +docker compose down +docker compose pull +docker compose up -d +``` + +## 官方文档 + +- [Memos 官方网站](https://usememos.com/) +- [Memos 文档](https://usememos.com/docs) +- [Memos GitHub 仓库](https://github.com/usememos/memos) + +## 许可证 + +Memos 采用 [MIT License](https://github.com/usememos/memos/blob/main/LICENSE) 许可。 diff --git a/src/memos/docker-compose.yaml b/src/memos/docker-compose.yaml new file mode 100644 index 0000000..436c016 --- /dev/null +++ b/src/memos/docker-compose.yaml @@ -0,0 +1,43 @@ +x-defaults: &defaults + restart: unless-stopped + logging: + driver: json-file + options: + max-size: 100m + max-file: "3" + +services: + memos: + <<: *defaults + image: ${GLOBAL_REGISTRY:-}neosmemo/memos:${MEMOS_VERSION:-0.25.3} + ports: + - "${MEMOS_PORT_OVERRIDE:-5230}:5230" + volumes: + - memos_data:/var/opt/memos + environment: + TZ: ${TZ:-UTC} + MEMOS_MODE: ${MEMOS_MODE:-prod} + MEMOS_ADDR: ${MEMOS_ADDR:-0.0.0.0} + MEMOS_PORT: ${MEMOS_PORT:-5230} + MEMOS_DATA: ${MEMOS_DATA:-/var/opt/memos} + MEMOS_DRIVER: ${MEMOS_DRIVER:-sqlite} + # Uncomment and configure for PostgreSQL or MySQL + # MEMOS_DSN: ${MEMOS_DSN:-} + # MEMOS_INSTANCE_URL: ${MEMOS_INSTANCE_URL:-} + deploy: + resources: + limits: + cpus: ${MEMOS_CPU_LIMIT:-1.0} + memory: ${MEMOS_MEMORY_LIMIT:-512M} + reservations: + cpus: ${MEMOS_CPU_RESERVATION:-0.25} + memory: ${MEMOS_MEMORY_RESERVATION:-128M} + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5230/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s + +volumes: + memos_data: