This guide walks through exposing a PostgreSQL server running on your local network securely over the internet using Cloudflare Tunnel and optionally a reverse proxy. The PostgreSQL server can live on a Raspberry Pi or any other machine in your home lab.
1. Prerequisites
- PostgreSQL server (e.g. on Raspberry Pi or Ubuntu machine)
- Static IP or DHCP reservation for the host
-
Cloudflare account with a domain (e.g.
lolzlab.com) -
cloudflaredinstalled and configured on the local network - PostgreSQL server already configured and listening on a LAN IP
2. Configure PostgreSQL to Accept Cloudflared Traffic Only
On the machine ...