A modern Docker-Compose config for Etherpad using nginx as reverse proxy
This is the configuration I use to run my etherpad installations behind nginx:
docker-compose.yml
version: "3.5"
services:
etherpad:
image: etherpad/etherpad:latest
environment:
- TITLE=My Etherpad
- DEFAULT_PAD_TEXT=My Etherpad
- ADMIN_PASSWORD=${ETHERPAD_ADMIN_PASSWORD}
- ADMIN_USER=admin
- DB_TYPE=mysql
- DB_HOST=mariadb
- DB_PORT=3306
- DB_USER=etherpad
- DB_PASS=${MARIADB_PASSWORD}
- DB_NAME=etherpad
- DB_CHARSET=utf8mb4
- API_KEY=${ETHERPAD_API_KEY}
- SESSION_REQUIRED=false
ports:
- "17201:9001"
depends_on:
- mariadb
mariadb:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
- MYSQL_DATABASE=etherpad
- MYSQL_USER=etherpad
- MYSQL_PASSWORD=${MARIADB_PASSWORD}
volumes:
- './mariadb_data:/var/lib/mysql'
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
healthcheck:
test: mysqladmin -p${MARIADB_ROOT_PASSWORD} ping -h localhost
interval: 20s
start_period: 10s
timeout: 10s
retries: 3
.env
Remember to replace the passwords with your own random passwords !
MARIADB_ROOT_PASSWORD=ue9zahb8Poh1oeMieyaeFaicheecaz
MARIADB_PASSWORD=dieQuoghiu6sao9aiphei7eiquael5
ETHERPAD_API_KEY=een4Chohdiedohzaich0ega5thung6
ETHERPAD_ADMIN_PASSWORD=ahNee3OhR6aiCootaiy7uBui3rooco
nginx config
server {
server_name etherpad.mydomain.de;
access_log off;
error_log /var/log/nginx/etherpad.mydomain.de-error.log;
location / {
proxy_pass http://localhost:17201/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_redirect default;
}
listen [::]:443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/etherpad.mydomain.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/etherpad.mydomain.de/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
}
server {
if ($host = etherpad.mydomain.de) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen [::]:80; # managed by Certbot
server_name etherpad.mydomain.de;
return 404; # managed by Certbot
}
How to autostart
Our post Create a systemd service for your docker-compose project in 10 seconds provides an extremely quick and easy-to-use one-liner to create and autostart a systemd
service running docker-compose for your etherpad instance.
How to backup
This will be detailed in a future blogpost.