Self-hosting HedgeDoc: Building a Collaborative Markdown Environment

Self-hosting HedgeDoc: Building a Collaborative Markdown Environment

Imagine trying to take group notes during a fast-paced lecture—everyone’s scribbling, and syncing later is a mess. That’s why I set up HedgeDoc, an open-source, real-time collaborative markdown editor, on my MacBook to streamline note-sharing with my classmates. Here’s how I did it, why it’s awesome, and how you can try it too!

What is HedgeDoc?

HedgeDoc is like Google Docs for markdown lovers, letting multiple users edit notes in real-time with full privacy through self-hosting. It’s perfect for students, developers, or anyone who wants a secure, collaborative workspace.

Why It’s Cool

  • Real-time Magic: See everyone’s cursors as you co-edit notes during lectures.
  • Markdown Power: Format notes beautifully with live previews.
  • Version History: Track changes effortlessly.
  • Export Options: Save as PDF, HTML, or even slides for presentations.
  • Privacy First: Self-hosted, so your data stays with you.

Technical Implementation

Setting up HedgeDoc using Docker was straightforward. Here's a simplified version of the setup:

  1. Created a Docker Compose configuration for both the application and database
  2. Implemented dynamic IP detection for local network access
  3. Configured PostgreSQL for persistent storage
  4. Set up volume mounts for user uploads


Article content

Docker Configuration Highlights

The setup uses two main services:

services:
  database:
    image: postgres:13.4-alpine
    environment:
      - POSTGRES_USER=hedgedoc
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=hedgedoc
    volumes:
      - database:/var/lib/postgresql/data

  app:
    image: quay.io/hedgedoc/hedgedoc:1.10.2
    environment:
      - CMD_DB_URL=postgres://hedgedoc:password@database:5432/hedgedoc
      - CMD_DOMAIN=10.136.42.74
      - CMD_URL_ADDPORT=true
      - CMD_CSP_ENABLE=false
      - CMD_SESSION_SECRET=your-secure-random-secret-here
    volumes:
      - uploads:/hedgedoc/public/uploads
    ports:
      - 3000:3000
    depends_on:
      - database

volumes:
  database:
    driver: local
  uploads:
    driver: local        

Challenges and Solutions

During implementation, I encountered and solved several interesting challenges:

  1. Network Access: Initially, the service was only accessible locally. I solved this by dynamically detecting the host IP and configuring HedgeDoc accordingly.
  2. Persistence: Ensuring data persistence across container restarts required proper volume configuration.
  3. Security: Balanced accessibility with security by configuring appropriate environment variables and network settings.

Getting Started

Want to set up your own HedgeDoc instance? Here's a quick guide:

  1. Clone the configuration files
  2. Install Docker and Docker Compose
  3. Run the startup script
  4. Access the platform through your local network

Impact and Usage

This implementation has significantly improved our classroom collaboration:

  • Students can simultaneously edit notes during lectures
  • Easy sharing of study materials
  • Version control for tracking changes
  • Accessible from any device on the local network

Article content
Article content

Resources

Acknowledgments

Special thanks to Dr. Sripath Roy Koganti for encouraging exploration of open-source technologies and fostering a culture of technical innovation in our classroom.

To view or add a comment, sign in

Others also viewed

Explore content categories