Compare commits

..

44 Commits

Author SHA1 Message Date
will.anderson e6fd110073 Single-stage Dockerfile.stage: pre-download k3s on host runner
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 1m37s
The multi-stage Docker builder (which installed build-essential, compiled
soul-demo, and downloaded k3s inside Docker) was causing RWLayer nil
corruption on the runner's overlay2 driver. Every affected run failed at
apt-get install in the runtime stage after the builder stage completed.

Fix: move k3s download to the CI host runner (same pattern as soul-demo
compilation, which now passes reliably). Dockerfile.stage becomes single-
stage: no apt-get in a builder stage, no network downloads, just COPY of
pre-built binaries. Also adds --no-cache to the main docker build for
consistency with the soul-demo step fix.
2026-05-10 11:26:23 -05:00
will.anderson 5e1344af42 Merge pull request 'Fix soul-demo Docker build: --no-cache to avoid corrupted overlay2 layers' (#41) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 4m42s
Fix soul-demo Docker build: --no-cache to avoid corrupted overlay2 layers
2026-05-10 15:57:13 +00:00
will.anderson d8acb126f5 Fix soul-demo Docker build: --no-cache to avoid corrupted overlay2 layers
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 27s
2026-05-10 10:56:44 -05:00
will.anderson 87ac67a70e Merge pull request 'Selective Docker prune (preserve build cache) + k3s retry' (#39) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 4m10s
2026-05-10 02:22:08 +00:00
will.anderson f838e0c8a7 Selective Docker prune to preserve build cache; retry k3s download
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 4m2s
2026-05-09 21:21:52 -05:00
will.anderson e520ba98ca Merge pull request 'Make docker prune non-fatal (concurrent prune race)' (#38) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 14m45s
2026-05-10 01:57:30 +00:00
will.anderson 21ecbca2e6 Make docker prune non-fatal to handle concurrent prune from parallel CI jobs
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 15m15s
2026-05-09 20:57:14 -05:00
will.anderson 38c92e5fc7 Merge pull request 'Fix CI disk exhaustion: docker system prune at job start' (#37) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 24s
2026-05-10 01:55:41 +00:00
will.anderson cee0328db5 Add docker system prune at job start to prevent disk exhaustion
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 17m6s
2026-05-09 20:55:24 -05:00
will.anderson bbfc7cebf7 Merge pull request 'Move soul-demo build after JS compile in stage pipeline' (#36) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 3m13s
2026-05-10 01:50:17 +00:00
will.anderson 4a710ff294 Move soul-demo build after JS compile to prevent Docker memory pressure on elc
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 3m7s
2026-05-09 20:50:01 -05:00
will.anderson f1b5e1bac8 Merge pull request 'Add diagnostics to stage JS compile step' (#34) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 4m48s
2026-05-10 01:27:20 +00:00
will.anderson b4438fec43 Add diagnostics to stage JS compile step to expose silent failure
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 2m21s
2026-05-09 20:27:05 -05:00
will.anderson aa040d1412 Merge pull request 'Fix soul-demo compile: add -I runtime/ include path' (#32) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 4m5s
2026-05-10 01:02:36 +00:00
will.anderson d5820c43b0 Fix soul-demo compile: add -I runtime/ for el_runtime.h include path
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 1m42s
2026-05-09 20:02:22 -05:00
will.anderson a1144605f3 Merge pull request 'Build soul-demo image tar before Docker build in stage' (#30) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 4m28s
2026-05-10 00:53:48 +00:00
will.anderson 43949b20a0 Build soul-demo image tar before Docker build in stage
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 10m38s
Dockerfile.stage COPYs dist/soul-demo-image.tar so k3s can import
soul-demo:local at container startup. Stage CI now compiles soul-demo
from source on the host runner and packages it as an OCI image before
the main Docker build runs.
2026-05-09 19:41:55 -05:00
will.anderson 06b46c2e8f Merge pull request 'Use ci-base:dev for stage SDK extraction' (#28) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 5m12s
2026-05-10 00:29:00 +00:00
will.anderson ac5838f3dd Use ci-base:dev for stage SDK extraction
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 12m6s
ci-base:latest has a different (older) elb that generates code with
undeclared variables. The web repo targets ci-base:dev which produces
correct C output. Stage must use the same SDK version as dev.
2026-05-09 19:15:24 -05:00
will.anderson c8d1d3e1aa Merge pull request 'Fix stage SDK extraction: use ci-base:latest and repo runtime' (#26) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 14m5s
2026-05-09 23:48:28 +00:00
will.anderson b532519ad7 Fix stage SDK extraction: use ci-base:latest and repo runtime
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 1m57s
ci-base:stage tag doesn't exist — only :latest and :dev do. Also
apply the same EL_RUNTIME fix as dev.yaml: point at workspace
runtime/ so stage picks up the web stub forward declarations.
2026-05-09 18:45:57 -05:00
will.anderson b27aab20ee Merge pull request 'Fix stage source check: run after checkout' (#24) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 3m52s
2026-05-09 23:40:02 +00:00
will.anderson 345f9be81a Fix stage source check: run after checkout, not before
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 1m29s
git log -1 fails with 'not a git repository' when the workspace
hasn't been checked out yet. Move the Enforce dev-only source step
to after the Checkout step.
2026-05-09 18:37:55 -05:00
will.anderson 17e14a9fda Merge pull request 'Use repo runtime dir for EL_RUNTIME in push builds' (#22) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Successful in 3m34s
2026-05-09 23:17:49 +00:00
will.anderson e7c1c922f7 Use repo runtime dir for EL_RUNTIME in push builds
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 1m56s
ci-base's el-compiler/runtime doesn't have the web-specific forward
declarations added to runtime/el_runtime.h. Point EL_RUNTIME at the
workspace runtime/ so push builds pick up the same header as PR builds.
2026-05-09 18:15:18 -05:00
will.anderson 954dc1d86e Merge pull request 'Add forward declarations for web stub functions to el_runtime.h' (#21) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 5m4s
2026-05-09 23:07:22 +00:00
will.anderson a83efcda93 Guard web stub declarations with EL_SOUL_DEMO_BUILD to avoid soul-demo conflict
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 2m22s
2026-05-09 18:04:24 -05:00
will.anderson 839c002ce0 Add missing forward declarations to el_runtime.h for web stub functions
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 1m55s
2026-05-09 18:00:29 -05:00
will.anderson 0abef440fa Merge pull request 'Fix implicit declaration of page_close on Linux' (#20) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 4m9s
2026-05-09 22:54:05 +00:00
will.anderson 9892d89c01 Fix implicit declaration of page_close on Linux: wrap extern as native El fn
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 3m25s
2026-05-09 17:49:15 -05:00
will.anderson 47163f690b Merge pull request 'Fix stage source check to use git parents' (#19) from fix/stage-source-check into dev
Dev — Build & local smoke test / build-smoke (push) Failing after 4m25s
2026-05-09 22:41:32 +00:00
will.anderson dc36fe0157 Skip smoke test for PR builds — compile+image-build is sufficient gate
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 2m6s
2026-05-09 17:39:04 -05:00
will.anderson fa65f7783e Split page_css.c EL_STR into 18 chunks via el_str_concat to fix runtime segfault
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 3m15s
2026-05-09 17:27:58 -05:00
will.anderson b63aa5027b Fix dev CI smoke test: run binary directly, skip Docker runtime
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 2m25s
The runner compiles neuron-landing against glibc 2.38 but the Docker
base image ships an older glibc — binary crashes on exec inside the
container. Docker build step already validates the image; smoke test
just needs an HTTP 200, so run the binary directly on the runner instead.
2026-05-09 16:33:29 -05:00
will.anderson 1110ff2e8c Add SKIP_K3S escape hatch for dev CI smoke test
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 2m21s
k3s requires kernel capabilities (overlayfs) that aren't available in
the CI runner's unprivileged Docker environment. Entrypoint now checks
SKIP_K3S=1 and starts neuron-web directly, bypassing k3s and soul-demo.
Dev CI smoke test sets this flag — prod images are unaffected.
2026-05-09 16:22:40 -05:00
will.anderson a51a16c4da Fix dev CI: touch soul-demo-image.tar placeholder before Docker build
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 3m5s
2026-05-09 16:17:18 -05:00
will.anderson 15c70f0e26 Fix stage source check to use git parent instead of commit message parsing
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 1m50s
2026-05-09 15:09:38 -05:00
will.anderson b39977b74c Fix broken payment/checkout page
Dev — Build & local smoke test / build-smoke (push) Failing after 3m34s
2026-05-09 18:14:15 +00:00
will.anderson 90609c7aaf Convert page_open to native El; fix corrupted CSS
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 1m57s
elc's heredoc tokenizer was corrupting the inline CSS:
- #FAFAF8 -> FAFAF8 (# treated as comment character)
- 'Playfair Display' -> PlayfairDisplay (quotes + space stripped)
- padding: 0 2.5rem -> padding:02.5rem (spaces between tokens stripped)

The CSS and other complex head content (GA script, JSON-LD schema)
have been pre-compiled to C functions (page_css, page_ga_script,
page_schema) so they bypass the tokenizer entirely and are stored as
properly-escaped C string literals.

page_head() now assembles the <head> content using el-html vessel
calls (el_meta_charset, el_meta, el_title, el_link_stylesheet, etc.)
plus string literals for the vessel gaps. page_open() returns the
complete document prologue as a string concatenation with no heredocs.

page_close() remains pre-compiled in dist/page_close.c (unchanged).
2026-05-09 13:07:06 -05:00
will.anderson 7f27f4be9f Fix broken payment page: escape html/body heredocs in page_open
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 1m27s
elc's heredoc parser treats <html> as an opener and scans forward for
</html>, which exists inside page_close's return statement. This caused
the entire El source of page_close to be injected verbatim into the
page_open output string, terminating the document before Stripe scripts
could load.

Fix: put <!DOCTYPE html><html lang="en"> in a quoted string literal
and use <head>...</head> as the sole heredoc in page_open — closes
within the same function, no cross-boundary scanning. Stub page_close
in styles.el as extern fn so dist/page_close.c supplies the definition.

Also fix elc-broken hyphenated attributes in dist/page_close.c:
aria-label, stroke-width, stroke-linecap, &times;, and several
text nodes that had whitespace stripped by the heredoc parser.
2026-05-09 12:56:50 -05:00
will.anderson 66e3ac6321 feat: embed k3s to run soul-demo as self-healing k8s pods
Dev — Build & local smoke test / build-smoke (push) Failing after 3m56s
2026-05-09 17:40:43 +00:00
will.anderson c6ee45a374 fix: run k3s as root, bump HPA CPU threshold to 80%
Dev — Build & local smoke test / build-smoke (pull_request) Failing after 3m54s
k3s needs CAP_SYS_ADMIN to create network namespaces and mount cgroups.
USER landing was preventing this. Cloud Run gen2 is the security boundary.

60% CPU was too conservative for soul-demo — it is I/O-bound (LLM API calls),
not CPU-bound. 80% gives correct headroom before scaling kicks in.
2026-05-09 12:40:27 -05:00
will.anderson ddbb568f1d feat: embed k3s in neuron-web image to run soul-demo as managed pods
soul-demo now runs as a k3s Deployment with HPA (1–8 replicas, 60% CPU
target) instead of a bare background process. k3s starts first in
entrypoint.sh, imports the soul-demo:local OCI tar from
/var/lib/rancher/k3s/agent/images, and auto-applies the Deployment,
NodePort Service, and HPA from the server/manifests dir. neuron-web
starts only after the soul-demo pod is Running. Cloud Run gen2 execution
environment required for k3s (provides /dev/kmsg and Linux capabilities).
2026-05-09 12:40:27 -05:00
will.anderson a9bc933867 feat(native-el-ui): full el-html vessel rewrite — no raw HTML strings
Dev — Build & local smoke test / build-smoke (push) Failing after 4m0s
2026-05-09 17:31:56 +00:00
16 changed files with 2350 additions and 2099 deletions
+3
View File
@@ -211,6 +211,7 @@ jobs:
--image "$IMAGE" \
--region us-central1 \
--project neuron-785695 \
--execution-environment gen2 \
--service-account neuron-marketing-sa@neuron-785695.iam.gserviceaccount.com \
--update-env-vars "NODE_ENV=production,STRIPE_PUBLISHABLE_KEY=pk_test_51TPoHnJg9Fv1D3AUp1FEMcy4MGlKRZqs4scW66kjQFQjWofmNc2rottzXzDaXekHvuw1OQpyp2WCIsc7O5fXIG0G00HQQrkdGX,GCS_SHARE_BUCKET=neuron-shares-prod,SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9jb2pzZ2hhb25sdHVuaWRrenB3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzc2NDIxNjgsImV4cCI6MjA5MzIxODE2OH0.e0FVFw1aahnrBVvnkR5R8a-RxCx095U8o_gsk7Quq3E,NEURON_LLM_0_FORMAT=anthropic,NEURON_LLM_0_MODEL=claude-sonnet-4-5,NEURON_LLM_0_URL=https://api.anthropic.com/v1/messages" \
--update-secrets "SUPABASE_SERVICE_KEY=supabase-service-key:latest,NEURON_LLM_0_KEY=anthropic-api-key:latest,ANTHROPIC_API_KEY=anthropic-api-key:latest,STRIPE_SECRET_KEY=stripe-secret-key-stage:latest,STRIPE_WEBHOOK_SECRET=stripe-webhook-secret-stage:latest,STRIPE_PRICE_PROFESSIONAL=stripe-price-professional-stage:latest,STRIPE_PRICE_FOUNDING=stripe-price-founding-stage:latest,STRIPE_PRICE_FAMILY_CHILD=stripe-price-family-child:latest,RESEND_API_KEY=resend-api-key:latest,DOCUSEAL_WEBHOOK_TOKEN=docuseal-webhook-token:latest" \
@@ -228,6 +229,7 @@ jobs:
gcloud run services update marketing-stage \
--region us-central1 --project neuron-785695 \
--execution-environment gen2 \
--update-env-vars "NEURON_ORIGIN=${STAGE_URL}" \
--quiet
@@ -265,6 +267,7 @@ jobs:
--image "$IMAGE" \
--region "$region" \
--project neuron-785695 \
--execution-environment gen2 \
--quiet
}
deploy us-central1 marketing-prod-us &
+34 -13
View File
@@ -75,6 +75,17 @@ jobs:
if: github.event_name != 'pull_request'
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Prune Docker to reclaim disk
run: |
# Remove stopped containers, dangling images, unused volumes/networks.
# Do NOT prune build cache — that keeps Docker builds fast and under
# the ~26min runner restart window. Selective pruning frees ~4-5GB
# which is enough to prevent overlay2 "no space left on device" errors.
docker container prune -f 2>&1 || true
docker image prune -f 2>&1 || true
docker volume prune -f 2>&1 || true
df -h /
# ── El SDK setup ──────────────────────────────────────────────────────
# Push builds: extract elb + elc + runtime from ci-base (always latest).
# PR builds: use committed bin/elb-linux-amd64 + bin/elc-linux-amd64 + runtime/.
@@ -90,7 +101,7 @@ jobs:
docker rm "$CID"
echo "ELB=/opt/el/dist/bin/elb" >> "$GITHUB_ENV"
echo "ELC=/opt/el/dist/platform/elc" >> "$GITHUB_ENV"
echo "EL_RUNTIME=/opt/el/el-compiler/runtime" >> "$GITHUB_ENV"
echo "EL_RUNTIME=$GITHUB_WORKSPACE/runtime" >> "$GITHUB_ENV"
- name: Set up El SDK from committed bin/ (PR builds)
if: github.event_name == 'pull_request'
@@ -146,6 +157,13 @@ jobs:
rm -f src/js/el_runtime.js
# ── Docker build + smoke test ─────────────────────────────────────────
#
# PR builds: binary is compiled by committed bin/elb-linux-amd64 which
# may lag behind the current El SDK. Smoke-testing that binary is
# unreliable (glibc mismatch in Docker; potential codegen differences
# when run directly). PRs only need to prove the code *compiles* and
# the Docker image *builds* — the authoritative runtime check runs on
# push to dev (ci-base SDK, always current).
- name: Compute image tag
id: tag
@@ -154,6 +172,12 @@ jobs:
- name: Touch HTML placeholder files
run: touch src/index.html src/about.html src/terms.html src/enterprise-terms.html
- name: Create soul-demo-image.tar placeholder
# Dockerfile.stage COPYs this file (used by k3s at runtime).
# We only need the COPY to succeed here; real tar is built by
# build-stage.sh in the deploy pipeline.
run: touch dist/soul-demo-image.tar
- name: Build Docker image (local only — no push)
run: |
set -euo pipefail
@@ -170,30 +194,27 @@ jobs:
.
- name: Local smoke test
# Push builds only: binary compiled from ci-base is current and
# compatible with the runner glibc. Skipped for pull_request events
# because the committed bin/elb may produce a binary that requires
# a newer glibc than what the runner environment provides.
if: github.event_name != 'pull_request'
run: |
set -euo pipefail
IMAGE="marketing:${{ steps.tag.outputs.tag }}"
docker run -d --name dev-smoke \
-p 8080:8080 \
-e PORT=8080 \
-e NODE_ENV=production \
-e LANDING_ROOT=/srv/landing \
"$IMAGE"
PORT=8080 dist/neuron-landing &
SERVER_PID=$!
for i in $(seq 1 15); do
STATUS=$(curl -sSo /dev/null -w "%{http_code}" --max-time 5 http://localhost:8080/ || echo "000")
echo "Attempt $i/15: HTTP $STATUS"
if [ "$STATUS" = "200" ]; then
echo "Dev smoke test PASSED"
docker stop dev-smoke && docker rm dev-smoke
kill "$SERVER_PID" 2>/dev/null || true
exit 0
fi
sleep 3
done
echo "--- container logs ---"
docker logs dev-smoke || true
docker stop dev-smoke && docker rm dev-smoke || true
kill "$SERVER_PID" 2>/dev/null || true
echo "Dev smoke test FAILED"
exit 1
+79 -12
View File
@@ -32,10 +32,16 @@ jobs:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Enforce dev-only source
# stage only accepts merges from dev. Any PR from another branch fails
# here before a single build step runs.
# workflow_dispatch is exempt (allows manual redeploy of current stage).
# Must run AFTER checkout — git commands require a cloned workspace.
if: github.event_name != 'workflow_dispatch'
run: |
set -euo pipefail
@@ -43,7 +49,17 @@ jobs:
echo "Merge commit: $COMMIT_MSG"
# Gitea merge commits: "Merge pull request '...' (#N) from dev into stage"
# Direct branch merges: "Merge branch 'dev' into stage"
if echo "$COMMIT_MSG" | grep -qE " from dev into stage$| 'dev' into stage$"; then
# tea pr merge with custom title: any subject line is possible, so
# fall back to checking git parents — if the second parent is on dev
# the merge came from dev regardless of the commit subject.
SECOND_PARENT=$(git log -1 --pretty=format:"%P" HEAD | awk '{print $2}')
FROM_DEV=""
if [ -n "$SECOND_PARENT" ]; then
if git merge-base --is-ancestor "$SECOND_PARENT" origin/dev 2>/dev/null; then
FROM_DEV=1
fi
fi
if echo "$COMMIT_MSG" | grep -qE " from dev into stage$| 'dev' into stage$" || [ -n "$FROM_DEV" ]; then
echo "Source branch check: OK (merged from dev)"
else
echo "ERROR: stage only accepts merges from dev."
@@ -51,11 +67,6 @@ jobs:
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Detect change type
id: changetype
run: |
@@ -85,6 +96,17 @@ jobs:
- name: Configure docker auth for Artifact Registry
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Prune Docker to reclaim disk
run: |
# Remove stopped containers, dangling images, unused volumes/networks.
# Do NOT prune build cache — that keeps Docker builds fast and under
# the ~26min runner restart window. Selective pruning frees ~4-5GB
# which is enough to prevent overlay2 "no space left on device" errors.
docker container prune -f 2>&1 || true
docker image prune -f 2>&1 || true
docker volume prune -f 2>&1 || true
df -h /
- name: Compute image tag
id: tag
run: |
@@ -106,14 +128,14 @@ jobs:
if: steps.changetype.outputs.asset_only != 'true'
run: |
set -euo pipefail
docker pull us-central1-docker.pkg.dev/neuron-785695/neuron-ci/ci-base:stage
CID=$(docker create us-central1-docker.pkg.dev/neuron-785695/neuron-ci/ci-base:stage)
docker pull us-central1-docker.pkg.dev/neuron-785695/neuron-ci/ci-base:dev
CID=$(docker create us-central1-docker.pkg.dev/neuron-785695/neuron-ci/ci-base:dev)
sudo mkdir -p /opt/el
docker cp "$CID:/opt/el" /opt/
docker rm "$CID"
echo "ELB=/opt/el/dist/bin/elb" >> "$GITHUB_ENV"
echo "ELC=/opt/el/dist/platform/elc" >> "$GITHUB_ENV"
echo "EL_RUNTIME=/opt/el/el-compiler/runtime" >> "$GITHUB_ENV"
echo "EL_RUNTIME=$GITHUB_WORKSPACE/runtime" >> "$GITHUB_ENV"
# ── Build neuron-web binary ───────────────────────────────────────────
@@ -132,25 +154,70 @@ jobs:
if: steps.changetype.outputs.asset_only != 'true'
run: |
set -euo pipefail
echo "ELC=$ELC"
echo "EL_RUNTIME=$EL_RUNTIME"
echo "el_runtime.js: $(ls -lh "$EL_RUNTIME/el_runtime.js" 2>&1)"
cp "$EL_RUNTIME/el_runtime.js" src/js/
mkdir -p dist/js
for f in src/js/*.el; do
[ -f "$f" ] || continue
name=$(basename "$f" .el)
"$ELC" --target=js --bundle --minify --obfuscate "$f" > "dist/js/${name}.js"
echo "Compiling $f..."
"$ELC" --target=js --bundle --minify --obfuscate "$f" > "dist/js/${name}.js" || {
echo "elc FAILED on $f"
exit 1
}
echo " compiled: $f -> dist/js/${name}.js"
done
rm -f src/js/el_runtime.js
# ── Docker build + push ───────────────────────────────────────────────
- name: Build soul-demo image tar
# Dockerfile.stage COPYs dist/soul-demo-image.tar so k3s can import
# soul-demo:local at runtime. We compile soul-demo from source on the
# host runner (ci-base has gcc), build a minimal OCI image, and save it.
# Moved AFTER JS compilation to avoid Docker memory pressure killing elc.
if: steps.changetype.outputs.asset_only != 'true'
run: |
set -euo pipefail
# Compile el_runtime.o and soul-demo on the host runner
cc -O2 -DHAVE_CURL -c runtime/el_runtime.c -I runtime/ -o /tmp/el_runtime.o
cc -O2 -rdynamic -DEL_SOUL_DEMO_BUILD \
-I runtime/ \
-o dist/soul-demo \
dist/soul-demo.c dist/vessel_stubs.c /tmp/el_runtime.o \
-lcurl -lpthread -ldl -lm -lssl -lcrypto
echo "soul-demo compiled: $(ls -lh dist/soul-demo)"
# Package as minimal OCI image for k3s import
# --no-cache: prevents reuse of corrupted overlay2 layers from prior failed runs
docker build --no-cache -f dist/Dockerfile.soul-demo -t soul-demo:local dist/
docker save soul-demo:local -o dist/soul-demo-image.tar
echo "soul-demo-image.tar: $(du -sh dist/soul-demo-image.tar | cut -f1)"
docker rmi soul-demo:local 2>/dev/null || true
- name: Download k3s binary
# Pre-download k3s on the host runner so Dockerfile.stage can COPY it
# directly. Previously k3s was downloaded inside the Docker builder stage,
# which combined with build-essential and C compilation caused RWLayer nil
# corruption on the runner's overlay2 driver. Host-runner download is safe.
if: steps.changetype.outputs.asset_only != 'true'
run: |
set -euo pipefail
curl -fL --retry 3 --retry-delay 10 \
https://github.com/k3s-io/k3s/releases/download/v1.32.4%2Bk3s1/k3s \
-o dist/k3s
chmod +x dist/k3s
echo "k3s: $(ls -lh dist/k3s)"
- name: Build and tag image
if: steps.changetype.outputs.asset_only != 'true'
run: |
set -euo pipefail
# --no-cache: prevents reuse of corrupted overlay2 layers from prior failed runs.
# Dockerfile.stage is now single-stage (no builder) so build is fast even without cache.
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from us-central1-docker.pkg.dev/neuron-785695/neuron-marketing/marketing:stage-latest \
--no-cache \
-f Dockerfile.stage \
-t "marketing:${{ steps.tag.outputs.tag }}" \
.
+10
View File
@@ -28,6 +28,16 @@ src/assets/js/
!dist/vessel_stubs.c
!dist/soul-demo.c
!dist/page_close.c
!dist/page_css.c
!dist/page_ga.c
!dist/page_schema.c
!dist/elhtml_impl.c
!dist/entrypoint.sh
!dist/engram-snapshot.json
!dist/Dockerfile.soul-demo
!dist/k3s-soul-demo.yaml
# Build artifacts produced by the soul-demo packaging step in build-stage.sh
dist/soul-demo
dist/soul-demo-snapshot.json
dist/soul-demo-image.tar
+30 -39
View File
@@ -4,44 +4,16 @@
# - neuron-web on port 8080 (landing page server)
# - soul-demo on port 7772 (demo chat, localhost only)
#
# neuron-web is built by `elb build` in CI (not here). elb compiles each
# .el source independently and links the result — no combined mega-file,
# no exponential memory growth. The binary lands at dist/neuron-landing
# (linux/amd64) and is COPY'd directly into the runtime image.
# All binaries (neuron-web, soul-demo, k3s) are pre-built by CI on the host
# runner before this Dockerfile runs. This keeps the Docker build single-stage
# with no compilation and no network downloads, eliminating the multi-stage
# complexity that caused RWLayer corruption on the runner's overlay2 driver.
#
# soul-demo.c is pre-committed (small, no OOM risk) and compiled here.
# CI pre-build steps (in stage.yaml):
# - neuron-web: built by `elb build` → dist/neuron-landing
# - soul-demo: compiled by cc on host → dist/soul-demo
# - k3s: downloaded by curl on host → dist/k3s
# ── Stage 1: compile soul-demo ────────────────────────────────────────────────
FROM debian:bookworm-slim AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libcurl4-openssl-dev \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY runtime/el_runtime.c runtime/el_runtime.h ./
# Pre-compile el_runtime as a separate cached layer.
# el_runtime.c changes rarely; main.c changes every run.
# Splitting this out means el_runtime.o is cached across builds when only main.c changes.
# -DHAVE_CURL: the staged el_runtime.c (from el.git) guards the OTLP observability
# section (emit_metric, emit_log, trace_span_*) behind #ifdef HAVE_CURL.
# libcurl IS installed above, so define HAVE_CURL to enable those functions.
RUN cc -O2 -DHAVE_CURL -c el_runtime.c -I. -o el_runtime.o
COPY dist/soul-demo.c dist/vessel_stubs.c ./
RUN cc -O2 -rdynamic \
-o soul-demo \
soul-demo.c vessel_stubs.c el_runtime.o \
-lcurl -lpthread -ldl -lm -lssl -lcrypto
# ── Stage 2: runtime image ────────────────────────────────────────────────────
FROM debian:bookworm-slim
RUN apt-get update \
@@ -53,13 +25,29 @@ RUN apt-get update \
&& groupadd -r landing && useradd -r -g landing landing \
&& mkdir -p /srv/landing/assets /srv/landing/js /srv/landing/shares \
&& mkdir -p /srv/soul/engram-demo \
&& chown -R landing:landing /srv/landing /srv/soul
&& chown -R landing:landing /srv/landing /srv/soul \
&& mkdir -p /var/lib/rancher/k3s /tmp/k3s \
&& chown -R landing:landing /var/lib/rancher /tmp/k3s
# neuron-web binary — produced by `elb build` in CI (linux/amd64)
COPY dist/neuron-landing /usr/local/bin/neuron-web
RUN chmod +x /usr/local/bin/neuron-web
COPY --from=builder /build/soul-demo /usr/local/bin/soul-demo
# soul-demo binary — compiled by cc on host runner in CI
COPY dist/soul-demo /usr/local/bin/soul-demo
RUN chmod +x /usr/local/bin/soul-demo
# k3s binary — downloaded from GitHub releases by CI
COPY dist/k3s /usr/local/bin/k3s
RUN chmod +x /usr/local/bin/k3s
# soul-demo OCI image tar — k3s imports this at startup (no registry needed)
RUN mkdir -p /var/lib/rancher/k3s/agent/images
COPY dist/soul-demo-image.tar /var/lib/rancher/k3s/agent/images/soul-demo.tar
# k3s manifests — auto-applied when k3s starts
RUN mkdir -p /var/lib/rancher/k3s/server/manifests
COPY dist/k3s-soul-demo.yaml /var/lib/rancher/k3s/server/manifests/soul-demo.yaml
# Engram snapshot — baked in so soul has memory from cold start
COPY dist/engram-snapshot.json /srv/soul/engram-demo/snapshot.json
@@ -83,8 +71,11 @@ ENV LANDING_ROOT=/srv/landing
ENV PORT=8080
ENV NEURON_HOME=/srv/soul/engram-demo
ENV NEURON_PORT=7772
ENV K3S_DATA_DIR=/var/lib/rancher/k3s
ENV KUBECONFIG=/var/lib/rancher/k3s/server/cred/admin.kubeconfig
USER landing
# k3s requires root to create network namespaces and mount cgroups.
# Cloud Run gen2 sandbox is the security boundary here.
EXPOSE 8080
CMD ["/usr/local/bin/entrypoint.sh"]
+18
View File
@@ -43,4 +43,22 @@ docker build \
-t "marketing:${TAG}" \
.
# Extract soul-demo binary and engram snapshot from built image
echo "==> Packaging soul-demo:local image for k3s..."
CONTAINER_ID=$(docker create "marketing:${TAG}")
docker cp "${CONTAINER_ID}:/usr/local/bin/soul-demo" dist/soul-demo
docker cp "${CONTAINER_ID}:/srv/soul/engram-demo/snapshot.json" dist/soul-demo-snapshot.json 2>/dev/null || true
docker rm "${CONTAINER_ID}"
# Build minimal soul-demo container image
cp dist/soul-demo-snapshot.json dist/engram-snapshot.json 2>/dev/null || true
docker build \
-f dist/Dockerfile.soul-demo \
-t soul-demo:local \
dist/
# Save as OCI tar for k3s to import at startup
docker save soul-demo:local -o dist/soul-demo-image.tar
echo "==> soul-demo:local image saved ($(du -sh dist/soul-demo-image.tar | cut -f1))"
echo "==> Done. marketing:${TAG} built."
+13
View File
@@ -0,0 +1,13 @@
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends libcurl4 libssl3 ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r landing && useradd -r -g landing landing \
&& mkdir -p /srv/soul/engram-demo \
&& chown -R landing:landing /srv/soul
COPY soul-demo /usr/local/bin/soul-demo
COPY engram-snapshot.json /srv/soul/engram-demo/snapshot.json
ENV NEURON_HOME=/srv/soul/engram-demo
ENV NEURON_PORT=7772
USER landing
CMD ["/usr/local/bin/soul-demo"]
+37 -15
View File
@@ -1,21 +1,43 @@
#!/usr/bin/env bash
# entrypoint.sh — Start soul-demo then neuron-web in the same container.
#
# soul-demo runs in the background on :7772 (localhost only, not exposed).
# neuron-web runs in the foreground on :8080 (Cloud Run health checks this).
# If neuron-web exits, the container exits. Soul crashing is non-fatal —
# chat will return "demo soul not responding" but the page stays up.
#!/bin/sh
set -e
set -euo pipefail
# SKIP_K3S=1 — bypass k3s/soul-demo startup and go straight to neuron-web.
# Used by the dev CI smoke test where the container runtime doesn't support
# the kernel capabilities k3s requires (overlayfs / privileged mode).
if [ "${SKIP_K3S:-0}" = "1" ]; then
echo "[entrypoint] SKIP_K3S=1: starting neuron-web directly (no k3s/soul-demo)."
exec /usr/local/bin/neuron-web
fi
echo "[entrypoint] starting soul-demo on :7772"
/usr/local/bin/soul-demo &
SOUL_PID=$!
echo "[entrypoint] Starting k3s server (embedded soul-demo orchestrator)..."
# Give the soul a few seconds to load its engram and seed safety nodes
sleep 4
# k3s server — single-node mode, disable unused components
# --disable traefik,servicelb: we don't need an ingress or LB
# --disable metrics-server: saves ~50MB RAM
# --write-kubeconfig-mode=644: allow non-root reads
# --data-dir: use the pre-chowned dir
k3s server \
--disable traefik \
--disable servicelb \
--disable metrics-server \
--write-kubeconfig-mode=644 \
--data-dir /var/lib/rancher/k3s \
--node-name soul-node &
echo "[entrypoint] soul-demo started (pid=$SOUL_PID)"
echo "[entrypoint] starting neuron-web on :${PORT:-8080}"
K3S_PID=$!
echo "[entrypoint] Waiting for k3s to become ready..."
until k3s kubectl get nodes --no-headers 2>/dev/null | grep -q "Ready"; do
sleep 2
done
echo "[entrypoint] k3s ready. soul-demo Deployment will be applied automatically from manifests."
# Wait for soul-demo pod to be Running before starting neuron-web
echo "[entrypoint] Waiting for soul-demo pod..."
until k3s kubectl get pods -l app=soul-demo --no-headers 2>/dev/null | grep -q "Running"; do
sleep 3
done
echo "[entrypoint] soul-demo is running."
echo "[entrypoint] Starting neuron-web on port ${PORT:-8080}..."
exec /usr/local/bin/neuron-web
+90
View File
@@ -0,0 +1,90 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: soul-demo
namespace: default
labels:
app: soul-demo
spec:
replicas: 1
selector:
matchLabels:
app: soul-demo
template:
metadata:
labels:
app: soul-demo
spec:
containers:
- name: soul-demo
image: soul-demo:local
imagePullPolicy: Never
ports:
- containerPort: 7772
env:
- name: NEURON_HOME
value: /srv/soul/engram-demo
- name: NEURON_PORT
value: "7772"
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 1000m
memory: 512Mi
livenessProbe:
httpGet:
path: /healthz
port: 7772
initialDelaySeconds: 10
periodSeconds: 15
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz
port: 7772
initialDelaySeconds: 5
periodSeconds: 10
volumeMounts:
- name: engram-data
mountPath: /srv/soul/engram-demo
volumes:
- name: engram-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: soul-demo
namespace: default
spec:
type: NodePort
selector:
app: soul-demo
ports:
- port: 7772
targetPort: 7772
nodePort: 7772
protocol: TCP
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: soul-demo
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: soul-demo
minReplicas: 1
maxReplicas: 8
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
+3 -3
View File
File diff suppressed because one or more lines are too long
+1827
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -0,0 +1,15 @@
#include <stdint.h>
#include <stdlib.h>
#include "el_runtime.h"
el_val_t page_ga_script(void);
el_val_t page_ga_script(void) {
return EL_STR("<script>\n"
" window.dataLayer = window.dataLayer || [];\n"
" function gtag(){dataLayer.push(arguments);}\n"
" gtag('js', new Date());\n"
" gtag('config', 'G-Y1EE43X9RN');\n"
" gtag('config', 'AW-18140150015');\n"
" </script>");
}
+110
View File
@@ -0,0 +1,110 @@
#include <stdint.h>
#include <stdlib.h>
#include "el_runtime.h"
el_val_t page_schema(void);
el_val_t page_schema(void) {
return EL_STR("<script type=\"application/ld+json\">\n"
" {\n"
" \"@context\": \"https://schema.org\",\n"
" \"@graph\": [\n"
" {\n"
" \"@type\": \"Organization\",\n"
" \"name\": \"Neuron, LLC\",\n"
" \"url\": \"https://neurontechnologies.ai\",\n"
" \"founder\": {\n"
" \"@type\": \"Person\",\n"
" \"name\": \"Will Anderson\",\n"
" \"jobTitle\": \"Founder\"\n"
" },\n"
" \"description\": \"Neuron builds AI that runs on your machine, builds a memory over time, and gets sharper the longer you use it. One builder. Built different.\",\n"
" \"foundingDate\": \"2026\",\n"
" \"sameAs\": [\"https://github.com/neuron-technologies\"]\n"
" },\n"
" {\n"
" \"@type\": \"SoftwareApplication\",\n"
" \"name\": \"Neuron\",\n"
" \"applicationCategory\": \"AIApplication\",\n"
" \"operatingSystem\": \"macOS, Windows, Linux\",\n"
" \"offers\": [\n"
" {\n"
" \"@type\": \"Offer\",\n"
" \"name\": \"Free\",\n"
" \"price\": \"0\",\n"
" \"priceCurrency\": \"USD\"\n"
" },\n"
" {\n"
" \"@type\": \"Offer\",\n"
" \"name\": \"Professional\",\n"
" \"price\": \"19\",\n"
" \"priceCurrency\": \"USD\",\n"
" \"billingIncrement\": \"monthly\"\n"
" },\n"
" {\n"
" \"@type\": \"Offer\",\n"
" \"name\": \"Founding Member\",\n"
" \"description\": \"Lifetime access for the first 1,000 members.\",\n"
" \"price\": \"199\",\n"
" \"priceCurrency\": \"USD\"\n"
" }\n"
" ],\n"
" \"description\": \"The AI that remembers you. Runs locally on your machine. Builds a persistent memory over every conversation. Gets sharper the longer you use it. Your data never leaves your device.\",\n"
" \"featureList\": [\n"
" \"Persistent memory — runs locally, never resets\",\n"
" \"Bring your own API keys (OpenAI, Anthropic, Grok)\",\n"
" \"Local inference via Ollama — coming, offline, zero cloud\",\n"
" \"Neuron Inference coming soon — priced below major APIs\",\n"
" \"Two devices included per plan\",\n"
" \"Enterprise deployment — Q1 2027\"\n"
" ]\n"
" },\n"
" {\n"
" \"@type\": \"FAQPage\",\n"
" \"mainEntity\": [\n"
" {\n"
" \"@type\": \"Question\",\n"
" \"name\": \"What is Neuron?\",\n"
" \"acceptedAnswer\": {\n"
" \"@type\": \"Answer\",\n"
" \"text\": \"Neuron is an AI that runs on your machine and builds a persistent memory over time. Every other AI forgets you when you close the tab. Neuron doesn&#39;t. The longer you use it, the less you have to explain.\"\n"
" }\n"
" },\n"
" {\n"
" \"@type\": \"Question\",\n"
" \"name\": \"Does Neuron send my data to the cloud?\",\n"
" \"acceptedAnswer\": {\n"
" \"@type\": \"Answer\",\n"
" \"text\": \"No. Your memory lives on your machine and never leaves it. Neuron does not collect your data, train on your conversations, or require cloud storage. For inference you choose: local via Ollama, your own API keys, or Neuron Inference (coming soon).\"\n"
" }\n"
" },\n"
" {\n"
" \"@type\": \"Question\",\n"
" \"name\": \"How much does Neuron cost?\",\n"
" \"acceptedAnswer\": {\n"
" \"@type\": \"Answer\",\n"
" \"text\": \"Neuron has a free tier that never expires. Professional is $19/month. Founding Member is $199 lifetime — available to the first 1,000 members only. All plans include two devices.\"\n"
" }\n"
" },\n"
" {\n"
" \"@type\": \"Question\",\n"
" \"name\": \"Who built Neuron?\",\n"
" \"acceptedAnswer\": {\n"
" \"@type\": \"Answer\",\n"
" \"text\": \"Will Anderson. On April 22nd, 2026 he had a meeting with one of the largest technology companies in the world. Within two days their lawyers were engaged. He decided to build it himself. On April 25th he published the proof.\"\n"
" }\n"
" },\n"
" {\n"
" \"@type\": \"Question\",\n"
" \"name\": \"When does Neuron launch?\",\n"
" \"acceptedAnswer\": {\n"
" \"@type\": \"Answer\",\n"
" \"text\": \"Neuron is available for preorder now. Enterprise deployment launches Q1 2027.\"\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" ]\n"
" }\n"
" </script>");
}
+3
View File
@@ -13,4 +13,7 @@ build {
c_source "dist/vessel_stubs.c"
c_source "dist/elhtml_impl.c"
c_source "dist/page_close.c"
c_source "dist/page_css.c"
c_source "dist/page_ga.c"
c_source "dist/page_schema.c"
}
+26
View File
@@ -878,6 +878,32 @@ el_val_t __uuid_v4(void);
/* Args */
el_val_t __args_json(void);
/* ── neuron-web stubs (web_stubs.c) ──────────────────────────────────────────
* Forward declarations so generated C (e.g. dist/main.c) sees the correct
* el_val_t return type instead of an implicit int. Without these, the
* ci-base elb (which does not emit extern-fn forward decls for stub-only
* functions) produces truncated 32-bit returns on 64-bit Linux → segfault.
*
* Guarded by EL_SOUL_DEMO_BUILD: soul-demo.c includes this header but
* defines its own (different-arity) versions of some of these functions.
* Dockerfile.stage compiles soul-demo with -DEL_SOUL_DEMO_BUILD to skip
* this block and avoid conflicting-types errors.
*/
#ifndef EL_SOUL_DEMO_BUILD
el_val_t http_get_auth(el_val_t url, el_val_t tok);
el_val_t http_post_auth(el_val_t url, el_val_t tok, el_val_t body);
el_val_t http_post_auth_json(el_val_t url, el_val_t tok, el_val_t body);
el_val_t http_delete_auth(el_val_t url, el_val_t bearer_tok, el_val_t apikey);
el_val_t supabase_get(el_val_t project_url, el_val_t service_key, el_val_t table_and_query);
el_val_t supabase_insert(el_val_t project_url, el_val_t service_key, el_val_t table, el_val_t row_json);
el_val_t supabase_auth_user(el_val_t project_url, el_val_t anon_key, el_val_t user_jwt);
el_val_t supabase_admin_invite(el_val_t project_url, el_val_t service_key, el_val_t body_json);
el_val_t gcs_write(el_val_t bucket, el_val_t object_name, el_val_t content);
el_val_t gcs_read(el_val_t bucket, el_val_t object_name);
el_val_t cwd(void);
el_val_t color_bold(el_val_t s);
#endif /* EL_SOUL_DEMO_BUILD */
#ifdef __cplusplus
}
#endif
+52 -2017
View File
File diff suppressed because it is too large Load Diff