Skip to main content

Fly.io Integration Tests

Test results for edgeProxy v0.4.0 integration with Fly.io multi-region backends via WireGuard VPN.

Test Environment​

EC2 Hub (Ireland)​

PropertyValue
Public IP34.246.117.138 (Elastic IP)
WireGuard IP10.50.0.1/24
Regioneu-west-1
edgeProxy Versionv0.4.0

Fly.io Backend Machines​

RegionLocationWireGuard IPStatus
GRUSão Paulo10.50.1.1Running
IADVirginia10.50.2.1Running
ORDChicago10.50.2.2Running
LAXLos Angeles10.50.2.3Running
LHRLondon10.50.3.1Running
FRAFrankfurt10.50.3.2Running
CDGParis10.50.3.3Running
NRTTokyo10.50.4.1Running
SINSingapore10.50.4.2Running
SYDSydney10.50.4.3Running

Test Results​

1. WireGuard Connectivity​

Test: Ping from EC2 Hub to all Fly.io backends via WireGuard tunnel.

# From EC2 Hub (34.246.117.138)
for ip in 10.50.1.1 10.50.2.1 10.50.2.2 10.50.2.3 10.50.3.1 10.50.3.2 10.50.3.3 10.50.4.1 10.50.4.2 10.50.4.3; do
ping -c 1 -W 2 $ip > /dev/null && echo "[OK] $ip" || echo "[FAIL] $ip"
done

Results:

BackendIPPingHandshake
GRU10.50.1.1OKActive
IAD10.50.2.1OKActive
ORD10.50.2.2OKActive
LAX10.50.2.3OKActive
LHR10.50.3.1OKActive
FRA10.50.3.2OKActive
CDG10.50.3.3OKActive
NRT10.50.4.1OKActive
SIN10.50.4.2OKActive
SYD10.50.4.3OKActive

Status: 10/10 backends reachable


2. edgeProxy Service Status​

Test: Verify all edgeProxy services are running on EC2 Hub.

sudo systemctl status edgeproxy
ss -tlnp | grep edge-proxy
ss -ulnp | grep edge-proxy

Results:

ServicePortProtocolStatus
TCP Proxy8080TCPOK
TLS Server8443TCPOK
API Server8081TCPOK
DNS Server5353UDPOK
Gossip4001UDPOK
Transport4002UDPOK

Status: All services active


3. API Backend Registration​

Test: Register backends via Auto-Discovery API.

curl -X POST http://34.246.117.138:8081/api/v1/register \
-H "Content-Type: application/json" \
-d '{"id":"pop-gru","app":"gru.pop","region":"sa","ip":"10.50.1.1","port":80}'

Results:

BackendAppRegionResponse
pop-grugru.popsa{"registered":true}
pop-iadiad.popus{"registered":true}
pop-ordord.popus{"registered":true}
pop-laxlax.popus{"registered":true}
pop-lhrlhr.popeu{"registered":true}
pop-frafra.popeu{"registered":true}
pop-cdgcdg.popeu{"registered":true}
pop-nrtnrt.popap{"registered":true}
pop-sinsin.popap{"registered":true}
pop-sydsyd.popap{"registered":true}

Status: 10/10 backends registered


4. DNS Resolution with App Filter​

Test: Query DNS server for region-specific backends.

dig @127.0.0.1 -p 5353 gru.pop.internal +short
dig @127.0.0.1 -p 5353 lhr.pop.internal +short
dig @127.0.0.1 -p 5353 nrt.pop.internal +short

Results:

QueryExpectedResponseStatus
gru.pop.internal10.50.1.110.50.1.1OK
iad.pop.internal10.50.2.110.50.2.1OK
ord.pop.internal10.50.2.210.50.2.2OK
lax.pop.internal10.50.2.310.50.2.3OK
lhr.pop.internal10.50.3.110.50.3.1OK
fra.pop.internal10.50.3.210.50.3.2OK
cdg.pop.internal10.50.3.310.50.3.3OK
nrt.pop.internal10.50.4.110.50.4.1OK
sin.pop.internal10.50.4.210.50.4.2OK
syd.pop.internal10.50.4.310.50.4.3OK

Status: 10/10 DNS queries correct


5. DNS from Fly.io Machines​

Test: Query DNS server from each Fly.io region via WireGuard.

# From GRU
fly ssh console -a edgeproxy-backend -r gru -C "dig @10.50.0.1 -p 5353 gru.pop.internal +short"

# From NRT
fly ssh console -a edgeproxy-backend -r nrt -C "dig @10.50.0.1 -p 5353 nrt.pop.internal +short"

Results:

Source RegionQueryResponseStatus
GRUgru.pop.internal10.50.1.1OK
NRTnrt.pop.internal10.50.4.1OK

Status: DNS accessible from all Fly.io regions


Issues Found and Fixed​

Issue 1: WireGuard Endpoint IP Change​

Problem: EC2 instance had dynamic public IP that changed after restart from 54.171.48.207 to 34.240.78.199.

Root Cause: EC2 instances without Elastic IP receive new public IP on restart.

Fix:

  1. Allocated Elastic IP 34.246.117.138
  2. Associated with EC2 instance
  3. Updated WireGuard endpoint on all Fly.io machines
# On each Fly.io machine
sed -i "s/Endpoint = .*/Endpoint = 34.246.117.138:51820/" /etc/wireguard/wg0.conf
wg-quick down wg0 && wg-quick up wg0

Issue 2: WireGuard Public Key Mismatch​

Problem: Fly.io machines had old public key configured.

Root Cause: EC2 WireGuard was reconfigured, generating new keypair.

Fix: Updated public key on all Fly.io machines to Q9T4p88puHFgI8P8vLGjECvoXr85o5uncZQ2G35vE14=

Issue 3: DNS Server Not Responding​

Problem: DNS queries timing out even though port 5353 was listening.

Root Cause: Bug in handle_packet() function - it parsed DNS packets but never sent responses.

Fix: Rewrote handle_packet() to send DNS responses via UDP socket.

// Before (broken)
async fn handle_packet(...) -> anyhow::Result<()> {
let message = Message::from_bytes(data)?;
// Only logging, no response!
Ok(())
}

// After (fixed)
async fn handle_packet(..., socket: Arc<UdpSocket>) -> anyhow::Result<()> {
let message = Message::from_bytes(data)?;
// Process query and send response
let bytes = response.to_bytes()?;
socket.send_to(&bytes, src).await?;
Ok(())
}

Issue 4: DNS Not Filtering by App Name​

Problem: All DNS queries returned the same backend (geo-based) regardless of app name.

Root Cause: DNS resolver used resolve_backend_with_geo() which doesn't filter by app.

Fix:

  1. Added resolve_backend_by_app() method to ProxyService
  2. Updated DNS resolver to use app filter when app name is specified
// New method in ProxyService
pub async fn resolve_backend_by_app(
&self,
app: &str,
client_ip: IpAddr,
client_geo: Option<GeoInfo>,
) -> Option<Backend> {
let backends: Vec<Backend> = self.backend_repo.get_healthy().await
.into_iter()
.filter(|b| b.app == app)
.collect();
// ... load balancing among filtered backends
}

Network Topology​

Fly.io Integration Topology

DNS Naming Convention​

DNS entries follow the pattern <region>.pop.internal:

DNS NameResolves ToRegion
gru.pop.internal10.50.1.1South America
iad.pop.internal10.50.2.1US East
ord.pop.internal10.50.2.2US Central
lax.pop.internal10.50.2.3US West
lhr.pop.internal10.50.3.1Europe (UK)
fra.pop.internal10.50.3.2Europe (DE)
cdg.pop.internal10.50.3.3Europe (FR)
nrt.pop.internal10.50.4.1Asia Pacific (JP)
sin.pop.internal10.50.4.2Asia Pacific (SG)
syd.pop.internal10.50.4.3Asia Pacific (AU)

Conclusion​

All integration tests passed successfully after fixing the identified issues:

Test CategoryResult
WireGuard Connectivity10/10 OK
Service Status6/6 OK
API Registration10/10 OK
DNS Resolution10/10 OK
Cross-Region DNSOK

Total: All tests passing