Cloudflare Tunnel
Cloudflare Tunnel creates a secure, outbound-only connection from your server to Cloudflare’s network. This eliminates the need for:
- Opening inbound firewall ports
- Managing SSL/TLS certificates
- Setting up a reverse proxy (Nginx/Traefik)
- Exposing your server’s IP address publicly
Architecture
Section titled “Architecture”User ↓ HTTPSCloudflare Edge ↓ Cloudflare Tunnel (encrypted)Your Server (localhost:9090 / :9091)No public IP exposure, no open firewall ports needed.
Prerequisites
Section titled “Prerequisites”- A Cloudflare account (free tier works 😉)
- Your domain added to Cloudflare
- Two subdomains (e.g.,
auth.example.comandadmin.example.com) - Docker and docker-compose installed on the server
1. Start Goiabada containers
Section titled “1. Start Goiabada containers”Use the setup wizard to generate your docker-compose.yml:
- Select “2. Production with reverse proxy” when prompted
- Enter your domain names (e.g.,
https://auth.example.comandhttps://admin.example.com) - The wizard automatically sets
TRUST_PROXY_HEADERS=trueandSET_COOKIE_SECURE=true
Then start the containers:
docker compose up -dVerify containers are running:
# Check containers are runningdocker ps | grep goiabada
# Test auth server health (should return: healthy)curl http://localhost:9090/health && echo
# Test admin console health (should return: healthy)curl http://localhost:9091/health && echo2. Create a Cloudflare Tunnel
Section titled “2. Create a Cloudflare Tunnel”-
Log in to the Cloudflare Zero Trust dashboard
-
Go to Networks → Connectors
-
Click Create a tunnel
-
Select Cloudflared as the connector type
-
Enter a tunnel name (e.g.,
goiabada-tunnel) -
Click Save tunnel
3. Install cloudflared
Section titled “3. Install cloudflared”The Cloudflare dashboard shows installation commands for your operating system. Follow those commands.
Verify it’s running:
sudo systemctl status cloudflaredReturn to the Cloudflare dashboard and you should see your connector listed as HEALTHY.
4. Configure public hostnames
Section titled “4. Configure public hostnames”In the Cloudflare Zero Trust dashboard, on your tunnel’s configuration page:
-
Click the Published application routes tab
-
Add a route for the auth server:
- Subdomain:
auth - Domain: Select your domain
- Type:
HTTP - URL:
localhost:9090
- Subdomain:
-
Add a route for the admin console:
- Subdomain:
admin - Domain: Select your domain
- Type:
HTTP - URL:
localhost:9091
- Subdomain:
5. Configure SSL/TLS
Section titled “5. Configure SSL/TLS”In your domain’s Cloudflare dashboard:
-
Go to SSL/TLS → Overview
- Set encryption mode to Full (not “Full strict”)
-
Go to SSL/TLS → Edge Certificates
- Enable “Always Use HTTPS”
6. Verify DNS records
Section titled “6. Verify DNS records”Cloudflare automatically creates DNS records for your tunnel hostnames:
- Go to DNS → Records
- Verify CNAME records for
authandadminpointing to your tunnel - Records should be Proxied (orange cloud)
Access your deployment
Section titled “Access your deployment”- Auth server:
https://auth.example.com - Admin console:
https://admin.example.com
No port numbers needed. No firewall ports to open.