From 5e5cea9dd6175475cebb4070d3796e04e90162c3 Mon Sep 17 00:00:00 2001 From: Jeff Clement Date: Fri, 15 Nov 2024 12:40:07 -0700 Subject: [PATCH] hedgedoc++ --- hedgedoc_cloudflare/.env | 12 +++++++++ hedgedoc_cloudflare/README.md | 14 ++++++++++ hedgedoc_cloudflare/docker_compose.yml | 36 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 hedgedoc_cloudflare/.env create mode 100644 hedgedoc_cloudflare/README.md create mode 100644 hedgedoc_cloudflare/docker_compose.yml diff --git a/hedgedoc_cloudflare/.env b/hedgedoc_cloudflare/.env new file mode 100644 index 0000000..5b4453b --- /dev/null +++ b/hedgedoc_cloudflare/.env @@ -0,0 +1,12 @@ +# CloudFlare Tunnel Token +TUNNEL_TOKEN= + +# Domain this is being hosted on +DOMAIN=docs.mydomain.com + +# Unique database password +DB_PASSWORD= ##REQUIRED## + +# Session secret. Pick a big random string. If this changes +# user sessions will be terminated. +SECRET= ##REQUIRED## \ No newline at end of file diff --git a/hedgedoc_cloudflare/README.md b/hedgedoc_cloudflare/README.md new file mode 100644 index 0000000..40e36b6 --- /dev/null +++ b/hedgedoc_cloudflare/README.md @@ -0,0 +1,14 @@ +# HedgeDoc and Cloudflare + +I use HedgeDoc all the time for proofing up blog posts, collaborative documentation, etc. + +Very little setup required. + +Requires: +* Cloudflare Tunnel + +Steps: + +1. Setup your Tunnel (pointing to `http://app:3000`) +2. Set Cloudflare Tunnel token and other secrets in in `.env` +4. `docker compose up -d` \ No newline at end of file diff --git a/hedgedoc_cloudflare/docker_compose.yml b/hedgedoc_cloudflare/docker_compose.yml new file mode 100644 index 0000000..931a42c --- /dev/null +++ b/hedgedoc_cloudflare/docker_compose.yml @@ -0,0 +1,36 @@ +services: + tunnel: + image: cloudflare/cloudflared + command: tunnel --no-autoupdate run + restart: unless-stopped + environment: + - TUNNEL_TOKEN=${TUNNEL_TOKEN} + + database: + image: postgres:13.4-alpine + environment: + - POSTGRES_USER=hedgedoc + - POSTGRES_PASSWORD=${DB_PASSWORD} + - POSTGRES_DB=hedgedoc + volumes: + - ./data/database:/var/lib/postgresql/data + restart: always + + app: + image: quay.io/hedgedoc/hedgedoc:latest + environment: + - CMD_DB_URL=postgres://hedgedoc:${DB_PASSWORD}@database:5432/hedgedoc + - CMD_DOMAIN=${DOMAIN} + - CMD_URL_ADDPORT=false + - TZ=America/Edmonton + - CMD_SESSION_SECRET=${SECRET} + # hint so that it knows it's being Cloudflare + - CMD_PROTOCOL_USESSL=true + volumes: + - ./data/uploads:/hedgedoc/public/uploads + restart: always + depends_on: + - database +volumes: + database: + uploads: \ No newline at end of file