After setting up my home server, and being assigned a static public IP address by SSE it makes sense to move all the projects I can here (and the bill was getting to be $20+ per month). This isn’t foolproof.
Docker
So what is this actually running?
- Traefik
- Watchtower
- Portainer
- Jekyll
- Django
- PostgreSQL10
- MariaDB
- Dovecot
- Postfix
- phpPgAdmin
This server is primarly for ma.ax and my email server, along with a couple of databases for smaller projects.
Set up the VM
Set up for the VM was pretty normal:
- Provision 2GB RAM, 2 vCPU, 120GB HDD on Proxmox
- Set up Ubuntu 18.04.02LTS server
- Update Ubuntu and install Docker
- Set a static IP on LAN with netplan
Set up NAT rules for the new server
Next step was to set up NAT on my PfSense router.
- First enable NAT under System -> Advanced -> Network Address Translation
- NAT Reflection mode for port forwards [NAT + Proxy]
- Enable NAT Reflection for 1:1 Nat [True]
- TFTP Proxy [WAN]
- Second Set up NAT rules under Firewall-> NAT -> ADD
- Add a rule for every port I needed open for ma.ax [22, 80, 443,…]
Save and export the Docker images
Now, I’m not sure that this is the best way, but it worked flawlessly for me. First export the containers.
docker save $(docker images | sed '1d' | awk '{print $1 ":" $2 }') -o allinone.tar
Copy them to the new host with scp:
scp allinone.tar user@176.35.31.230:~/
Load the containers on the new host as root
docker load -i allinone.tar
Copy the mounted volumes over, and adjust your docker-compose file:
scp -r /opt/maax_docker/ user@176.35.31.230:/opt/
Call docker-compose to bring up the containers:
docker-commose up -d
Finally, update your DNS settings to point to the new IP, for me this was on cloudflare.