Files
homelab-ansible-lxc-dawarich/logs.sh
T
Your Name e7b8d4df17 initial commit: Dawarich LXC role (CT 459 on pve02, .159)
Self-hosted location history. 4-container compose: Rails 8 app + Sidekiq
+ PostGIS 16-3.4 + Redis 7, plus watchtower. Authentik OIDC end-to-end.
Image pinned at freikin/dawarich:1.7.11 (OIDC support requires >= 1.7.8).

PostGIS DB lives in this LXC, not on the central DB VM (.172) — central
image is postgres:16-alpine without postgis, swapping it carries broader
blast radius than colocating here. Convention exception captured in
homelab-docs project_dawarich memory.

Roles:
  - dawarich: system + Docker + compose + weekly prune timer
  - alloy:    logs+journald → Loki, node metrics → Prometheus

Bring-up sequence proven 2026-06-01. README documents the 5-trap build
chain (image version, entrypoint scripts, solid_cache SQLite bind mount,
APPLICATION_HOSTS+localhost, force_ssl+healthcheck).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 21:24:09 -04:00

32 lines
949 B
Bash
Executable File

#!/usr/bin/env bash
# logs.sh — View container logs from the Dawarich LXC
#
# Usage:
# ./logs.sh # last 50 lines from dawarich_app
# ./logs.sh -f # tail/follow dawarich_app
# ./logs.sh dawarich_sidekiq # sidekiq logs
# ./logs.sh dawarich_db -f # follow db logs
HOST_IP="$(grep -E '^[0-9]' inventory.ini | head -1 | awk '{print $1}')"
HOST_USER="cbalders"
CONTAINER="dawarich_app"
FOLLOW=false
LINES=50
for arg in "$@"; do
case "$arg" in
-f|--follow) FOLLOW=true ;;
[0-9]*) LINES="$arg" ;;
*) CONTAINER="$arg" ;;
esac
done
if [ "$FOLLOW" = true ]; then
echo "==> Tailing $CONTAINER on dawarich ($HOST_IP) — Ctrl+C to stop"
ssh "${HOST_USER}@${HOST_IP}" "sudo docker logs $CONTAINER --tail $LINES -f"
else
echo "==> Last $LINES lines of $CONTAINER on dawarich ($HOST_IP)"
ssh "${HOST_USER}@${HOST_IP}" "sudo docker logs $CONTAINER --tail $LINES 2>&1"
fi