feat(magefile): allow to customise interp timeout#301
Conversation
M4tteoP
left a comment
There was a problem hiding this comment.
Hey @Infra-Red, could you please rebase this PR on top of main branch? The CI has been fixed, so a rebase should be enough to have this PR green. Overall, LGTM!
Thanks
Signed-off-by: Andrei Krasnitski <11172501+Infra-Red@users.noreply.github.com>
3edd5bd to
b6cec4d
Compare
|
Done. Thanks for looking into it @M4tteoP! |
|
Thanks! Looks good and CI is green. |
|
Hi @M4tteoP, I'm with @Infra-Red. Here's our Dockerfile: # mmdb loader stage
FROM python AS loader
COPY update_geoip2.py /
RUN /update_geoip2.py -d GeoIP2-City -o /
# Builder stage
FROM tinygo/tinygo AS builder
WORKDIR /app
RUN git clone https://github.com/corazawaf/coraza-proxy-wasm.git .
COPY --chmod=755 *.go ./
COPY --from=loader /GeoIP2-City.mmdb ./
RUN go get github.com/corazawaf/coraza-geoip && go mod tidy
RUN sed -i 's/-target=wasip1", buildTagArg);/-target=wasip1", buildTagArg, "-interp-timeout=120m");/g' magefiles/magefile.go
RUN go run mage.go build
# Final stage
FROM scratch
COPY --from=builder /app/build/main.wasm /plugin.wasm
That The only .go file (copied in the builder stage) is basically copy-paste from the coraza-geoip readme: package main
import (
_ "embed"
geo "github.com/corazawaf/coraza-geoip"
)
//go:embed GeoIP2-City.mmdb
var geoIpCity []byte
func init() {
geo.RegisterGeoDatabase(geoIpCity, "city")
}Be prepared for ~25 minute build. If you're also curious about usage side: we tried to tie this to Envoy (via Envoy Gateway), but failed due to various limitations, most critical being something making restricted callbacks, and even though I managed to hack in some |
The build process is failing after 3 minutes (default tinygo inter timeout) when trying to build a filter with GeoIP pluging that has a city database embedded:
This change will allow increasing the timeout so that builds that use the
go:embeddirective aren't failing.