mirror of
git://f0xx.org/android_cast
synced 2026-07-29 05:58:14 +03:00
snip
This commit is contained in:
@@ -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):
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 2) . '/platform/shared_session.php';
|
||||
$examplesRoot = dirname(__DIR__, 3);
|
||||
require_once $examplesRoot . '/platform/shared_session.php';
|
||||
|
||||
$crashSrc = dirname(__DIR__, 2) . '/crash_reporter/backend/src';
|
||||
$crashSrc = $examplesRoot . '/crash_reporter/backend/src';
|
||||
$configPath = __DIR__ . '/../config/config.php';
|
||||
if (!is_file($configPath)) {
|
||||
$configPath = __DIR__ . '/../config/config.example.php';
|
||||
|
||||
17
examples/crash_reporter/backend/nginx.apps-builder.frag
Normal file
17
examples/crash_reporter/backend/nginx.apps-builder.frag
Normal file
@@ -0,0 +1,17 @@
|
||||
location = /app/androidcast_project/build {
|
||||
return 301 /app/androidcast_project/build/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/build/assets/ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/build_console/backend/public/assets/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/build/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/build_console/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/build/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 512m;
|
||||
fastcgi_read_timeout 1800s;
|
||||
}
|
||||
@@ -40,6 +40,24 @@ server {
|
||||
client_max_body_size 4m;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/build {
|
||||
return 301 /app/androidcast_project/build/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/build/assets/ {
|
||||
alias /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/build_console/backend/public/assets/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/build/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/build_console/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/build/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
client_max_body_size 512m;
|
||||
fastcgi_read_timeout 1800s;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include /etc/nginx/fastcgi.conf;
|
||||
fastcgi_pass unix:/run/php-fpm.socket;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# FE apps.f0xx.org — replace hub/crashes upstream blocks (use BE port 80, preserve URI).
|
||||
# File: tmp/FE_gentoo/etc/nginx/nginx.conf (inside server { listen 443; server_name apps.f0xx.org; })
|
||||
|
||||
location /app/androidcast_project/ {
|
||||
proxy_pass http://artc0.intra.raptor.org:80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /app/androidcast_project/crashes/ {
|
||||
proxy_pass http://artc0.intra.raptor.org:80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# apps.conf build block must stay:
|
||||
# proxy_pass http://artc0.intra.raptor.org:80; (no trailing slash)
|
||||
21
examples/crash_reporter/backend/scripts/apply-be-port80-nginx.sh
Executable file
21
examples/crash_reporter/backend/scripts/apply-be-port80-nginx.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Replace BE apps.conf listen-80 block from repo fragment (run on machine with BE mount write access).
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
|
||||
REPO_ROOT="$(cd "$ROOT/../.." && pwd)"
|
||||
FRAG="$ROOT/crash_reporter/backend/nginx.apps-port80.fragment"
|
||||
APPS_CONF="${1:-$REPO_ROOT/tmp/BE_alpine/etc/nginx/conf.d/apps.conf}"
|
||||
if [[ ! -f "$FRAG" || ! -f "$APPS_CONF" ]]; then
|
||||
echo "Usage: $0 [path/to/apps.conf]" >&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
|
||||
@@ -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)."
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user