From 180ab897ecd2139b47ab1690abf9da6c0ee28662 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Fri, 24 Mar 2023 17:46:33 +0100 Subject: [PATCH] docs: add docker compose deployment Signed-off-by: David Mehren --- docker/.env | 19 +++++++++++++++++++ docker/.env.license | 3 +++ docker/Caddyfile | 20 ++++++++++++++++++++ docker/docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 docker/.env create mode 100644 docker/.env.license create mode 100644 docker/Caddyfile create mode 100644 docker/docker-compose.yml diff --git a/docker/.env b/docker/.env new file mode 100644 index 000000000..6d037950e --- /dev/null +++ b/docker/.env @@ -0,0 +1,19 @@ +# Base settings +HD_BASE_URL="https://hedgedoc2.localhost" +HD_SESSION_SECRET="session_secret" + +# Database settings +HD_DATABASE_TYPE="postgres" +HD_DATABASE_HOST="db" +HD_DATABASE_PORT="5432" +HD_DATABASE_NAME="hedgedoc" +HD_DATABASE_USER="hedgedoc" +HD_DATABASE_PASS="password" + +# Uploads +HD_MEDIA_BACKEND="filesystem" +HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH="uploads/" + +# Auth +HD_AUTH_LOCAL_ENABLE_LOGIN="true" +HD_AUTH_LOCAL_ENABLE_REGISTER="true" diff --git a/docker/.env.license b/docker/.env.license new file mode 100644 index 000000000..10d46e320 --- /dev/null +++ b/docker/.env.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + +SPDX-License-Identifier: CC0-1.0 diff --git a/docker/Caddyfile b/docker/Caddyfile new file mode 100644 index 000000000..bfc47b4ba --- /dev/null +++ b/docker/Caddyfile @@ -0,0 +1,20 @@ +# +# SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) +# +# SPDX-License-Identifier: AGPL-3.0-only +# + +{$HD_BASE_URL} + +log { + output stdout + level WARN + format console +} + +reverse_proxy /realtime http://backend:3000 +reverse_proxy /api/* http://backend:3000 +reverse_proxy /public/* http://backend:3000 +reverse_proxy /uploads/* http://backend:3000 +reverse_proxy /apidoc/* http://backend:3000 +reverse_proxy /* http://frontend:3001 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..dc162c2b9 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) +# SPDX-License-Identifier: AGPL-3.0-only +--- +services: + backend: + image: ghcr.io/hedgedoc/hedgedoc/backend:develop + volumes: + - $PWD/.env:/usr/src/app/backend/.env + - hedgedoc_uploads:/usr/src/app/backend/uploads + + frontend: + image: ghcr.io/hedgedoc/hedgedoc/frontend:develop + environment: + HD_BASE_URL: "${HD_BASE_URL}" + + db: + image: postgres:15 + environment: + POSTGRES_USER: "${HD_DATABASE_USER}" + POSTGRES_PASSWORD: "${HD_DATABASE_PASS}" + POSTGRES_DB: "${HD_DATABASE_NAME}" + + proxy: + image: caddy:latest + restart: unless-stopped + environment: + HD_BASE_URL: "${HD_BASE_URL}" + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - $PWD/Caddyfile:/etc/caddy/Caddyfile + - caddy_data:/data + +volumes: + hedgedoc_uploads: + caddy_data: