Initial Discord bot in Docker behind a per-container Cloudflare WARP tunnel

- discord.js 14 bot with /ping and /warp, periodic WARP egress-IP logging
- Dockerfile: node:22-bookworm-slim + cloudflare-warp 2026.7.1377.0 (.deb)
- entrypoint boots dbus/warp-svc, registers, connects, verifies warp=on
- docker-compose with NET_ADMIN, /dev/net/tun, sysctls, healthcheck
- deploy script, README, CHANGELOG, lockfile generated inside Docker

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 01:16:32 +02:00
parent bcf7b67ef7
commit 1a9dc1d676
14 changed files with 904 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Deploys the committed tree (git archive HEAD) to the Docker host and
# rebuilds/restarts the stack there. Run from the repo root:
# scripts/deploy.sh [user@host] [remote-dir]
set -euo pipefail
HOST="${1:-root@192.168.5.67}"
REMOTE_DIR="${2:-/opt/discordbot-cloudflarewarp}"
cd "$(dirname "$0")/.."
echo ">> shipping $(git rev-parse --short HEAD) to $HOST:$REMOTE_DIR"
ssh "$HOST" "mkdir -p '$REMOTE_DIR'"
git archive --format=tar HEAD | ssh "$HOST" "tar -x -C '$REMOTE_DIR'"
ssh "$HOST" bash -s <<REMOTE
set -euo pipefail
cd '$REMOTE_DIR'
if [ ! -f .env ]; then
echo "!! $REMOTE_DIR/.env is missing on the host. Create it from .env.example first." >&2
exit 1
fi
docker compose build --pull
docker compose up -d --remove-orphans
docker compose ps
REMOTE
echo ">> done. follow logs with: ssh $HOST 'cd $REMOTE_DIR && docker compose logs -f'"