diff --git a/docs/INFRA.md b/docs/INFRA.md index 7ff0239..faf251a 100644 --- a/docs/INFRA.md +++ b/docs/INFRA.md @@ -71,6 +71,7 @@ Correct public path for hub: |-----|-----------| | `https://apps.f0xx.org/app/androidcast_project/` | Static hub (`examples/app_hub/index.html`) | | `https://apps.f0xx.org/app/androidcast_project/crashes/` | PHP crash + tickets console | +| `https://apps.f0xx.org/app/androidcast_project/build/` | PHP APK builder console | | `https://apps.f0xx.org/app/androidcast_project/crashes/api/upload.php` | Device crash upload (no session) | Legacy hostname **`f0xx.org`** may still appear in app `settings.json` examples; production ingest/scripts prefer **`apps.f0xx.org`**. @@ -99,7 +100,9 @@ Web root prefix: | File | Purpose | |------|---------| -| **`examples/crash_reporter/backend/nginx.apps-port80.fragment`** | **Replace** BE `server { listen 80; ... }` — hub + crashes + assets | +| **`examples/crash_reporter/backend/nginx.apps-port80.fragment`** | **Replace** BE `server { listen 80; ... }` — hub + crashes + build | +| `examples/crash_reporter/backend/nginx.apps-builder.frag` | Build-only blocks (also included on BE 443 via `apps_builder.frag`) | +| `examples/crash_reporter/backend/nginx.fe-apps.f0xx.org.snippet` | FE hub/crashes → `http://artc0:80` (preserve URI) | | `examples/crash_reporter/backend/nginx.apps.conf.fragment` | Reference blocks (443-oriented comments) | | `examples/crash_reporter/backend/nginx.vm.conf` | Full VM example | diff --git a/examples/app_hub/DEPLOY.md b/examples/app_hub/DEPLOY.md index fcee911..fcbef9f 100644 --- a/examples/app_hub/DEPLOY.md +++ b/examples/app_hub/DEPLOY.md @@ -40,9 +40,19 @@ Replace the whole **`server { listen 80; ... }`** block with: **`examples/crash_reporter/backend/nginx.apps-port80.fragment`** -That file has hub + crashes + assets on **port 80**. +That file has hub + crashes + build on **port 80**. -The **`listen 443 ssl`** block can stay for direct HTTPS to the VM if you use it internally; public traffic from FE never needs it for this app. +Or run (from repo, with write access to the mount): + +```bash +sudo ./examples/crash_reporter/backend/scripts/apply-be-port80-nginx.sh +``` + +**FE** (`tmp/FE_gentoo/etc/nginx/nginx.conf`): hub and crashes must use +`proxy_pass http://artc0.intra.raptor.org:80;` **without** a trailing slash or path suffix. +See **`nginx.fe-apps.f0xx.org.snippet`**. + +The **`listen 443 ssl`** block can stay for direct HTTPS to the VM if you use it internally; public traffic from FE should prefer **:80** for one consistent vhost. Use prefix location for the hub (not `alias` to a single file): diff --git a/examples/build_console/backend/src/bootstrap.php b/examples/build_console/backend/src/bootstrap.php index 676269f..73fa5aa 100644 --- a/examples/build_console/backend/src/bootstrap.php +++ b/examples/build_console/backend/src/bootstrap.php @@ -1,9 +1,10 @@ &2 + exit 1 +fi +python3 - "$FRAG" "$APPS_CONF" << 'PY' +import sys +from pathlib import Path +frag, apps_path = map(Path, sys.argv[1:3]) +text = apps_path.read_text() +start = text.index("server {\n\tlisten 80;") +end = text.index("\n}\n\n\nserver {\n\tlisten 443") +apps_path.write_text(text[:start] + frag.read_text().strip() + text[end:]) +print(f"Updated listen 80 in {apps_path}") +PY diff --git a/examples/crash_reporter/backend/scripts/deploy-to-be-mount.sh b/examples/crash_reporter/backend/scripts/deploy-to-be-mount.sh index 1888d3c..ac3939f 100755 --- a/examples/crash_reporter/backend/scripts/deploy-to-be-mount.sh +++ b/examples/crash_reporter/backend/scripts/deploy-to-be-mount.sh @@ -3,6 +3,8 @@ # Usage: ./scripts/deploy-to-be-mount.sh [DEST] set -euo pipefail SRC="$(cd "$(dirname "$0")/.." && pwd)" +REPO_EXAMPLES="$(cd "$SRC/../.." && pwd)" +BE_ROOT="${BE_ROOT:-$(cd "$REPO_EXAMPLES/../../tmp/BE_alpine/var/www/localhost/htdocs/apps/app/androidcast_project/android_cast" 2>/dev/null && pwd || true)}" DEST="${1:-$(cd "$SRC/../../../tmp/BE_alpine/var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend" 2>/dev/null && pwd || true)}" if [[ -z "$DEST" || ! -d "$DEST" ]]; then echo "DEST not found. Pass BE mount path as first argument." >&2 @@ -11,4 +13,9 @@ fi rsync -a --no-group --no-owner \ --exclude 'data/' --exclude 'config/config.php' \ "$SRC/" "$DEST/" +if [[ -n "$BE_ROOT" && -d "$BE_ROOT" ]]; then + rsync -a --no-group --no-owner \ + "$REPO_EXAMPLES/platform/" "$BE_ROOT/examples/platform/" + echo "Synced platform/ to $BE_ROOT/examples/platform/" +fi echo "Synced to $DEST (config.php and data/ untouched)." diff --git a/examples/crash_reporter/backend/src/bootstrap.php b/examples/crash_reporter/backend/src/bootstrap.php index d3cf85c..1b068f2 100644 --- a/examples/crash_reporter/backend/src/bootstrap.php +++ b/examples/crash_reporter/backend/src/bootstrap.php @@ -12,7 +12,7 @@ */ declare(strict_types=1); -require_once dirname(__DIR__, 2) . '/platform/shared_session.php'; +require_once dirname(__DIR__, 3) . '/platform/shared_session.php'; if (!function_exists('session_start')) { http_response_code(500);