Skip to content

Commit 166257f

Browse files
committed
fix: workaround for builder-hub-proxy
1 parent d314a26 commit 166257f

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

internal/components.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ func (b *BuilderHub) Run(service *service, ctx *ExContext) {
467467
WithEnv("ADMIN_ADDR", "0.0.0.0:"+`{{Port "admin" 8081}}`).
468468
WithEnv("INTERNAL_ADDR", "0.0.0.0:"+`{{Port "internal" 8082}}`).
469469
WithEnv("METRICS_ADDR", "0.0.0.0:"+`{{Port "metrics" 8090}}`).
470+
WithEnv("MOCK_SECRETS", "true").
470471
DependsOnHealthy(b.postgres)
471472
}
472473

@@ -480,13 +481,26 @@ type BuilderHubMockProxy struct {
480481

481482
func (b *BuilderHubMockProxy) Run(service *service, ctx *ExContext) {
482483
service.
483-
WithImage("docker.io/flashbots/builder-hub-mock-proxy").
484-
WithTag("latest").
485-
WithPort("http", 8888)
486-
487-
if b.TargetService != "" {
488-
service.DependsOnHealthy(b.TargetService)
489-
}
484+
WithImage("nginx").
485+
WithTag("1.27").
486+
WithPort("http", 8888).
487+
DependsOnRunning(b.TargetService).
488+
WithEntrypoint("/bin/sh").
489+
WithArgs("-c", fmt.Sprintf(`cat > /etc/nginx/conf.d/default.conf << 'EOF'
490+
server {
491+
listen 80;
492+
listen 8888;
493+
494+
location / {
495+
proxy_pass http://%s:8080;
496+
proxy_set_header X-Flashbots-Attestation-Type 'test';
497+
proxy_set_header X-Flashbots-Measurement '{}';
498+
proxy_set_header X-Forwarded-For '1.2.3.4';
499+
}
500+
}
501+
EOF
502+
nginx -g 'daemon off;'
503+
`, b.TargetService))
490504
}
491505

492506
func (b *BuilderHubMockProxy) Name() string {

internal/recipe_buildernet.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ func (b *BuilderNetRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest
5252
postgres: "builder-hub-postgres",
5353
})
5454

55-
// Optionally add mock proxy for testing
56-
if b.includeMockProxy {
57-
svcManager.AddService("builder-hub-proxy", &BuilderHubMockProxy{
58-
TargetService: "builder-hub",
59-
})
60-
}
55+
// Add mock proxy for testing
56+
svcManager.AddService("builder-hub-proxy", &BuilderHubMockProxy{
57+
TargetService: "builder-hub",
58+
})
6159

6260
return svcManager
6361
}

0 commit comments

Comments
 (0)