Skip to content

Commit a61ef55

Browse files
fix: build
1 parent a1dfb62 commit a61ef55

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ WORKDIR /app
1313
# Copy proxy script
1414
COPY webhook-proxy/proxy.js .
1515

16-
# Create non-root user
17-
RUN addgroup -g 1000 webhook && \
18-
adduser -D -u 1000 -G webhook webhook && \
19-
chown -R webhook:webhook /app
16+
# Create non-root user (use existing node user from base image)
17+
RUN chown -R node:node /app
2018

2119
# Switch to non-root user
22-
USER webhook
20+
USER node
2321

2422
# Expose ports
2523
# 8888: Webhook API (external-dns talks to this)

webhook-proxy/proxy.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,28 @@ const metricsServer = http.createServer((req, res) => {
9898

9999
// Health check endpoint
100100
if (url.pathname === '/health' || url.pathname === '/healthz') {
101-
// Proxy to Firewalla health endpoint
102-
proxyRequest(req, res, FIREWALLA_HEALTH_URL);
101+
// Check Firewalla health endpoint directly
102+
const healthCheck = http.get(`${FIREWALLA_HEALTH_URL}/healthz`, (healthRes) => {
103+
if (healthRes.statusCode === 200) {
104+
res.writeHead(200, { 'Content-Type': 'text/plain' });
105+
res.end('ok');
106+
} else {
107+
res.writeHead(503, { 'Content-Type': 'text/plain' });
108+
res.end('unhealthy');
109+
}
110+
});
111+
112+
healthCheck.on('error', (err) => {
113+
console.error('Health check failed:', err.message);
114+
res.writeHead(503, { 'Content-Type': 'text/plain' });
115+
res.end('unhealthy');
116+
});
117+
118+
healthCheck.setTimeout(5000, () => {
119+
healthCheck.destroy();
120+
res.writeHead(503, { 'Content-Type': 'text/plain' });
121+
res.end('unhealthy - timeout');
122+
});
103123
return;
104124
}
105125

0 commit comments

Comments
 (0)