Installation

There's several ways to deploy memos yourself. If you have any more questions, don't hesitate to ask in the Discord server!

Docker run

To deploy memos using docker run, you simply need to run one command: docker run -d --name memos -p 5230:5230 -v ~/.memos/:/var/opt/memos neosmemo/memos:latest

This will start memos in the background and expose it on port 5230. The data will be stored in ~/.memos/. You can change the port and the path to the data directory as you like. However, only change the first port, like 8081:5230 to use port 8081. The second port is the port that memos is listening on inside the container. The same is true for the directory. The first path is the path on your host system, the second path is the path inside the container.

Docker compose

To deploy memos using docker compose, you need to create a file called docker-compose.yml with the following content:

version: "3.0"
services:
  memos:
    image: neosmemo/memos:latest
    container_name: memos
    volumes:
      - ~/.memos/:/var/opt/memos
    ports:
      - 5230:5230

Now you can run docker-compose up -d to start memos.

Here, you can edit the port and the path to the data directory as you like. However, only change the first port, like 8081:5230 to use port 8081. The second port is the port that memos is listening on inside the container. The same is true for the directory. The first path is the path on your host system, the second path is the path inside the container.

Then, you can start memos using docker-compose up -d.

Render.com

Create an account at Render ss1

  1. Go to your dashboard

https://dashboard.render.com/

  1. Select New Web Service

    ss2

  2. Scroll down to "Public Git repository"

  3. Paste in the link for the public git repository for memos https://github.com/usememos/memos and press continue

    ss3

  4. Render will pre-fill most of the fields but you will need to create a unique name for your web service

  5. Adjust region if you want to

  6. Don't touch the "branch", "root directory", and "environment" fields

    ss4

  7. Click "enter your payment information" and do so

    ss5

    ss6

  8. Select the starter plan ($7 a month - a requirement for persistant data - render's free instances spin down when inactive and lose all data)

  9. Click "Create Web Service"

ss7

  1. Wait patiently while the magic happens đŸ¤ˇâ€â™‚ī¸

ss8

  1. After some time (~ 6 min for me) the build will finish and you will see the web service is live

ss9

  1. Now it's time to add the disk so your data won't dissappear when the webservice redeploys (redeploys happen automatically when the public repo is updated)

  2. Select the "Disks" tab on the left menu and then click "Add Disk"

ss10

  1. Name your disk (can be whatever)

  2. Set the "Mount Path" to /var/opt/memos

  3. Set the disk size (default is 10GB but 1GB is plenty and can be increased at any time)

  4. Click "Save"

    ss11

  5. Wait...again...while the webservice redeploys with the persistant disk

    ss12

  6. aaaand....we're back online!

    ss13

  7. Time to test! We're going to make sure everything is working correctly.

  8. Click the link in the top left, it should look like https://the-name-you-chose.onrender.com - this is your self hosted memos link!

    ss14

  9. Create a Username and Password (remember these) then click "Sign up as Host"

    ss15

  10. Create a test memo then click save

    ss16

  11. Sign out of your self-hosted memos

    ss17

  12. Return to your Render dashboard, click the "Manual Deploy" dropdown button and click "Deploy latest commit" and wait until the webservice is live again (This is to test that your data is persistant)

    ss18

  13. Once the webservice is live go back to your self-hosted memos page and sign in! (If your memos screen looks different then something went wrong)

  14. Once you're logged in, verify your test memo is still there after the redeploy

    ss19

    ss20

Fly.io

provided by @hu3rror on GitHub

Prerequisites

Install flyctl

  1. Follow the instructions to install fly's command-line interface flyctl.
  2. log into flyctl.
flyctl auth login

Launch a fly application

do not setup Postgres and do not deploy yet!

flyctl launch

This command creates a fly.toml file.

Edit your fly.toml

You can take fly.example.toml in this repository as a reference and modify according to the comments.

Details of manual modifications

1. Add a build section.
[build]
  image = "hu3rror/memos-fly:latest"
2. Add an env section.
[env]
  DB_PATH = "/var/opt/memos/memos_prod.db"  # do not change
  LITESTREAM_REPLICA_BUCKET = "<filled_later>"  # change to your litestream bucket name
  LITESTREAM_REPLICA_ENDPOINT = "<filled_later>"  # change to your litestream endpoint url
  LITESTREAM_REPLICA_PATH = "memos_prod.db"  # keep the default or change to whatever path you want
3. Configure litestream backups

â„šī¸ If you want to use another storage provider, check litestream's "Replica Guides" section and adjust the config as needed.

  1. Log into B2 and create a bucket. Instead of adjusting the litestream config directly, we will add storage configuration to fly.toml.
  2. Now you can set the values of LITESTREAM_REPLICA_ENDPOINT and LITESTREAM_REPLICA_BUCKET to your [env] section.
  3. Then, create an access key for this bucket. Add the key to fly's secret store (Don't add < and >).
    flyctl secrets set LITESTREAM_ACCESS_KEY_ID="<keyId>" LITESTREAM_SECRET_ACCESS_KEY="<applicationKey>"
    
4. Add a persistent volume
  1. Create a persistent volume. Fly's free tier includes 3GB of storage across your VMs. Since memos is very light on storage, a 1GB volume will be more than enough for most use cases. It's possible to change volume size later. A how-to can be found in the "scale persistent volume" section below.

    flyctl volumes create memos_data --region <your_region> --size <size_in_gb>
    

    For example:

    flyctl volumes create memos_data --region hkg --size 1
    
  2. Attach the persistent volume to the container by adding a mounts section to fly.toml.

    [mounts]
      source="memos_data"
      destination="/var/opt/memos"
    
5. Change internal_port in [[services]]
[[services]]
  internal_port = 5230
6. Deploy to fly.io
flyctl deploy

If all is well, you can now access memos by running flyctl open. You should see its login page.

Using nginx as a reverse proxy

Once you have memos running, you can make a reverse proxy using nginx to connect a domain name to your instance.

To do this, first install nginx. Then, create a file called /etc/nginx/sites-available/your-domain-name.com with the following content:

server {
    server_name your-domain-name.com;

    location / {
        proxy_pass http://localhost:5230;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Now, you can enable the site using sudo ln -s /etc/nginx/sites-available/your-domain-name.com /etc/nginx/sites-enabled/your-domain-name.com. Then, you can restart nginx using sudo systemctl restart nginx.

SSL

The easiest way to apply a SSL certificate is using Let's Encrypt. You can use Certbot to get a certificate. To do this, first install certbot using sudo apt install certbot. Then, you can get a certificate using sudo certbot --nginx -d your-domain-name.com. Make sure the domain name is already pointed to your server. Certbot will try to create and install the certificate to your nginx configuration. If it has successfully done this,a few lines looking like this will be added to your configuration file:

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/your-domain-name.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/your-domain-name.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

If these lines are present, you can restart nginx using sudo systemctl restart nginx. SSL should now be available.