docker compose
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
PUBLIC_HOST=menus.example.org
|
||||
BASE_URL=https://menus.example.org
|
||||
@@ -12,3 +12,4 @@ __pycache__
|
||||
.devcontainer
|
||||
.vscode
|
||||
.codex
|
||||
.env.local
|
||||
|
||||
@@ -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:
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user