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:
ssh root@your-ip
apt update && apt upgrade -y
mkdir -p /opt/docmost && cd /opt/docmostCheck that Docker and the Compose plugin answer:
docker --version
docker compose versionIf 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:
openssl rand -hex 32Then create /opt/docmost/docker-compose.yml. Replace the domain, the secret and the database password:
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:
docker compose up -d
docker compose psAll 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:
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 caddyReplace the content of /etc/caddy/Caddyfile with:
wiki.example.com {
reverse_proxy 127.0.0.1:3000
}Then reload Caddy:
systemctl reload caddyOpen 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:
#!/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 -deleteMake it executable and schedule it for 3 a.m.:
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#
cd /opt/docmost
./backup.sh
docker compose pull
docker compose up -dRead 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.


