docker compose

This commit is contained in:
Hadrian Burkhardt
2026-05-01 01:47:55 +00:00
parent b31796da39
commit f5d89cee2f
5 changed files with 102 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
PUBLIC_HOST=menus.example.org
BASE_URL=https://menus.example.org
+1
View File
@@ -12,3 +12,4 @@ __pycache__
.devcontainer .devcontainer
.vscode .vscode
.codex .codex
.env.local
+3
View File
@@ -0,0 +1,3 @@
{$PUBLIC_HOST} {
reverse_proxy app:3080
}
+29
View File
@@ -0,0 +1,29 @@
services:
app:
build: .
restart: unless-stopped
environment:
BASE_URL: ${BASE_URL}
LISTEN_PORT: 3080
expose:
- "3080"
caddy:
image: caddy:2-alpine
restart: unless-stopped
depends_on:
- app
ports:
- "80:80"
- "443:443"
- "443:443/udp"
environment:
PUBLIC_HOST: ${PUBLIC_HOST}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
+67
View File
@@ -0,0 +1,67 @@
FritzBox Self-Hosting
=====================
This setup runs the parser behind Caddy. Caddy receives public HTTP/HTTPS
traffic, obtains TLS certificates, and proxies requests to the app container.
Requirements
------------
* A machine on your home network with Docker and Docker Compose.
* A DNS name that points to your home connection.
* FritzBox port sharing from the internet to the Docker host:
* TCP 80 -> Docker host TCP 80
* TCP 443 -> Docker host TCP 443
* UDP 443 -> Docker host UDP 443
If your internet provider uses CGNAT and you do not have a reachable public IP,
plain FritzBox port forwarding will not work. Use IPv6 with an AAAA record, a
provider option for public IPv4, or a tunnel/VPN.
Configure
---------
Create a local environment file:
.. code-block:: shell
cp .env.local.example .env.local
Edit ``.env.local``:
.. code-block:: dotenv
PUBLIC_HOST=menus.example.org
BASE_URL=https://menus.example.org
``PUBLIC_HOST`` is the domain Caddy serves. ``BASE_URL`` is used by the Flask
app when it generates absolute OpenMensa feed URLs.
Run
---
Start or update the local deployment:
.. code-block:: shell
docker compose --env-file .env.local -f compose.local.yml up -d --build
Check logs:
.. code-block:: shell
docker compose --env-file .env.local -f compose.local.yml logs -f
Check health locally:
.. code-block:: shell
curl http://127.0.0.1/health_check
Stop
----
.. code-block:: shell
docker compose --env-file .env.local -f compose.local.yml down