Deploying Etherpad
Introduction
Etherpad is a highly customizable, open-source, web-based collaborative real-time editor that allows multiple users to work on the same document simultaneously. With features like real-time synchronization, extensive plugin support, and easy customization, Etherpad is ideal for team collaboration, note-taking, documentation, and brainstorming sessions. Whether you’re building a collaborative writing platform, an internal team tool, or a public notepad service, Etherpad provides a robust foundation for real-time text editing.
Deploying Etherpad on Klutch.sh provides you with a scalable, reliable infrastructure optimized for collaborative applications. With support for persistent storage, automatic Dockerfile detection, and easy configuration, you can have your Etherpad instance up and running in minutes.
This comprehensive guide walks you through deploying Etherpad on Klutch.sh using a Dockerfile. You’ll learn how to install and configure Etherpad, create a production-ready Dockerfile, set up persistent storage for your data, and deploy your application with best practices for security and performance.
Prerequisites
Before you begin, make sure you have:
- A Klutch.sh account (sign up if you haven’t already)
- A GitHub account and basic Git knowledge
- Basic familiarity with Docker and containerization concepts
- Node.js and npm installed locally (for testing)
Getting Started: Installing Etherpad Locally
Before deploying to Klutch.sh, let’s set up Etherpad locally to understand how it works and test your configuration.
Step 1: Clone the Etherpad Repository
git clone https://github.com/ether/etherpad-lite.gitcd etherpad-liteStep 2: Install Dependencies
Etherpad requires Node.js (version 16.x or higher) and npm:
npm installThis will install all necessary dependencies for running Etherpad.
Step 3: Configure Etherpad (Optional)
Etherpad comes with a default settings.json file. You can customize it for your needs:
cp settings.json.template settings.jsonEdit settings.json to configure:
- Database settings (default is DirtyDB, but MySQL/PostgreSQL are recommended for production)
- Port configuration (default is 9001)
- Admin credentials
- Session key and trust proxy settings
Example basic configuration:
{ "title": "Etherpad on Klutch.sh", "ip": "0.0.0.0", "port": 9001, "dbType": "dirty", "dbSettings": { "filename": "var/dirty.db" }, "defaultPadText": "Welcome to Etherpad on Klutch.sh!\\n\\nStart collaborating now!", "trustProxy": true}Step 4: Run Etherpad Locally
Start the Etherpad server:
npm startOr use the start script:
./bin/run.shVisit http://localhost:9001 in your browser to see Etherpad running locally. You should see the default Etherpad interface where you can create and edit pads.
Creating a Dockerfile for Etherpad
To deploy Etherpad on Klutch.sh, you’ll need a Dockerfile. Klutch.sh automatically detects a Dockerfile in your repository’s root directory and uses it to build your container.
Basic Dockerfile
Create a file named Dockerfile in your project root:
# Use the official Etherpad image as baseFROM etherpad/etherpad:latest
# Set working directoryWORKDIR /opt/etherpad-lite
# Copy custom settings if you have any# COPY settings.json /opt/etherpad-lite/settings.json
# Expose Etherpad portEXPOSE 9001
# Etherpad starts automatically with the official imageThis Dockerfile uses the official Etherpad image, which includes all necessary dependencies and configurations.
Production Dockerfile with Custom Configuration
For more control and customization, you can build from a Node.js base image:
# Use Node.js LTS as baseFROM node:18-alpine
# Install required system dependenciesRUN apk add --no-cache \ git \ curl \ python3 \ make \ g++
# Set working directoryWORKDIR /opt/etherpad-lite
# Clone Etherpad repository (or copy your forked version)RUN git clone --branch master https://github.com/ether/etherpad-lite.git . && \ git checkout $(git describe --tags --abbrev=0)
# Install Etherpad dependenciesRUN npm install --production && \ npm cache clean --force
# Create var directory for databaseRUN mkdir -p var
# Copy custom settingsCOPY settings.json /opt/etherpad-lite/settings.json
# Expose portEXPOSE 9001
# Set environment variableENV NODE_ENV=production
# Start EtherpadCMD ["node", "node_modules/ep_etherpad-lite/node/server.js"]Dockerfile with Database Support
For production deployments with MySQL or PostgreSQL:
FROM node:18-alpine
# Install dependencies including database clientsRUN apk add --no-cache \ git \ curl \ python3 \ make \ g++ \ mysql-client \ postgresql-client
WORKDIR /opt/etherpad-lite
# Clone and install EtherpadRUN git clone --branch master https://github.com/ether/etherpad-lite.git . && \ npm install --production && \ npm cache clean --force
# Create necessary directoriesRUN mkdir -p var
# Copy custom configurationCOPY settings.json /opt/etherpad-lite/settings.json
EXPOSE 9001
ENV NODE_ENV=production
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:9001/ || exit 1
CMD ["node", "node_modules/ep_etherpad-lite/node/server.js"]Deploying Etherpad on Klutch.sh
Now that you have your Dockerfile ready, let’s deploy Etherpad to Klutch.sh.
Step 1: Push Your Code to GitHub
-
Create a new GitHub repository for your Etherpad deployment.
-
Initialize Git in your project directory (if not already done):
Terminal window git init -
Add your files to the repository:
Terminal window git add Dockerfile settings.jsongit commit -m "Add Etherpad Dockerfile and configuration" -
Link to your GitHub repository and push:
Terminal window git remote add origin https://github.com/yourusername/etherpad-deployment.gitgit branch -M maingit push -u origin main
Step 2: Create a Project on Klutch.sh
-
Log in to your Klutch.sh dashboard.
-
Navigate to Create a new project.
-
Give your project a descriptive name (e.g., “Etherpad Collaboration Platform”).
-
Click “Create Project”.
Step 3: Create and Configure Your App
-
Inside your project, navigate to Create a new app.
-
Connect Your GitHub Repository:
- Select your Etherpad GitHub repository from the list
- Choose the branch you want to deploy (e.g.,
main)
-
Configure Traffic Type:
- Select HTTP as the traffic type (Etherpad is a web application)
-
Set the Internal Port:
- Set the internal port to 9001 (Etherpad’s default port)
- This is the port your container listens on internally
-
Select Region and Compute Resources:
- Choose the region closest to your users
- Select appropriate compute resources based on your expected traffic
- For small to medium deployments, start with 1-2 instances
-
Configure Environment Variables: Add any necessary environment variables for your Etherpad configuration:
ADMIN_PASSWORD- Password for admin accessDB_TYPE- Database type (e.g.,mysql,postgres, ordirty)DB_HOST- Database hostname (if using external database)DB_PORT- Database portDB_NAME- Database nameDB_USER- Database usernameDB_PASS- Database passwordSESSION_KEY- Session encryption key (generate a random string)TRUST_PROXY- Set totrueif behind a proxy
Step 4: Configure Persistent Storage
Etherpad stores data in the var directory. To ensure your pads persist across deployments, you need to attach a persistent volume.
-
In your app settings on Klutch.sh, navigate to the Volumes section.
-
Click Add Volume to create a new persistent volume.
-
Configure the volume:
- Mount Path:
/opt/etherpad-lite/var - Size: Start with 5GB (adjust based on your needs)
- Mount Path:
-
Save the volume configuration.
This ensures that your Etherpad database, pad data, and any uploaded files are persisted even when your container restarts or is redeployed.
Step 5: Deploy Your Application
-
Review all your configuration settings.
-
Click “Create” to start the deployment.
-
Klutch.sh will:
- Detect your Dockerfile automatically
- Build the Docker image from your repository
- Deploy the container with your specified configuration
- Set up networking and routing
-
Monitor the build process in the deployment logs.
Once the deployment is complete, your Etherpad instance will be available at a URL like example-app.klutch.sh.
Post-Deployment Configuration
Accessing Your Etherpad Instance
Visit your deployed application URL (e.g., example-app.klutch.sh) to access your Etherpad instance. You should see the Etherpad homepage where you can create new pads.
Setting Up Admin Access
To access the admin interface:
- Navigate to
https://example-app.klutch.sh/admin - Log in with your admin credentials (configured via environment variables)
- From the admin panel, you can:
- Manage plugins
- View system settings
- Monitor active pads
- Configure additional settings
Installing Plugins
Etherpad supports numerous plugins for extended functionality. To install plugins:
- Access the admin panel at
/admin - Navigate to the “Plugin Manager” section
- Search for and install plugins such as:
ep_comments_page- Add commenting functionalityep_markdown- Markdown supportep_headings2- Heading supportep_font_color- Text color options
Alternatively, you can add plugins to your Dockerfile:
# Install plugins during buildRUN npm install --no-save \ ep_markdown \ ep_comments_page \ ep_headings2Database Configuration
While Etherpad’s default DirtyDB works for small deployments, production environments should use a proper database.
Using MySQL
Update your settings.json:
{ "dbType": "mysql", "dbSettings": { "host": "your-mysql-host", "port": 3306, "database": "etherpad", "user": "etherpad_user", "password": "secure_password", "charset": "utf8mb4" }}You can also configure database settings using environment variables in your Klutch.sh app settings instead of modifying settings.json. Set these in the dashboard:
DB_TYPE(e.g.,mysql)DB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASSfor connection details
Using PostgreSQL
Update your settings.json:
{ "dbType": "postgres", "dbSettings": { "host": "your-postgres-host", "port": 5432, "database": "etherpad", "user": "etherpad_user", "password": "secure_password" }}Environment Variables Reference
Configure these environment variables in the Klutch.sh dashboard:
| Variable | Description | Example |
|---|---|---|
TITLE | Instance title | "My Etherpad" |
PORT | Port number (internal) | 9001 |
ADMIN_PASSWORD | Admin interface password | secure_admin_pass |
DB_TYPE | Database type | mysql, postgres, dirty |
DB_HOST | Database host | db.example.com |
DB_PORT | Database port | 3306 |
DB_NAME | Database name | etherpad |
DB_USER | Database user | etherpad_user |
DB_PASS | Database password | secure_password |
SESSION_KEY | Session encryption key | random_key_here |
TRUST_PROXY | Trust proxy headers | true |
Scaling and Performance
Horizontal Scaling
Etherpad can be scaled horizontally for high-traffic scenarios:
- Increase the number of instances in your Klutch.sh app settings
- Ensure you’re using a centralized database (MySQL/PostgreSQL)
- Configure session storage to use the database or Redis
Performance Optimization
- Use a production database: MySQL or PostgreSQL instead of DirtyDB
- Enable caching: Configure Redis for session and cache storage
- Optimize plugins: Only install necessary plugins to reduce overhead
- Monitor resources: Use Klutch.sh monitoring to track CPU and memory usage
Security Best Practices
-
Use Strong Admin Passwords:
- Generate secure passwords for admin access
- Store credentials as secrets in environment variables
-
Enable Authentication:
- Consider installing authentication plugins
- Restrict access to sensitive pads
-
Regular Updates:
- Keep Etherpad updated to the latest version
- Update your Docker base image regularly
- Monitor security advisories
-
Secure Database Connections:
- Use encrypted connections to your database
- Store database credentials securely as environment variables
-
Configure Trust Proxy:
- Set
TRUST_PROXYtotruewhen behind a reverse proxy - This ensures correct IP logging and security checks
- Set
Troubleshooting
Application Won’t Start
- Check deployment logs in the Klutch.sh dashboard
- Verify that the internal port is set to 9001
- Ensure all required environment variables are set
- Check that the Dockerfile builds successfully locally
Database Connection Issues
- Verify database credentials in environment variables
- Ensure network connectivity between app and database
- Check database host and port settings
- Test connection with a database client
Pads Not Persisting
- Verify that persistent volume is attached to
/opt/etherpad-lite/var - Check volume mount path in Klutch.sh settings
- Ensure proper file permissions in the container
Performance Issues
- Monitor resource usage in Klutch.sh dashboard
- Consider scaling to larger compute resources
- Optimize database queries and indexes
- Review and remove unnecessary plugins
Resources
- Etherpad GitHub Repository
- Official Etherpad Documentation
- Klutch.sh Quick Start Guide
- Klutch.sh Persistent Volumes Guide
- Klutch.sh Builds Documentation
- Custom Domains on Klutch.sh
Deploying Etherpad on Klutch.sh provides a robust, scalable platform for collaborative editing. With automatic Dockerfile detection, persistent storage support, and easy configuration, you can focus on building your collaborative application while Klutch.sh handles the infrastructure. Whether you’re running a small team collaboration tool or a large-scale public pad service, Klutch.sh gives you the flexibility and reliability you need.