diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e73ffc0 --- /dev/null +++ b/.env.example @@ -0,0 +1,38 @@ +# Copy this file to .env and edit the values before running docker compose up. +# For Appliku production deployments, set these variables in the Appliku +# dashboard instead — do NOT commit a filled-in .env to the repository. + +# Etherpad admin password (used at /admin) — REQUIRED, must be changed +ADMIN_PASSWORD=REPLACE_WITH_STRONG_PASSWORD + +# Instance title shown in the browser +TITLE=Etherpad + +# Host port to expose Etherpad on (local dev only; Appliku manages this) +PORT=9001 + +# Default text shown in new pads (cannot be empty) +DEFAULT_PAD_TEXT=Welcome to Etherpad! + +# Set to true if Etherpad is behind a reverse proxy (always true on Appliku) +TRUST_PROXY=false + +# Disable logging of client IP addresses +DISABLE_IP_LOGGING=false + +# ── Local development: bundled PostgreSQL sidecar ──────────────────────────── +# Used by docker-compose.yml when running locally. Not needed on Appliku. +POSTGRES_DB=etherpad +POSTGRES_USER=etherpad +POSTGRES_PASSWORD=REPLACE_WITH_STRONG_PASSWORD + +# ── Production (Appliku / external PostgreSQL) ─────────────────────────────── +# Set these in the Appliku dashboard (App → Environment Variables). +# Appliku shows the values after you create a database in the dashboard. +# +# DB_TYPE=postgres +# DB_HOST= +# DB_PORT=5432 +# DB_NAME= +# DB_USER= +# DB_PASS= diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ef58358 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +FROM etherpad/etherpad:2.6.1 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..10d5b8d --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node /opt/etherpad-lite/src/node/server.js diff --git a/README.md b/README.md index 1e93ae1..d4b700c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,105 @@ # notes -Etherpad notes on Invisible Information Projects +A self-contained, deployable [Etherpad](https://etherpad.org) instance for Invisible Information Projects. + +## Requirements + +- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) + +## Quick start + +```bash +# 1. Copy the example environment file and edit the passwords / settings +cp .env.example .env +$EDITOR .env + +# 2. Start Etherpad (and its PostgreSQL database) +docker compose up -d + +# 3. Open Etherpad in your browser +open http://localhost:9001 +``` + +The admin interface is available at `http://localhost:9001/admin` using the +password set in `ADMIN_PASSWORD`. + +## Deploying with Appliku + +[Appliku](https://appliku.com) manages the EC2 instance, builds the Docker +image from this repository, and provisions a separate PostgreSQL database — no +SSH or manual server setup is required. + +### 1 — Connect your repository + +1. Log in to [app.appliku.com](https://app.appliku.com) and create a new + application. +2. Connect it to this GitHub repository. +3. Appliku detects the `Dockerfile` and `Procfile` automatically. + +### 2 — Add a PostgreSQL database + +In the Appliku dashboard, go to **Databases → Add database** and create a +PostgreSQL instance. Appliku will make the connection credentials available as +environment variables you can reference in step 3. + +### 3 — Set environment variables + +In **App → Environment Variables**, add the following (use the values shown by +the Appliku database panel for the `DB_*` variables): + +| Variable | Value | +| -------------------- | --------------------------------------- | +| `ADMIN_PASSWORD` | A strong password for `/admin` | +| `DB_TYPE` | `postgres` | +| `DB_HOST` | Appliku DB host | +| `DB_PORT` | `5432` | +| `DB_NAME` | Appliku DB name | +| `DB_USER` | Appliku DB user | +| `DB_PASS` | Appliku DB password | +| `TRUST_PROXY` | `true` (Appliku sits behind a proxy) | +| `TITLE` | *(optional)* Instance title | +| `DISABLE_IP_LOGGING` | *(optional)* `true` to disable IP logs | + +### 4 — Deploy + +Click **Deploy** in the Appliku dashboard (or push a commit — Appliku +auto-deploys on every push). Etherpad will be available at the URL shown in the +dashboard. + +> **Note:** The `docker-compose.yml` in this repo is for **local development +> only**. Appliku uses the `Dockerfile` and `Procfile` for production +> deployments; the bundled PostgreSQL sidecar is not started. + +## Configuration + +All configuration is done through environment variables — in `.env` for local +development, or in the Appliku dashboard for production. +See `.env.example` for the full list of available options. + +| Variable | Description | Default | +| -------------------- | ------------------------------------------------------- | ------------ | +| `ADMIN_PASSWORD` | Password for the `/admin` interface | **required** | +| `TITLE` | Instance title shown in the browser | `Etherpad` | +| `PORT` | Host port Etherpad is exposed on | `9001` | +| `DEFAULT_PAD_TEXT` | Default text inserted into new pads | ` ` | +| `TRUST_PROXY` | Set to `true` when running behind a reverse proxy | `true` | +| `DISABLE_IP_LOGGING` | Set to `true` to disable client IP logging | `false` | +| `DB_TYPE` | Database type (production) | `postgres` | +| `DB_HOST` | Database host (production / Appliku) | — | +| `DB_PORT` | Database port (production / Appliku) | `5432` | +| `DB_NAME` | Database name (production / Appliku) | — | +| `DB_USER` | Database user (production / Appliku) | — | +| `DB_PASS` | Database password (production / Appliku) | — | +| `POSTGRES_DB` | PostgreSQL database name (local dev / bundled DB) | `etherpad` | +| `POSTGRES_USER` | PostgreSQL user (local dev / bundled DB) | `etherpad` | +| `POSTGRES_PASSWORD` | PostgreSQL password (local dev / bundled DB) | **required** | + +## Stopping + +```bash +docker compose down +``` + +Data is persisted in named Docker volumes (`postgres_data`, `etherpad-var`, +`plugins`) and will survive container restarts. + diff --git a/docker-compose.rds.yml b/docker-compose.rds.yml new file mode 100644 index 0000000..e96876e --- /dev/null +++ b/docker-compose.rds.yml @@ -0,0 +1,37 @@ +# Standalone Compose file for deploying Etherpad against Amazon RDS +# (or any external PostgreSQL). No bundled database container is started. +# +# Usage: +# docker compose -f docker-compose.rds.yml up -d +# +# Set the DB_* variables in your .env file (see .env.example). + +services: + app: + user: "5001:0" + image: etherpad/etherpad:2.6.1 + tty: true + stdin_open: true + volumes: + - plugins:/opt/etherpad-lite/src/plugin_packages + - etherpad-var:/opt/etherpad-lite/var + environment: + NODE_ENV: production + ADMIN_PASSWORD: ${ADMIN_PASSWORD:?Set ADMIN_PASSWORD in .env} + DB_HOST: ${DB_HOST:?Set DB_HOST to your RDS endpoint in .env} + DB_PORT: ${DB_PORT:-5432} + DB_NAME: ${DB_NAME:?Set DB_NAME in .env} + DB_USER: ${DB_USER:?Set DB_USER in .env} + DB_PASS: ${DB_PASS:?Set DB_PASS in .env} + DB_TYPE: postgres + DEFAULT_PAD_TEXT: ${DEFAULT_PAD_TEXT:- } # a single space; Etherpad requires a non-empty value + DISABLE_IP_LOGGING: ${DISABLE_IP_LOGGING:-false} + TITLE: ${TITLE:-Etherpad} + TRUST_PROXY: ${TRUST_PROXY:-true} + restart: always + ports: + - "${PORT:-9001}:9001" + +volumes: + plugins: + etherpad-var: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9b9f41e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +services: + app: + user: "5001:0" + image: etherpad/etherpad:2.6.1 + tty: true + stdin_open: true + volumes: + - plugins:/opt/etherpad-lite/src/plugin_packages + - etherpad-var:/opt/etherpad-lite/var + depends_on: + - postgres + environment: + NODE_ENV: production + ADMIN_PASSWORD: ${ADMIN_PASSWORD:?Set ADMIN_PASSWORD in .env} + DB_HOST: postgres + DB_NAME: ${POSTGRES_DB:-etherpad} + DB_PASS: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} + DB_PORT: 5432 + DB_TYPE: postgres + DB_USER: ${POSTGRES_USER:-etherpad} + DEFAULT_PAD_TEXT: ${DEFAULT_PAD_TEXT:- } + DISABLE_IP_LOGGING: ${DISABLE_IP_LOGGING:-false} + TITLE: ${TITLE:-Etherpad} + TRUST_PROXY: ${TRUST_PROXY:-true} + restart: always + ports: + - "${PORT:-9001}:9001" + + postgres: + image: postgres:15-alpine + environment: + POSTGRES_DB: ${POSTGRES_DB:-etherpad} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} + POSTGRES_USER: ${POSTGRES_USER:-etherpad} + PGDATA: /var/lib/postgresql/data/pgdata + restart: always + volumes: + - postgres_data:/var/lib/postgresql/data + +volumes: + postgres_data: + plugins: + etherpad-var: