mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Ports the edge halves of two release-branch changes onto main, which production
edge deploys come from (prod edge = ba3f991):
- Ingress mode (#41986): signed ingress header (INGRESS_SECRETS) and token mode
for a cloud load balancer (INGRESS_TOKENS secret, INGRESS_ORIGINS,
INGRESS_SOURCE_CIDRS). All or nothing: a partial or malformed setup turns the
mode off and logs relay_edge_ingress_config_invalid; it never throws. Requests
from the configured egress ranges that fail the trust rule get 403. Admin calls
are matched first. Adds cloud/apps/relay-ingress (stateless proxy) and the
relay-contract ingress-header module.
- POST /__admin/verify (#42538, edge half): the director's check for a phone
resume token or invite that exists only on the edge. Hash only, read-only: an
object that never held the host (or no longer holds it here) answers not_here
before anything is written; otherwise the token's jti is its only write.
Replay and jti_full are 409. Adds hash-input variants to RelayCredentialStore
(shared with the edge; existing methods delegate, behaviour unchanged).
Kept from main: drain, single-use admin tokens (jti), signing-key rotation,
JWKS-outage tolerance, keepalive auto-response, health probe. The place label
keeps main's '<continent>/<colo>' and, only behind a verified ingress, appends
'/<country>/<ingress name>'.
No user effect until the ingress vars/secret are set or the director calls verify.
34 lines
2.1 KiB
Docker
34 lines
2.1 KiB
Docker
# Relay ingress proxy (src/proxy.ts). Build from cloud/: docker build -f apps/relay-ingress/Dockerfile .
|
|
# Runtime config: see src/index.ts. Certificate, key and secret are mounted files, never baked in.
|
|
FROM node:24.22.2-alpine@sha256:8a32c8cf649a49915a66e81e7a609223c708d0adabf288ee3f4077d765542f85 AS build
|
|
WORKDIR /app
|
|
ENV PATH="/opt/pnpm/node_modules/.bin:$PATH"
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.base.json ./
|
|
RUN npm install --prefix /opt/pnpm --ignore-scripts --no-audit --no-fund "$(node -p 'require("./package.json").packageManager.split("+")[0]')" \
|
|
&& npm audit signatures --prefix /opt/pnpm
|
|
COPY packages/relay-contract/package.json packages/relay-contract/package.json
|
|
COPY apps/relay-ingress/package.json apps/relay-ingress/package.json
|
|
RUN pnpm install --frozen-lockfile --filter @orca-cloud/relay-ingress...
|
|
COPY packages/relay-contract packages/relay-contract
|
|
COPY apps/relay-ingress apps/relay-ingress
|
|
RUN pnpm --filter @orca-cloud/relay-contract build && pnpm --filter @orca-cloud/relay-ingress build
|
|
|
|
FROM node:24.22.2-alpine@sha256:8a32c8cf649a49915a66e81e7a609223c708d0adabf288ee3f4077d765542f85 AS runtime
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
RUN apk upgrade --no-cache
|
|
# The proxy has no runtime dependencies beyond the contract's built output.
|
|
COPY --from=build /app/packages/relay-contract/package.json packages/relay-contract/package.json
|
|
COPY --from=build /app/packages/relay-contract/dist packages/relay-contract/dist
|
|
COPY --from=build /app/apps/relay-ingress/package.json apps/relay-ingress/package.json
|
|
COPY --from=build /app/apps/relay-ingress/dist apps/relay-ingress/dist
|
|
RUN mkdir -p apps/relay-ingress/node_modules/@orca-cloud \
|
|
&& ln -s ../../../../packages/relay-contract apps/relay-ingress/node_modules/@orca-cloud/relay-contract \
|
|
&& rm -f /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack /usr/local/bin/yarn /usr/local/bin/yarnpkg
|
|
USER node
|
|
# 443 needs CAP_NET_BIND_SERVICE as non-root; the default listens on 8443 behind the load balancer.
|
|
ENV PORT=8443 HEALTH_PORT=8081 HEALTH_HOST=0.0.0.0
|
|
EXPOSE 8443 8081
|
|
STOPSIGNAL SIGTERM
|
|
CMD ["node", "apps/relay-ingress/dist/index.js"]
|