Deploy Self-Hosted Twitter-Like Notes App With Docker

Photo by Brett Jordan / Unsplash

Deploy Self-Hosted Twitter-Like Notes App With Docker

Self-Host Memos With Docker To Simplify And Speed Up Your Note-Taking Process

Paul Knulst  in  Self-Hosted Apr 6, 2023 5 min read

Introduction

Are you looking for a better way to take notes? How about something that’s both familiar and efficient? Memos is a Twitter-Like note-taking app that can be deployed with Docker in ~10 seconds.

Whether you’re in a meeting, on the go, or just trying to remember something important, Memos is the perfect note-taking solution for the modern age. So why settle for a boring old note-taking app when you can use Memos to do the job in style?

Memos gives you the feeling of a social hub/social network because you can write down your notes in private and in public. This feels like having a self-hosted alternative to Twitter used for notes which is also privacy-focused.

Just try it out and see how much easier your life can be!

Core features of Memos

I have been using Memos for some time and it’s really come a long way. As I started using it, it had some limitations and bugs making it a bit frustrating. Fortunately, the developers put a lot of effort into improving them leading to impressive results.

Now, Memos is very fast, more intuitive, and full of useful features making taking notes a lot easier and fun. Everything seems to have been designed to streamline the workflow and maximize productivity for the user.

I’m very happy with all the current improvements that have been implemented into Memos. It’s obvious that the Memos developers want to create a high-quality product that meets the needs of their users.

The most important features of Memos:

  • 💎 It is Open-Source!
  • 🚀 Support for self-hosting with Docker in seconds
  • 📑 Supports Markdown
  • 📎 Share notes to other websites (using iframe)
  • 📲 Apps
  • 🔗 Share memos via links or images
  • ⛔️ Private or public Memos
  • 💻 RESTful API to connect apps (mobile, desktop)
  • 🌗 Light and Dark mode
  • ️️️😲Hashtags
  • 🔍 Search to quickly find notes
  • 📆  Calendar view

How To Install Memos Locally with Docker

Memos can be installed locally with Docker by running a simple Docker run command or using a Docker Compose file.

Simple Docker Run:

docker run -d --name memos -p 5230:5230 -v ./memos/:/var/opt/memos neosmemo/memos:latest

Docker Compose file:

version: "3.4"
services:
  memos:
    image: neosmemo/memos:latest
    container_name: memos
    volumes:
      - ./memos/:/var/opt/memos
    ports:
      - 5230:5230
💡
Note: Change the port and folder to meet your personal needs.

Use Traefik To Install Memos With Docker On Your Server

Memos can also be used on a server to be accessible over the internet. In this section, you will learn how to achieve this by using a Traefik proxy, a domain, and a server running Docker or Docker in Swarm mode.

As a prerequisite, you should have set up your server running a Docker environment or your server cluster running several Docker environments in Swarm mode. Furthermore, you need to install Traefik as a service that will do the automatic SSL certificate management and URL forwarding for your Memos service.

Deploy Memos on a server with Docker

If you want to deploy Memos on a server that is reachable over the internet and uses a Traefik proxy to forward requests, you should be familiar with Traefik and Docker. If not, you can learn it in these two tutorials from me:

  1. Beginner-friendly introduction to DevOps with Docker on Windows
  2. How To Setup Traefik v2 with Automatic Let’s Encrypt Certificate Resolver

If familiar with the topics explained in the tutorials, create this docker-compose file which will be used to run Memos on a single server with Docker and Traefik:

version: "3.4"
services:
  memos:
    image: neosmemo/memos:latest
    container_name: memos
    volumes:
      - data/:/var/opt/memos
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.constraint-label=traefik-public
      - traefik.http.routers.memos-http.rule=Host(`${MEMOS_DOMAIN?Variable not set}`)
      - traefik.http.routers.memos-http.entrypoints=http
      - traefik.http.routers.memos-http.middlewares=https-redirect
      - traefik.http.routers.memos-https.rule=Host(`${MEMOS_DOMAIN?Variable not set}`)
      - traefik.http.routers.memos-https.entrypoints=https
      - traefik.http.routers.memos-https.tls=true
      - traefik.http.routers.memos-https.tls.certresolver=le
      - traefik.http.services.memos.loadbalancer.server.port=5230
  networks:
    - traefik-public

volumes:
  data:
networks:
  traefik-public:
    external: true

Adjustments:

1. Export the environment variable that is used while starting the docker service

export MEMOS_DOMAIN=memos.paulsblog.dev

Run it:

docker-compose up -d

Open your domain (MEMOS_DOMAIN), create the initial admin user, and start using the Twitter-like note-taking app Memos!

Deploy Memos in a cluster (Docker in Docker Swarm Mode)

If you think about deploying it on a server cluster you can use Docker Swarm Mode. I have written two simple How-Tos about Docker in Swarm Mode which will explain how to create a production-ready Docker Swarm cluster:

  1. Docker Swarm In A Nutshell
  2. 4 Important Services for Docker Swarm (covering traefik too)

If you have set up your Docker Swarm, use this docker-compose file for deploying Memos in a Docker Swarm using a Traefik Proxy.

version: "3.4"
services:
  memos:
    image: neosmemo/memos:latest
    container_name: memos
    volumes:
      - data/:/var/opt/memos
    deploy:
      placement:
        constraints:
          - node.hostname == YOUR_NODE_HOSTNAME_HERE
      labels:
        - traefik.enable=true
        - traefik.docker.network=traefik-public
        - traefik.constraint-label=traefik-public
        - traefik.http.routers.memos-http.rule=Host(`${MEMOS_DOMAIN?Variable not set}`)
        - traefik.http.routers.memos-http.entrypoints=http
        - traefik.http.routers.memos-http.middlewares=https-redirect
        - traefik.http.routers.memos-https.rule=Host(`${MEMOS_DOMAIN?Variable not set}`)
        - traefik.http.routers.memos-https.entrypoints=https
        - traefik.http.routers.memos-https.tls=true
        - traefik.http.routers.memos-https.tls.certresolver=le
        - traefik.http.services.memos.loadbalancer.server.port=5230
  networks:
    - traefik-public

volumes:
  data:
networks:
  traefik-public:
    external: true

Adjustments:

  1. Replace YOUR_NODE_HOSTNAME_HERE with any Worker Node Hostname from your Swarm cluster.
  2. Export the environment variable that will be used while deploying
export MEMOS_DOMAIN=memos.paulsblog.dev

Deploy it:

docker stack deploy -c docker-compose.memos-swarm.yml memos

After some seconds your Memos instance should run and you can access it by opening the provided domain (MEMOS_DOMAIN). Create a user and login to start using Memos.

Third-party tools for Memos

Third-party tools are often a game-changer for any application because they integrate seamlessly with the product and enable usage in different use cases.

Memos is no exception, as it has a RESTful API that different apps can use.

The following third-party tools extend the functionality of Memos by providing apps for different platforms:

Closing Notes

Memos is a fantastic software with many features while maintaining a small footprint and can be installed with Docker in ~5 seconds. The social media-like experience and its effortless interface make using it a breeze and I find myself drawn to it multiple times.

Also, the Memos web user interface is optimized for mobile devices as it looks like it was developed mobile-first. Additionally, for Android and iOS users, there is even a third-party app available. But, with the convenience of creating a web version shortcut on your phone, I do not find the third-party app necessary.

If you're also looking to simplify and speed up your note-taking process and want to have a fantastic-looking application you should check it out.

You can find my public Memos instance at https://status.paulsblog.dev which I mainly use to inform about anything special regarding my blog.

Do you have any questions regarding this tutorial? I would love to hear your thoughts and answer your questions. Please share everything in the comments.

Feel free to connect with me on Medium, LinkedIn, Twitter, and GitHub.

Thank you for reading, and happy note-taking! 📑🥳 👨🏻‍💻📑


🙌 Support this content

If you like this content, please consider supporting me. You can share it on social media, buy me a coffee, or become a paid member. Any support helps.

See the contribute page for all (free or paid) ways to say thank you!

Thanks! 🥰

By Paul Knulst

I'm a husband, dad, lifelong learner, tech lover, and Senior Engineer working as a Tech Lead. I write about projects and challenges in IT.