diff --git a/README.md b/README.md index c4444ccd..15d1d64b 100644 --- a/README.md +++ b/README.md @@ -181,10 +181,11 @@ Every stack starts from the same [standard setup](documentation/standard-setup.m | **Memos** | Note-taking app for short Markdown notes, shown on a timeline. | [Details](services/memos) | | **Nanote** | Note-taking app that stores notes as Markdown files in folders. | [Details](services/nanote) | | **NextExplorer** | Web file manager for one folder on your server. | [Details](services/next-explorer) | -| **Open Notebook** | Alternative to NotebookLM for chatting with your sources using AI. | [Details](services/open-notebook) | +| **Open Notebook** | Alternative to NotebookLM for chatting with your sources using AI. | [Details](services/open-notebook) | | **Open WebUI** | Chat interface for AI models, through Ollama or OpenAI-compatible APIs. | [Details](services/open-webui) | -| **OpenClaw** | Personal AI assistant that connects agents to your chat apps. | [Details](services/openclaw) | -| **OpenCloud** | File sync and sharing platform with desktop and mobile clients. | [Details](services/opencloud) | +| **OpenClaw** | Personal AI assistant that connects agents to your chat apps. | [Details](services/openclaw) | +| **OpenCloud** | File sync and sharing platform with desktop and mobile clients. | [Details](services/opencloud) | +| **Outline** | Team wiki and knowledge base with real-time collaborative editing. | [Details](services/outline) | | **OxiCloud** | Self-hosted cloud for files, calendars, and contacts, with WebDAV, CalDAV, and CardDAV. | [Details](services/oxicloud) | | **Paperless-ngx** | Document management system that turns scans and files into a searchable archive. | [Details](services/paperless) | | **Pingvin Share** | Archived. File sharing platform with links that can expire. | [Details](services/pingvin-share) | @@ -196,7 +197,7 @@ Every stack starts from the same [standard setup](documentation/standard-setup.m | **Sure** | Fork of the archived Maybe finance app, for tracking accounts, investments, and net worth. | [Details](services/sure) | | **Syncthing** | Peer-to-peer tool that keeps folders in sync between your devices. | [Details](services/syncthing) | | **Vikunja** | To-do and project app with lists, boards, and Gantt charts. | [Details](services/vikunja) | -| **Wallabag** | Read-it-later app that saves web pages as articles. | [Details](services/wallabag) | +| **Wallabag** | Read-it-later app that saves web pages as articles. | [Details](services/wallabag) | | **Wallos** | Subscription tracker with payment reminders and budgets. | [Details](services/wallos) | | **XWiki** | Wiki for documentation and knowledge management. | [Details](services/xwiki) | diff --git a/services/outline/.env b/services/outline/.env new file mode 100644 index 00000000..17cbb224 --- /dev/null +++ b/services/outline/.env @@ -0,0 +1,45 @@ +#URL=https://github.com/tailscale-dev/ScaleTail +# To run a second copy, copy the folder under another name and change SERVICE. + +# Service Configuration +# Service name (e.g., adguard). Used as hostname in Tailscale and for container naming (app-${SERVICE}). +SERVICE=outline +# Docker image URL from container registry (e.g., adguard/adguardhome:latest). +IMAGE_URL=docker.getoutline.com/outlinewiki/outline:latest + +# Network Configuration +# Port to expose to local network. Uncomment the "ports:" section in compose.yaml to enable. +SERVICEPORT=3000 +# Preferred DNS server for Tailscale. Uncomment the "dns:" section in compose.yaml to enable. +DNS_SERVER=9.9.9.9 + +# Tailscale Configuration +# Auth key from https://console.tailscale.com/admin/settings/keys. See: https://tailscale.com/kb/1085/auth-keys#generate-an-auth-key for instructions. +TS_AUTHKEY= + +# Optional Service variables +# PUID=1000 + +# Time Zone setting for containers. See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +TZ=Europe/Amsterdam + +# Any Container environment variables are declared below. See https://docs.docker.com/compose/how-tos/environment-variables/ + +# Required: your Tailnet name without .ts.net (e.g., tail1234). Outline builds its address, https://..ts.net, from it. +TAILNET_NAME= +# Required: encrypts stored data and signs logins. Do not change it later, or users can no longer log in. Generate it with: openssl rand -hex 32 +SECRET_KEY= +# Required: protects the internal endpoint that runs scheduled tasks. Generate it with: openssl rand -hex 32 +UTILS_SECRET= +# Required: password of the PostgreSQL database. Use letters and digits only, because it is part of DATABASE_URL. Generate it with: openssl rand -hex 32 +POSTGRES_PASSWORD= + +# Optional: email delivery, for invites, email sign-in, and notifications. Email stays off while SMTP_HOST is empty. +SMTP_HOST= +SMTP_PORT=587 +SMTP_USERNAME= +SMTP_PASSWORD= +# Sender address of the emails, such as user@example.com. +SMTP_FROM_EMAIL= +# true: TLS from the start, usually on port 465. false: STARTTLS when the server offers it, usually on port 587. +SMTP_SECURE=false diff --git a/services/outline/README.md b/services/outline/README.md new file mode 100644 index 00000000..aba2e5b4 --- /dev/null +++ b/services/outline/README.md @@ -0,0 +1,65 @@ +# Outline + +[Outline](https://www.getoutline.com/) is a team wiki and knowledge base with real-time collaborative editing. + +Outline has no built-in Tailscale support, so this stack runs it with a Tailscale sidecar, as described in [the standard setup](../../documentation/standard-setup.md). + +## At a glance + +| Item | Value | +| ------------- | -------------------------------------------------- | +| Web interface | `https://outline..ts.net` | +| API | `https://outline..ts.net/api` | +| Service port | `3000` | +| Images | `docker.getoutline.com/outlinewiki/outline:latest` | +| | `postgres:18` | +| | `redis:8-alpine` | +| Data | `./outline-data/data` (attachments and images) | +| | `./outline-data/postgres` (PostgreSQL database) | +| | `./outline-data/redis` (Redis data) | + +## Before you start + +Set these values in `.env`. Compose stops with an error if one of them is empty. + +- **`TAILNET_NAME`.** Your Tailnet name, the part between the service name and `.ts.net`, for example `tail1234`. `compose.yaml` builds the address `https://..ts.net` from it, as `URL`. +- **`SECRET_KEY`.** Encrypts stored data and signs logins. Generate one with `openssl rand -hex 32`, which gives the 64 hexadecimal characters that Outline requires. Do not change it later, or users can no longer log in. +- **`UTILS_SECRET`.** Protects the internal endpoint that runs scheduled tasks. Generate one with `openssl rand -hex 32`. +- **`POSTGRES_PASSWORD`.** The password of the database. Generate one with `openssl rand -hex 32`. Use letters and digits only, because the value is part of the database address. PostgreSQL applies it only when it first creates the database. + +Create the attachments folder before the first start, and give it to the user that runs Outline inside the container, `nodejs` with the ID `1001`. Docker would otherwise create it as `root`, and every upload would fail: + +```sh +mkdir -p outline-data/data +sudo chown 1001:1001 outline-data/data +``` + +## Deviations from the standard setup + +- **Extra containers.** Outline needs PostgreSQL and Redis, so the stack runs `postgres` (`app-outline-db`) and `redis` (`app-outline-redis`), as in the [upstream Compose file](https://docs.getoutline.com/s/hosting/doc/docker-7pfeLP5a8t). Both use the default Compose network, not the network of the `tailscale` container, so your Tailnet cannot reach them. Outline finds them by their Compose service names, so keep `TS_ACCEPT_DNS` disabled. +- **Settings.** `compose.yaml` passes the settings of Outline to the application. The upstream Compose file reads a whole `docker.env` file instead. +- **Public address.** `URL` is built from `SERVICE` and `TAILNET_NAME`, so keep both in line with the name of the Tailnet device. Outline uses it for links, such as those in emails, and for the live connection of the editor. +- **No LAN access.** Outline redirects plain HTTP requests to HTTPS and builds its links from `URL`, so the optional `ports` block does not give a working LAN address. Use the Tailnet address. +- **Database without TLS.** Outline connects to PostgreSQL over TLS by default. `PGSSLMODE=disable` turns that off, because the database runs in this stack and has no certificate. +- **Local file storage.** `FILE_STORAGE=local` keeps attachments in `./outline-data/data`. Outline uses S3 by default. +- **Redis data.** The stack keeps the Redis data in `./outline-data/redis`. The upstream Compose file keeps none. +- **No usage statistics.** By default, Outline sends a daily report to `updates.getoutline.com` with its version and the number of users, workspaces, collections, and documents. `ENABLE_UPDATES=false` turns that off. Outline then also stops showing the notices about important updates that this service returns. + +## First run + +1. Open the web interface right after the first start. Outline shows the **Create workspace** form. Anyone on your Tailnet who opens Outline before you can create the workspace and become its admin. +2. Enter the workspace name, your name, and your email address, and select **Continue**. Outline creates the workspace, makes you its admin, and signs you in. +3. Add a passkey straight away, under **Settings** > **Passkeys** > **Add passkey**. Outline has no passwords. Without a passkey, [email](#configuration), or single sign-on, you cannot sign in again after you sign out or on another device. + +## Configuration + +- **Email.** Outline sends invites and notifications by email, and offers sign-in with a link sent by email. Set `SMTP_HOST`, `SMTP_PORT`, `SMTP_USERNAME`, `SMTP_PASSWORD`, and `SMTP_FROM_EMAIL` in `.env`, and run `docker compose up -d`. `SMTP_SECURE=false` uses STARTTLS when the server offers it, usually on port `587`. `SMTP_SECURE=true` uses TLS from the start, usually on port `465`. Users that you invite need email or single sign-on for their first sign-in, because they can add a passkey only once they are signed in. +- **Single sign-on.** Outline can also sign users in through Google, Microsoft Entra ID, Slack, Discord, or an OpenID Connect provider. Add the variables of the provider, listed in the [authentication documentation](https://docs.getoutline.com/s/hosting/doc/authentication-7ViKRmRY5o), to the `environment` of the `application` service in a `compose.override.yaml`, as in [Keep your changes in an override file](../../README.md#keep-your-changes-in-an-override-file). +- **Changing the address.** A passkey works only for the address where you added it. Before you change `SERVICE` or `TAILNET_NAME`, set up email or single sign-on. Then add a new passkey at the new address. + +## Links + +- [Outline self-hosting documentation](https://docs.getoutline.com/s/hosting) +- [Outline Docker installation](https://docs.getoutline.com/s/hosting/doc/docker-7pfeLP5a8t) +- [Outline settings (`.env.sample`)](https://github.com/outline/outline/blob/main/.env.sample) +- [Outline source code](https://github.com/outline/outline) diff --git a/services/outline/compose.yaml b/services/outline/compose.yaml new file mode 100644 index 00000000..95c466ef --- /dev/null +++ b/services/outline/compose.yaml @@ -0,0 +1,122 @@ +configs: + ts-serve: + content: | + {"TCP":{"443":{"HTTPS":true}}, + "Web":{"$${TS_CERT_DOMAIN}:443": + {"Handlers":{"/": + {"Proxy":"http://127.0.0.1:3000"}}}}, + "AllowFunnel":{"$${TS_CERT_DOMAIN}:443":false}} + +services: +# Make sure you have updated/checked the .env file with the correct variables. +# Every variable used in this file must be defined there, unless it has a default such as ${VAR:-value}. + # Tailscale Sidecar Configuration + tailscale: + image: tailscale/tailscale:latest # Image to be used + container_name: tailscale-${SERVICE} # Name for local container management + hostname: ${SERVICE} # Name used within your Tailscale environment + environment: + - TS_AUTHKEY=${TS_AUTHKEY} + - TS_STATE_DIR=/var/lib/tailscale + - TS_SERVE_CONFIG=/config/serve.json # Tailscale Serve configuration to expose the web interface on your local Tailnet - remove this line if not required + - TS_USERSPACE=false + - TS_ENABLE_HEALTH_CHECK=true # Enable healthcheck endpoint: "/healthz" + - TS_LOCAL_ADDR_PORT=127.0.0.1:41234 # The : for the healthz endpoint + #- TS_ACCEPT_DNS=true # Uncomment only if the service must resolve MagicDNS names - this replaces Docker DNS, so Compose service names no longer resolve + - TS_AUTH_ONCE=true + configs: + - source: ts-serve + target: /config/serve.json + volumes: + - ./config:/config # Config folder used to store Tailscale files - you may need to change the path + - ./ts/state:/var/lib/tailscale # Tailscale requirement - you may need to change the path + devices: + - /dev/net/tun:/dev/net/tun # Network configuration for Tailscale to work + cap_add: + - net_admin # Tailscale requirement + #ports: + # - 0.0.0.0:${SERVICEPORT}:${SERVICEPORT} # Binding the service port to the local network - may be removed if only exposure to your Tailnet is required + # If any DNS issues arise, use your preferred DNS provider by uncommenting the config below + #dns: + # - ${DNS_SERVER} + healthcheck: + test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:41234/healthz"] # Check Tailscale has a Tailnet IP and is operational + interval: 1m # How often to perform the check + timeout: 10s # Time to wait for the check to succeed + retries: 3 # Number of retries before marking as unhealthy + start_period: 10s # Time to wait before starting health checks + restart: always + + + # Application + application: + image: ${IMAGE_URL} # Image to be used + network_mode: service:tailscale # Sidecar configuration to route the service through Tailscale + container_name: app-${SERVICE} # Name for local container management + environment: # Variables are declared in .env file. + # Set PUID and PGID only for images that read them, such as LinuxServer.io images. Many images ignore them. + #- PUID=1000 + #- PGID=1000 + - TZ=${TZ} + - URL=https://${SERVICE}.${TAILNET_NAME:?Set TAILNET_NAME in .env}.ts.net # Address of the web interface, used for links and the live connection of the editor + - SECRET_KEY=${SECRET_KEY:?Set SECRET_KEY in .env} + - UTILS_SECRET=${UTILS_SECRET:?Set UTILS_SECRET in .env} + - DATABASE_URL=postgres://outline:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}@postgres:5432/outline # Reaches the database by its Compose service name + - PGSSLMODE=disable # The database in this stack has no TLS, and Outline requires TLS by default + - REDIS_URL=redis://redis:6379 + - FILE_STORAGE=local # Keep attachments in the data folder. The default is S3. + - FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data + - ENABLE_UPDATES=false # Do not send the daily usage statistics to the Outline maintainers. The default is true. + # Optional email delivery, for invites, email sign-in, and notifications. Email stays off while SMTP_HOST is empty. + - SMTP_HOST=${SMTP_HOST} + - SMTP_PORT=${SMTP_PORT} + - SMTP_USERNAME=${SMTP_USERNAME} + - SMTP_PASSWORD=${SMTP_PASSWORD} + - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL} + - SMTP_SECURE=${SMTP_SECURE} + volumes: + - ./${SERVICE}-data/data:/var/lib/outline/data # Attachments and images - owned by uid 1001 + depends_on: + tailscale: + condition: service_healthy + restart: true # Restart this service when Compose restarts the sidecar, whose network it uses + postgres: + condition: service_healthy + redis: + condition: service_healthy + # Healthcheck: defined by the image (wget http://localhost:3000/_health, which also checks the database and Redis), so this file does not override it. + restart: always + + # Database + postgres: + image: postgres:18 # Image to be used + container_name: app-${SERVICE}-db # Name for local container management + environment: + - POSTGRES_USER=outline + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} + - POSTGRES_DB=outline + volumes: + - ./${SERVICE}-data/postgres:/var/lib/postgresql # PostgreSQL 18 keeps its data in a versioned folder below this path + # Healthcheck: the image defines none. Check over TCP, because the first-start server accepts only socket connections. + healthcheck: + test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "outline", "-d", "outline"] # Check if PostgreSQL accepts connections + interval: 10s # How often to perform the check + timeout: 5s # Time to wait for the check to succeed + retries: 5 # Number of retries before marking as unhealthy + start_period: 30s # Time to wait before starting health checks + restart: always + + # Cache and job queue + redis: + image: redis:8-alpine # Image to be used + container_name: app-${SERVICE}-redis # Name for local container management + volumes: + - ./${SERVICE}-data/redis:/data # Snapshots of the job queue, such as emails that still have to be sent + # Healthcheck: the image defines none. + healthcheck: + test: ["CMD", "redis-cli", "ping"] # Check if Redis answers + interval: 10s # How often to perform the check + timeout: 5s # Time to wait for the check to succeed + retries: 5 # Number of retries before marking as unhealthy + start_period: 10s # Time to wait before starting health checks + restart: always