feat: add memos

This commit is contained in:
Sun-ZhenXing
2026-01-14 14:12:41 +08:00
parent 51fd7ea08b
commit b3c2708a53
6 changed files with 260 additions and 0 deletions

37
src/memos/.env.example Normal file
View File

@@ -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

89
src/memos/README.md Normal file
View File

@@ -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).

89
src/memos/README.zh.md Normal file
View File

@@ -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) 许可。

View File

@@ -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: