Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frameworks/zix-http2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
zig-out
zig-package
vendor
/zig*
29 changes: 14 additions & 15 deletions frameworks/zix-http2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG TARGETARCH
ARG RETRY_DELAY=3
ARG TIMEOUT_SEC=180
ARG ZIG_VERSION=0.16.0
ARG ZIX_VERSION=0.5.x-rc1
ARG ZIX_VERSION=0.5.x
RUN apk add --no-cache ca-certificates curl git tar xz openssl

WORKDIR /server
Expand All @@ -21,20 +21,16 @@ RUN set -eu; \
mv "/opt/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}" /opt/zig
ENV PATH="/opt/zig:${PATH}"

COPY build.zig build.zig.zon ./
COPY build.zig ./
COPY build.zig.zon.template ./build.zig.zon
COPY src ./src

# Resolve zix with zig fetch (hash-verified branch tarball, no git),
# codeberg first then github, RETRY attempts each.
# The shipped build.zig.zon points .zix at vendor/zix for local staging:
# this step swaps that one line for the fetched url + hash,
# so a remote build needs no vendor directory.
# Resolve zix with zig fetch git+https
RUN set -eu; \
fetch_zix() { \
url="$1"; attempt=1; \
while [ "${attempt}" -le "${RETRY}" ]; do \
if hash="$(zig fetch "${url}")"; then \
sed -i "s|\.path = \"vendor/zix\",|.url = \"${url}\", .hash = \"${hash}\",|" build.zig.zon; \
if $(zig fetch --save ${url}); then \
return 0; \
fi; \
echo "zix: ${url} attempt ${attempt}/${RETRY} failed" >&2; \
Expand All @@ -43,10 +39,10 @@ RUN set -eu; \
done; \
return 1; \
}; \
fetch_zix "https://codeberg.org/prothegee/zix/archive/${ZIX_VERSION}.tar.gz" \
|| { echo "zix: codeberg exhausted ${RETRY} attempts, trying github" >&2; \
fetch_zix "https://github.com/prothegee/zix/archive/refs/heads/${ZIX_VERSION}.tar.gz"; } \
|| { echo "zix: github exhausted ${RETRY} attempts" >&2; exit 1; }
fetch_zix "git+https://codeberg.org/prothegee/zix#${ZIX_VERSION}" \
|| { echo "zix: codeberg exhausted ${RETRY} attempts" >&2; \
fetch_zix "git+https://github.com/prothegee/zix#${ZIX_VERSION}"; } \
|| { echo "zix: github exhausted ${RETRY} attempts" >&2; exit 1; }

# +aes+pclmul: x86_64_v3 omits AES-NI / PCLMUL,
# so zix TLS would compile the ~40x slower software AES-GCM.
Expand All @@ -56,13 +52,16 @@ RUN set -eu; \
amd64) ZIG_TARGET=x86_64-linux-musl; ZIG_CPU=x86_64_v3 ;; \
arm64) ZIG_TARGET=aarch64-linux-musl; ZIG_CPU=baseline ;; \
esac; \
zig build -Dtarget="${ZIG_TARGET}" -Dcpu="${ZIG_CPU}+aes+pclmul+adx" --release=fast
zig build \
-Dtarget="${ZIG_TARGET}" \
-Dcpu="${ZIG_CPU}+aes+pclmul+adx" \
--release=fast --summary failures;

# Self-signed Ed25519 cert generated at image build, baked at /etc/zix-tls.
RUN set -eu; \
mkdir -p /etc/zix-tls; \
openssl genpkey -algorithm ED25519 -out /etc/zix-tls/server.key; \
openssl req -new -x509 -key /etc/zix-tls/server.key -out /etc/zix-tls/server.crt \
openssl req -new -x509 -key /etc/zix-tls/server.key -out /etc/zix-tls/server.cert \
-days 3650 -subj "/CN=localhost"

FROM alpine:3.20
Expand Down
12 changes: 12 additions & 0 deletions frameworks/zix-http2/build.zig.zon.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.{
.name = .zix_http2_arena,
.version = "0.1.0",
.fingerprint = 0x62ec9e924e0a448,
.minimum_zig_version = "0.16.0",
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
.dependencies = .{},
}
6 changes: 4 additions & 2 deletions frameworks/zix-http2/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"language": "Zig",
"type": "engine",
"engine": "zix.Http2 URING Dispatch Model",
"description": "Zig HTTP/2 server on the zix.Http2 raw engine, .URING dispatch: shared-nothing per-core io_uring with SO_REUSEPORT, per-worker stream-slot pool. Dual listener (config.tls_port): h2c 8082 plus h2 over TLS 1.3 (ALPN h2) on 8443, one process.",
"description": "HTTP/2 on the zix.Http2 raw engine, .URING dispatch: per-worker SO_REUSEPORT io_uring loops, per-worker stream-slot pool, comptime Router. Dual listener: h2c 8082, h2 over TLS 1.3 (ALPN h2) on 8443, one process. No response cache and no startup pre-serialization anywhere: json serializes every field per request, static is the engine's public_dir.",
"repo": "https://github.com/prothegee/zix",
"enabled": true,
"tests": [
Expand All @@ -12,5 +12,7 @@
"baseline-h2c",
"json-h2c"
],
"maintainers": ["prothegee"]
"maintainers": [
"prothegee"
]
}
167 changes: 0 additions & 167 deletions frameworks/zix-http2/src/dataset.zig

This file was deleted.

Loading