firstfinger
2 min readMar 22, 2024

Read Original Post: https://firstfinger.in/memos-mysql-s3/

What is Memos?

Memos Note Taking App

Memos is an open-source, privacy-first, and lightweight note-taking application service that allows you to easily capture and share your thoughts.

Memos features:

  • Open-source and free forever
  • Self-hosting with Docker in seconds
  • Pure text with Markdown support
  • Customize and share notes effortlessly
  • RESTful API for third-party integration

Self-Hosting Memos with Docker and MySQL Database

You can self-host Memos quickly using Docker Compose with a MySQL database. Here are the steps:

Prerequisites: Docker and Docker Compose installed

version: "3.0"
services:
mysql:
image: mysql:8.0
environment:
TZ: Asia/Kolkata
MYSQL_ROOT_PASSWORD: memos
MYSQL_DATABASE: memos-db
MYSQL_USER: memos
MYSQL_PASSWORD: memos
volumes:
- mysql_data:/var/lib/mysql
memos:
image: neosmemo/memos:stable
container_name: memos
environment:
MEMOS_DRIVER: mysql
MEMOS_DSN: memos:memos@tcp(mysql:3306)/memos-db
depends_on:
- mysql
volumes:
- ~/.memos/:/var/opt/memos
ports:
- "5230:5230"

volumes:
mysql_data:
  1. Create a new file named docker-compose.yml and copy the above content.
  2. This sets up a MySQL 8.0 database service and the Memos app linked to it.
  3. Run docker-compose up -d to start the services in detached mode.
  4. Memos will be available at http://localhost:5230.

The configurations are:

  • mysql service runs MySQL 8.0 with a database named memos-db.
  • memos service runs the latest Memos images, and links to the mysql service.
  • MEMOS_DRIVER=mysql tells Memos to use the MySQL database driver.
  • MEMOS_DSN contains the database connection details.
  • The ~/.memos the directory is mounted for data persistence.

You can customize the MySQL password, database name, and other settings by updating the environment variables.

Configuring S3 Compatible Storage

Memos support integrating with S3-compatible object storage like Amazon S3, Cloudflare R2, DigitalOcean Spaces, etc

To use AWS S3/ Cloudflare’s R2 as object storage

  1. Create a S3/Cloudflare R2 bucket
  2. Get the API token with object read/write permissions
  3. In Memos Admin Settings > Storage, create a new storage
  4. Enter details like Name, Endpoint, Region, Access Key, Secret Key, Bucket name and Public URL (For Cloudflare R2 set Region = auto)
  5. Save and select this storage
configure memos with external S3 Object Storage
For Cloudflare R2 set Region = auto

With this setup, you can self-host the privacy-focused Memos note app using Docker Compose with a MySQL database, while integrating scalable S3 or R2 storage for persisting data.

No responses yet