Borgbot
Michael here documenting the install of a "borgbot" to do two things
- receive backups of sandboxes
- service static snapshots of retired sandboxes
Here are the steps:
- Installed a Pi with "fresh" raspian lite
- did apt-get update / upgrade
- raspi-config to enable ssh
- Install Tinc + adding a new node
- it's convenient to ssh to the pi from a laptop that can also ssh to xpub to copy and paste the invite code
- install borgbackup
fish
apt-install fish which fish chsh
and enter /usr/bin/fish
mount/fstab
Despite the (too) many ads, this page gives a pretty good discussion of mounting a drive. Also how-to-write-an-fstab-file-on-linux is maybe even better.
sudo mkdir /mnt/usb sudo mount /dev/sda1 /mnt/usb
cat /etc/mtab
sudo lsblk sudo nano /etc/fstab
PARTUUID=39da60b5-15ff-4906... /mnt/usb ext4 rw,relatime 0 0
nginx
Install nginx
sudo apt-get install nginx
Configure to serve sandboxes.
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; # root /mnt/usb/sandboxes; # Add index.php to the list if you are using PHP # index index.html index.htm index.nginx-debian.html; index index.html; server_name _; location /sandbot/ { # rewrite_log on; autoindex on; # rewrite ^/sandbot/(.*?)/$ /$1/index.html break; rewrite ^/sandbot/(.*)$ /$1 break; root /mnt/usb/sandboxes/sandbot/var/www/html; try_files $uri ${uri}index.html $uri/index.html $uri/ =404; index index.html; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. } location ~ ^/sandbot/~(.+?)(/.*)?$ { alias /mnt/usb/sandboxes/sandbot/home/$1/public_html$2; index index.html index.htm; autoindex on; } }
nginx on hub/xvm
actually just some subtle changes...
location /sandbot/ { proxy_pass http://10.0.0.18; # from http://10.0.0.12/ => borgbot client_max_body_size 200M; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; # proxy_http_version 1.1; # proxy_redirect off; # proxy_buffering off; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection "upgrade"; # proxy_read_timeout 86400; }