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
@@ -0,0 +1,17 @@
|
||||
# oneliners
|
||||
|
||||
Small bash scripts meant to be run directly from the web.
|
||||
|
||||
Read a script before you pipe it to bash.
|
||||
|
||||
## NetBird client update
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.fosil.eu/oier/oneliners/raw/branch/main/update-netbird-client.sh | bash
|
||||
```
|
||||
|
||||
## NetBird server update
|
||||
|
||||
```bash
|
||||
curl -fsSL https://git.fosil.eu/oier/oneliners/raw/branch/main/update-netbird-server.sh | bash
|
||||
```
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Update the NetBird client (apt package) on this host.
|
||||
# Warning: restarting the client drops sessions that go over NetBird.
|
||||
set -euo pipefail
|
||||
|
||||
echo "Current: $(netbird version)"
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --only-upgrade netbird
|
||||
|
||||
sudo systemctl restart netbird
|
||||
sleep 3
|
||||
|
||||
echo "Now: $(netbird version)"
|
||||
systemctl is-active netbird
|
||||
netbird status
|
||||
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