container-schulung/listings/exercises/ex18-quadlets/commands.txt
Frank Engel 9e3225db6e ex18: nginx-default.conf für Quadlets (systemd-visitcounter-app als Upstream)
Compose und Quadlets brauchen unterschiedliche nginx-Configs:
- Compose: proxy_pass http://app:8080
- Quadlets: proxy_pass http://systemd-visitcounter-app:8080

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 11:09:58 +02:00

35 lines
1.2 KiB
Text

# Exercise 18 — Deploy VisitCounter via Quadlets
# nginx config an Ort und Stelle bringen (Quadlet-Version mit systemd-visitcounter-app als Hostname)
mkdir -p ~/visitcounter/nginx
cp listings/visitcounter/quadlets/nginx-default.conf ~/visitcounter/nginx/default.conf
# Create the Quadlet directory
mkdir -p ~/.config/containers/systemd/
# Copy all Quadlet unit files
cp listings/visitcounter/quadlets/* ~/.config/containers/systemd/
# Reload systemd to pick up the new units
systemctl --user daemon-reload
# Check that units were generated
systemctl --user list-unit-files | grep visitcounter
# → visitcounter-app.service generated
# → visitcounter-db.service generated
# → visitcounter-proxy.service generated
# Start only the proxy — systemd resolves After= dependencies automatically
systemctl --user start visitcounter-proxy.service
# Verify all three services are running
systemctl --user status visitcounter-db.service
systemctl --user status visitcounter-app.service
systemctl --user status visitcounter-proxy.service
# Test
curl localhost:8080
# Bonus: kill the app container and watch systemd restart it
podman stop systemd-visitcounter-app
systemctl --user status visitcounter-app.service