Skip to content

Commit 06d76ad

Browse files
authored
Harden api-proxy startup healthcheck to reduce early unhealthy flaps (#2155)
* Initial plan * fix: harden api-proxy startup healthcheck timing Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/44091053-b674-4a52-9925-6638b3defeff * test: keep api-proxy healthcheck assertions type-safe Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/9a7c100d-699a-4d82-b62e-f1af7fcd53a4 --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 parent 6cade09 commit 06d76ad

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/docker-manager.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,11 @@ describe('docker-manager', () => {
23652365
const result = generateDockerCompose(configWithProxy, mockNetworkConfigWithProxy);
23662366
const proxy = result.services['api-proxy'];
23672367
expect(proxy.healthcheck).toBeDefined();
2368-
expect((proxy.healthcheck as any).test).toEqual(['CMD', 'curl', '-f', 'http://localhost:10000/health']);
2368+
const healthcheck = proxy.healthcheck!;
2369+
expect(healthcheck.test).toEqual(['CMD', 'curl', '-f', 'http://localhost:10000/health']);
2370+
expect(healthcheck.timeout).toBe('2s');
2371+
expect(healthcheck.retries).toBe(10);
2372+
expect(healthcheck.start_period).toBe('10s');
23692373
});
23702374

23712375
it('should drop all capabilities', () => {

src/docker-manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,9 +1773,9 @@ export function generateDockerCompose(
17731773
healthcheck: {
17741774
test: ['CMD', 'curl', '-f', `http://localhost:${API_PROXY_HEALTH_PORT}/health`],
17751775
interval: '1s',
1776-
timeout: '1s',
1777-
retries: 5,
1778-
start_period: '2s',
1776+
timeout: '2s',
1777+
retries: 10,
1778+
start_period: '10s',
17791779
},
17801780
// Security hardening: Drop all capabilities
17811781
cap_drop: ['ALL'],

0 commit comments

Comments
 (0)