Introduction
HedgeDoc is a collaborative markdown editor that allows multiple users to edit documents in real-time. Itโs often used for note-taking and documentation among teams. Self-hosting HedgeDoc on a Virtual Private Server (VPS) gives you complete control over your data and ensures privacy. In this guide, weโll walk you through the steps to install HedgeDoc on a VPS using Docker.
Prerequisites
- A VPS: Choose a suitable VPS provider. Hereโs a quick comparison of some popular options:
| Provider | Monthly Price | RAM | Disk Space | CPU |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR | 4 GB | 50 GB | 2 Cores |
| Hetzner Cloud | 4.15 EUR | 2 GB | 20 GB | 1 Core |
| DigitalOcean | 6 USD | 2 GB | 1 vCPU | 1 Core |
| Vultr | 6 USD | 2 GB | 1 vCPU | 1 Core |
| Linode (Akamai) | 5 USD | 2 GB | 1 vCPU | 1 Core |
For detailed comparisons of various VPS providers, check our full VPS comparison.
-
SSH Access: Ensure you can access your VPS via SSH.
-
Docker and Docker Compose: Ensure that both Docker and Docker Compose are installed on your VPS. You can install them using the following commands:
sudo apt update sudo apt install -y docker.io docker-compose
Step 1: Setting Up the HedgeDoc Environment
-
Create a directory for HedgeDoc:
mkdir ~/hedgedoc cd ~/hedgedoc -
Create a
docker-compose.ymlfile in thehedgedocdirectory. Add the following configuration to set up HedgeDoc with PostgreSQL as the database:version: '3.1' services: hedgedoc: image: hedgedoc/hedgedoc:latest environment: - CMD_URI=https://your-domain.com - DB_TYPE=postgres - DB_HOST=db - DB_PORT=5432 - DB_USER=hedgedoc - DB_PASS=hedgedoc_password - DB_NAME=hedgedoc ports: - '3000:3000' depends_on: - db db: image: postgres:latest environment: - POSTGRES_USER=hedgedoc - POSTGRES_PASSWORD=hedgedoc_password - POSTGRES_DB=hedgedoc volumes: - db_data:/var/lib/postgresql/data volumes: db_data: -
Replace
your-domain.comwith the actual domain you will use to access HedgeDoc.
Step 2: Running HedgeDoc
-
Start the HedgeDoc application using Docker Compose:
docker-compose up -d -
Verify that HedgeDoc is running correctly by checking the logs:
docker-compose logs -f -
By default, HedgeDoc will be accessible at
http://your-server-ip:3000. Youโll want to set up a reverse proxy for a production environment.
Step 3: Setting Up a Reverse Proxy with Nginx
-
Install Nginx:
sudo apt install -y nginx -
Create a new configuration file for HedgeDoc:
sudo nano /etc/nginx/sites-available/hedgedoc -
Add the following configuration:
server { listen 80; server_name your-domain.com; location / { proxy_pass http://localhost:3000; 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; } } -
Enable the configuration:
sudo ln -s /etc/nginx/sites-available/hedgedoc /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
Step 4: Securing HedgeDoc with SSL
-
To secure your HedgeDoc instance, you can use Letโs Encrypt. Install Certbot:
sudo apt install -y certbot python3-certbot-nginx -
Run Certbot to get SSL for your domain:
sudo certbot --nginx -d your-domain.com
Frequently Asked Questions
1. What are the benefits of self-hosting HedgeDoc?
Self-hosting HedgeDoc grants you unparalleled control over your data and privacy. Unlike cloud-based options, when you self-host, you manage security updates and customizations according to your needs. This setup is crucial for developers and homelabbers who require compliance with specific data handling processes or want to integrate HedgeDoc into more extensive systems seamlessly.
2. Can I run HedgeDoc on low-spec VPS?
Yes, HedgeDoc can run efficiently on a low-spec VPS, provided that it meets the system requirements. For basic operations, a VPS with 2 GB of RAM and minimal disk space suffices. However, for larger instances or collaborations with multiple users, consider a VPS with at least 4 GB RAM and 50 GB of disk space to ensure smooth performance. The pricing structure of providers like Contabo and Hetzner can meet this need affordably.
3. How do I update my HedgeDoc installation?
Updating HedgeDoc is straightforward due to its Docker setup. You can pull the latest image and restart the containers. Hereโs the command to do that:
docker-compose pull
docker-compose up -d
After executing these commands, you should regularly check the HedgeDoc release notes for any changes or required migration steps to ensure seamless operation. You can refer to the HedgeDoc documentation for specific details on version updates.
Conclusion
Self-hosting HedgeDoc on a VPS allows you to benefit from a powerful markdown editor while retaining control over your environment. With the setup steps outlined above, you should now be able to install, configure, and secure HedgeDoc effectively. Enjoy real-time collaboration without compromising on privacy or data integrity.