Skip to content

Latest commit

 

History

1,084 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Etherpad-Go-EXPERIMENTAL

A fast, modern, real-time collaborative editor written in Go

CI Go Version License Release Docker Image

Etherpad-Go is a performance-focused, 1:1(currently partial) rewrite of Etherpad in Go. The original implementation was written in Node.js (CommonJS). Rewriting Etherpad in Go allows us to leverage Go’s concurrency model, static typing, fast startup times, and lower memory usage however there are trade offs and this is an experimental branch so YMMV!

Etherpad-Go Logo

Etherpad in action

Etherpad is a real-time collaborative editor scalable to thousands of simultaneous users and supports full data export.


Quick Start (Binary)

The easiest way to run Etherpad-Go:

  1. Download the binary for your platform from the
    Releases page
  2. Run it:
./etherpad-go

Etherpad-Go starts in under a second and uses an in-memory database by default, which is sufficient for many use cases.

Open your browser at:
http://localhost:9001


Configuration

All configuration options are self-documented in the binary.

Show global options:

./etherpad-go --help

Show all configuration values:

./etherpad-go config show

Get a specific configuration value:

./etherpad-go config get <key>

In the Docker image the same commands work through docker exec (see Docker).

For customization, copy:

settings.json.template → settings.json

and adjust it to your needs.

Settings from the environment

Every setting can also come from an environment variable, which is handy for containers and Kubernetes secrets. The name is ETHERPAD_ plus the setting's path, matched without regard to case or underscores, so ETHERPAD_PADOPTIONS_SHOWCHAT and ETHERPAD_PAD_OPTIONS_SHOW_CHAT both set padOptions.showChat. A number is a place in a list, counted from 0:

ETHERPAD_SSO_ISSUER=https://pads.example.com
ETHERPAD_SSO_CLIENTS_0_CLIENT_ID=admin_client
ETHERPAD_SSO_CLIENTS_0_CLIENT_SECRET=...        # from a secret
ETHERPAD_SSO_CLIENTS_0_TYPE=admin
ETHERPAD_SSO_CLIENTS_0_REDIRECT_URIS=https://pads.example.com/admin/,https://pads.example.com/admin
ETHERPAD_SSO_CLIENTS_1_CLIENT_ID=user_client
ETHERPAD_SSO_CLIENTS_1_TYPE=user
  • Lists merge with the settings file, place by place. If settings.json has client 0, ETHERPAD_SSO_CLIENTS_0_CLIENT_SECRET replaces only its secret and the rest stays. The place after the last one adds an element. Places have no gaps: client 0 and 2 without 1 stops the start with an error. Spring Boot would replace the whole list instead.
  • Lists of plain values can also be given whole, comma separated: ETHERPAD_AVAILABLEEXPORTS=pdf,html, or place by place: …_GRANT_TYPES_0=authorization_code.
  • Values are typed by their setting. A text setting keeps the text as it is, so a secret 0123 stays 0123. A switch takes true or false, and a number setting takes a number. Anything else stops the start with the variable's name.
  • Maps with free keys need their parts spelled out with EP__ and double underscores (etherpad-lite's form), because a free key may itself contain underscores. This covers users, plugins and the sections of plugins: EP__users__alice__password=..., EP__ep_comments_page__highlightSelectedText=true. Places in lists work here too: EP__sso__clients__0__display_name=Admin.
  • A variable that matches no setting is reported at start-up: warning: ETHERPAD_PADOPTIONS_SHOWCHATT matches no setting and is ignored. The variables of the command line (ETHERPAD_SETTINGS_FILE, ETHERPAD_URL, ETHERPAD_API_KEY, …) and the ones Kubernetes sets for a Service named etherpad (ETHERPAD_SERVICE_HOST, ETHERPAD_PORT_9001_TCP…) are not reported.

The environment wins over settings.json, and ${VAR} / ${VAR:default} inside settings.json keeps working.

Behind a reverse proxy under a path

Etherpad can be served under a path such as https://example.org/pads/. The proxy strips the prefix and names it in the x-proxy-path header, for example with nginx:

location /pads/ {
    proxy_pass http://127.0.0.1:9001/;
    proxy_set_header x-proxy-path /pads;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

With "trustProxy": true the standard X-Forwarded-Prefix (Traefik, HAProxy) and X-Ingress-Path (Home Assistant) work too; without it they are ignored, since any client could send them when Etherpad is reachable directly. Pages, the admin UI, the websockets and /manifest.json then stay under the prefix. Pages that carry the prefix answer with Vary on these headers and are not stored by shared caches.


Compacting pad history

Long-lived pads collect revisions. etherpad-go compact collapses a pad's history (or keeps its last revisions) through the HTTP API of the running server, like etherpad-lite's bin/compactPad, bin/compactAllPads and bin/compactStalePads. It needs cleanup.enabled = true in the settings and an API key from the admin page. It is destructive: export what you cannot lose as .etherpad first.

export ETHERPAD_API_KEY=...                 # or --apikey
etherpad-go compact myPad                   # collapse all history of one pad
etherpad-go compact myPad --keep 50         # keep the last 50 revisions
etherpad-go compact --all --dry-run         # list every pad and its revisions, change nothing
etherpad-go compact --older-than 90         # pads not edited for 90 days

The server's address comes from --url, ETHERPAD_URL or the settings (http://<ip>:<port>). A pad that fails does not stop the run; the exit code is 1 when one did. In Docker: docker exec -e ETHERPAD_API_KEY=... <container> etherpad-go compact --all.

Docker

You can run Etherpad-Go using Docker.

Docker Compose (recommended)

Start Etherpad-Go with PostgreSQL:

docker compose up -d

Etherpad will be available at:
http://localhost:9001

The compose file can be found here:
docker-compose.yml

Build your own image

docker build -t etherpad-go .

Prebuilt images

Prebuilt images are available via GitHub Container Registry:

ghcr.io/ether/etherpad-go:<version>

To open a shell in a running container (busybox: ls, cat, less, grep, vi, …, no network tools):

docker exec -it etherpad_go sh

The configuration CLI is the image's etherpad-go, on the PATH:

docker exec etherpad_go etherpad-go config show
docker exec etherpad_go etherpad-go config get port

Files and the user in the image

The server runs as the unprivileged user 65532. It writes to two directories, which belong to that user in the image:

Directory What Mount a volume here for
/var the SQLite database (var/etherpad.db, the default) and the update state SQLite
/data settings.json (ETHERPAD_SETTINGS_FILE=/data/settings.json), also as saved in the admin UI settings

The ownership in the image only covers the directories themselves and a named Docker volume created from them. A host directory you bind-mount at /var or /data keeps its own owner and must be writable for 65532, or the server cannot open SQLite or save settings from the admin UI:

sudo chown -R 65532:65532 ./etherpad-data

A settings.json mounted at /settings.json is still read, as long as /data/settings.json does not exist. Settings saved in the admin UI go to /data/settings.json, which is then the one read. Relative favicon paths are still looked up in /, and so is /APIKEY.txt, whose key becomes a token on the first start with tokens; after that the file is ignored (see doc/http-api.md). If a settings file exists but cannot be read (no permission), the server does not start rather than fall back to the defaults.

Upgrading from an image that ran as root: a volume on /var belongs to root, and the server stops with attempt to write a readonly database. Hand it over once:

docker run --rm -v <volume>:/var alpine chown -R 65532:65532 /var

With Postgres or MySQL and no volume, nothing changes.

Several instances / Kubernetes

With PostgreSQL or MySQL, several Etherpad-Go instances can share one database behind a stateless load balancer or Ingress — no sticky sessions needed. The instances find each other through the database and only need to reach each other on port 7946 (TCP and UDP). See doc/cluster.md for how it works, the settings and a Kubernetes example.


Building from Source

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/ether/etherpad-go.git
    cd etherpad-go
  2. Build etherpad-go:

    go run main.go prepare
  3. Run the server. The server path is printed after a successful build:

    ./<your-built-binary>

Etherpad should start in less than a second.


Migration from Etherpad-Lite

You can migrate existing pads from Etherpad-Lite using the migration command:

migration 192.28.91.4:5432 \
  --type postgres \
  --username myOldEtherpadDBUser \
  --database myoldEtherpadDB

This connects to the old Etherpad-Lite database and migrates all pads to the Etherpad-Go database configured in settings.json or via environment variables.


Plugins

Etherpad-Go ships with 15 built-in plugins ported from the original Etherpad ecosystem. All plugins are disabled by default and can be enabled individually.

Available Plugins

Plugin Description
ep_align Text alignment (left, center, right, justify)
ep_author_hover Show author name on text hover
ep_chat_log_join_leave Log user join/leave events in the chat
ep_clear_formatting Remove all formatting from selected text
ep_cursortrace Show other users' cursor positions in real time
ep_font_color Change text color (6 colors)
ep_font_family Change font family (10 fonts)
ep_font_size Change font size (15 sizes from 8px to 60px)
ep_heading Heading levels (h1-h4)
ep_markdown Markdown editing support
ep_print Print the pad
ep_rss RSS feed for pad content
ep_spellcheck Browser spell checking
ep_table_of_contents Sidebar table of contents from headings

Enabling Plugins

Via settings.json:

{
  "plugins": {
    "ep_align": { "enabled": true },
    "ep_cursortrace": { "enabled": true },
    "ep_font_color": { "enabled": true }
  }
}

Or via environment variables:

ETHERPAD_PLUGINS_EP_ALIGN_ENABLED=true
ETHERPAD_PLUGINS_EP_CURSORTRACE_ENABLED=true

Status

Etherpad-Go is under active development. Feedback, issues, and contributions are welcome.

Releases

Packages

Used by

Contributors

Languages