Docmost is an open source collaborative wiki (AGPL-3.0): spaces, permissions, real-time editing, built-in diagrams. It is our pick for team documentation in our roundup of open source Notion alternatives. Here is how to install it cleanly on your own server.

Prepare the server#

Connect over SSH, update the system and create a dedicated folder:

bash
ssh root@your-ip
apt update && apt upgrade -y
mkdir -p /opt/docmost && cd /opt/docmost

Check that Docker and the Compose plugin answer:

bash
docker --version
docker compose version

If either command fails, install Docker with the official script (curl -fsSL https://get.docker.com | sh), then run the check again.

Write the Docker Compose file#

First generate a long random application secret:

bash
openssl rand -hex 32

Then create /opt/docmost/docker-compose.yml. Replace the domain, the secret and the database password:

yaml
services:
  docmost:
    image: docmost/docmost:latest
    depends_on:
      - db
      - redis
    environment:
      APP_URL: "https://wiki.example.com"
      APP_SECRET: "paste-the-generated-secret-here"
      DATABASE_URL: "postgresql://docmost:PASSWORD@db:5432/docmost?schema=public"
      REDIS_URL: "redis://redis:6379"
    ports:
      - "127.0.0.1:3000:3000"
    restart: unless-stopped
    volumes:
      - docmost:/app/data/storage

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: docmost
      POSTGRES_USER: docmost
      POSTGRES_PASSWORD: PASSWORD
    restart: unless-stopped
    volumes:
      - db_data:/var/lib/postgresql/data

  redis:
    image: redis:7.2-alpine
    restart: unless-stopped
    volumes:
      - redis_data:/data

volumes:
  docmost:
  db_data:
  redis_data:

Start the three services:

bash
docker compose up -d
docker compose ps

All three containers should be running. If in doubt, docker compose logs -f docmost shows database connection errors.

Add HTTPS with Caddy#

Caddy obtains and renews Let's Encrypt certificates on its own. Install it from its official repository:

bash
apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install -y caddy

Replace the content of /etc/caddy/Caddyfile with:

text
wiki.example.com {
	reverse_proxy 127.0.0.1:3000
}

Then reload Caddy:

bash
systemctl reload caddy

Open https://wiki.example.com: the workspace setup screen shows up. The first account you create becomes the administrator.

Back up the database every night#

A wiki without backups is a wiki on borrowed time. Create the script /opt/docmost/backup.sh:

bash
#!/usr/bin/env bash
set -euo pipefail
cd /opt/docmost
mkdir -p backups
docker compose exec -T db pg_dump -U docmost docmost | gzip > "backups/docmost-$(date +%F).sql.gz"
find backups -name '*.sql.gz' -mtime +14 -delete

Make it executable and schedule it for 3 a.m.:

bash
chmod +x /opt/docmost/backup.sh
(crontab -l 2>/dev/null; echo "0 3 * * * /opt/docmost/backup.sh") | crontab -

Files attached to pages live in the docmost volume. Copy backups off the server regularly (object storage, another machine): a backup on the same disk does not protect you from a failure.

Update Docmost#

bash
cd /opt/docmost
./backup.sh
docker compose pull
docker compose up -d

Read the release notes before a major update: database migrations run automatically on startup.

Frequently asked questions

How much does self-hosting Docmost cost?

The software is free. Count the price of a VPS with 2 GB of RAM, usually $5 to $10 a month depending on the provider, plus the domain name.

Can I install Docmost on shared hosting?

No. Docmost needs Docker, PostgreSQL and Redis, which shared hosting plans cannot run. You need a VPS or a dedicated server.

How do I import Notion pages into Docmost?

Export your Notion workspace as Markdown, then use Docmost's import from the space settings. Pages and hierarchy are kept.

How do I restore a backup?

Unzip the file and send it to the database container: gunzip -c backups/docmost-YYYY-MM-DD.sql.gz | docker compose exec -T db psql -U docmost docmost, on an empty database.