Add NetBird update scripts and README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
95b4643187
3 files changed
+69
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Update the self-hosted NetBird server stack (Docker Compose).
|
||||
# Backs up config files and the netbird_data volume before upgrading.
|
||||
set -euo pipefail
|
||||
|
||||
STACK_DIR=/var/limonia/netbird
|
||||
DATA_VOLUME=netbird_netbird_data
|
||||
BACKUP_DIR="$HOME/netbird-backups/$(date +%F_%H%M%S)"
|
||||
|
||||
cd "$STACK_DIR"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
echo "Current images:"
|
||||
docker compose images
|
||||
|
||||
# Pull first so downtime is only the backup + restart
|
||||
docker compose pull
|
||||
|
||||
echo "Backing up config to $BACKUP_DIR"
|
||||
tar czf "$BACKUP_DIR/config.tgz" -C "$STACK_DIR" .
|
||||
|
||||
# Stop the server so the data store is copied consistently
|
||||
docker compose stop netbird-server
|
||||
echo "Backing up volume $DATA_VOLUME"
|
||||
docker run --rm -v "$DATA_VOLUME":/data:ro -v "$BACKUP_DIR":/backup alpine \
|
||||
tar czf /backup/netbird_data.tgz -C /data .
|
||||
|
||||
docker compose up -d
|
||||
sleep 5
|
||||
|
||||
echo "Updated images:"
|
||||
docker compose images
|
||||
docker compose ps
|
||||
docker compose logs --tail 30 netbird-server
|
||||
|
||||
echo "Backup saved in $BACKUP_DIR"
|
||||
Reference in new issue
Block a user