Add infrastructure: Terraform, Docker Compose, BRouter, CD pipeline (#2)
Terraform: - Hetzner CX22 server with Docker, firewall (80/443/22) - SSH key and output for server IP Docker Compose: - Caddy reverse proxy (auto HTTPS) - Journal and Planner app containers - BRouter routing engine container - PostgreSQL + PostGIS - Garage S3 storage BRouter: - Dockerfile based on eclipse-temurin:11-jre - Segment download script for Germany (4 tiles, ~750MB) CD Pipeline: - Build & push Docker images to ghcr.io on main push - Deploy step commented out (enable when server provisioned) Scripts: - PostgreSQL daily backup with 14-day retention - Dockerfiles for both apps (multi-stage builds) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
464ba0f64d
commit
7908a518b1
13 changed files with 429 additions and 7 deletions
27
docker/brouter/Dockerfile
Normal file
27
docker/brouter/Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
FROM eclipse-temurin:11-jre-jammy
|
||||
|
||||
WORKDIR /brouter
|
||||
|
||||
# Download latest BRouter release
|
||||
ARG BROUTER_VERSION=1.7.7
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends wget unzip \
|
||||
&& wget -q "https://github.com/abrensch/brouter/releases/download/${BROUTER_VERSION}/brouter-${BROUTER_VERSION}.zip" \
|
||||
&& unzip "brouter-${BROUTER_VERSION}.zip" \
|
||||
&& rm "brouter-${BROUTER_VERSION}.zip" \
|
||||
&& apt-get purge -y wget unzip && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create directories for segments and profiles
|
||||
RUN mkdir -p /data/segments /data/profiles
|
||||
|
||||
# Copy default profiles from release
|
||||
RUN cp -r profiles2/* /data/profiles/ 2>/dev/null || true
|
||||
|
||||
EXPOSE 17777
|
||||
|
||||
# BRouter server: <segmentdir> <profiledir> <customprofiledir> <port> <maxthreads>
|
||||
CMD ["java", "-Xmx512M", "-Xms128M", "-Xmn32M", \
|
||||
"-DmaxRunningTime=300", \
|
||||
"-cp", "brouter.jar", \
|
||||
"btools.server.RouteServer", \
|
||||
"/data/segments", "/data/profiles", "/data/profiles", \
|
||||
"17777", "4"]
|
||||
38
docker/brouter/download-segments.sh
Executable file
38
docker/brouter/download-segments.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Download Germany RD5 segments from brouter.de
|
||||
# These 4 tiles cover all of Germany:
|
||||
# E5_N45 = Southwest (Frankfurt, Stuttgart, Black Forest)
|
||||
# E5_N50 = Northwest (Hamburg, Bremen, Ruhr)
|
||||
# E10_N45 = Southeast (Munich, Nuremberg, Bavaria)
|
||||
# E10_N50 = Northeast (Berlin, Leipzig, Dresden)
|
||||
|
||||
SEGMENTS_DIR="${1:-/data/segments}"
|
||||
BASE_URL="https://brouter.de/brouter/segments4"
|
||||
|
||||
TILES=(
|
||||
"E5_N45"
|
||||
"E5_N50"
|
||||
"E10_N45"
|
||||
"E10_N50"
|
||||
)
|
||||
|
||||
mkdir -p "$SEGMENTS_DIR"
|
||||
|
||||
for tile in "${TILES[@]}"; do
|
||||
file="${SEGMENTS_DIR}/${tile}.rd5"
|
||||
url="${BASE_URL}/${tile}.rd5"
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
echo "Updating ${tile}.rd5 (checking for newer version)..."
|
||||
wget -N -q -P "$SEGMENTS_DIR" "$url" || echo " No update available or download failed"
|
||||
else
|
||||
echo "Downloading ${tile}.rd5..."
|
||||
wget -q -P "$SEGMENTS_DIR" "$url"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Segments downloaded to ${SEGMENTS_DIR}:"
|
||||
ls -lh "${SEGMENTS_DIR}"/*.rd5 2>/dev/null || echo " No segments found"
|
||||
Loading…
Add table
Add a link
Reference in a new issue