mirror of
git://f0xx.org/android_cast
synced 2026-07-29 05:17:39 +03:00
Graphs dashboard: role-scoped metrics, orchestration, and smoke tests.
Extend graph_sessions schema and GraphRepository dashboards (user/slug/platform), wire nginx/orchestration routes, fix gmdate timestamps, and add API smoke script. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -110,19 +110,25 @@ return [
|
||||
];
|
||||
EOF
|
||||
|
||||
SRC_MIG_070="$ROOT_DIR/runtime/db-init/070_graph_ecosystem.sql"
|
||||
|
||||
write_migration_with_db() {
|
||||
local src="$1"
|
||||
local dest="$2"
|
||||
local tmp
|
||||
tmp="$(mktemp)"
|
||||
{
|
||||
echo "USE \`${MARIADB_DATABASE}\`;"
|
||||
cat "$src"
|
||||
} >"$tmp"
|
||||
mv "$tmp" "$dest"
|
||||
}
|
||||
|
||||
cp "$SRC_SCHEMA" "$DB_INIT_DIR/010_schema.sql"
|
||||
{
|
||||
echo "USE \`${MARIADB_DATABASE}\`;"
|
||||
cat "$SRC_MIG_004"
|
||||
} >"$DB_INIT_DIR/040_ticket_workflow.sql"
|
||||
{
|
||||
echo "USE \`${MARIADB_DATABASE}\`;"
|
||||
cat "$SRC_MIG_005"
|
||||
} >"$DB_INIT_DIR/050_ticket_attachments.sql"
|
||||
{
|
||||
echo "USE \`${MARIADB_DATABASE}\`;"
|
||||
cat "$SRC_MIG_060"
|
||||
} >"$DB_INIT_DIR/060_build_ecosystem.sql"
|
||||
write_migration_with_db "$SRC_MIG_004" "$DB_INIT_DIR/040_ticket_workflow.sql"
|
||||
write_migration_with_db "$SRC_MIG_005" "$DB_INIT_DIR/050_ticket_attachments.sql"
|
||||
write_migration_with_db "$SRC_MIG_060" "$DB_INIT_DIR/060_build_ecosystem.sql"
|
||||
write_migration_with_db "$SRC_MIG_070" "$DB_INIT_DIR/070_graph_ecosystem.sql"
|
||||
|
||||
echo "Pulling images..."
|
||||
docker compose -f "$ROOT_DIR/docker-compose.yml" pull landing-fe gitea-fe crashes-fe build-fe mariadb gitea || true
|
||||
@@ -135,6 +141,7 @@ echo "Stack is up."
|
||||
echo "Landing: ${PUBLIC_BASE_URL}/app/androidcast_project/"
|
||||
echo "Gitea (direct FE): http://localhost:${GITEA_FE_PORT}/app/androidcast_project/git/"
|
||||
echo "Crashes (direct FE): http://localhost:${CRASHES_FE_PORT}/app/androidcast_project/crashes/"
|
||||
echo "Graphs (via landing): ${PUBLIC_BASE_URL}/app/androidcast_project/graphs/"
|
||||
echo "Builder (direct FE): http://localhost:${BUILD_FE_PORT:-8083}/app/androidcast_project/build/"
|
||||
echo "Shared login: same user/password as Crashes (session cookie path /app/androidcast_project)"
|
||||
echo
|
||||
|
||||
@@ -9,6 +9,43 @@ server {
|
||||
return 302 /app/androidcast_project/crashes/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/graphs {
|
||||
return 302 /app/androidcast_project/graphs/;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/graphs/assets/ {
|
||||
alias /workspace/examples/crash_reporter/backend/public/assets/;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/graphs/api/graphs.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /workspace/examples/crash_reporter/backend/public/api/graphs.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/api/graphs.php;
|
||||
fastcgi_param DOCUMENT_ROOT /workspace/examples/crash_reporter/backend/public;
|
||||
fastcgi_pass crash-php:9000;
|
||||
fastcgi_read_timeout 120s;
|
||||
}
|
||||
|
||||
location = /app/androidcast_project/graphs/api/graph_upload.php {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /workspace/examples/crash_reporter/backend/public/api/graph_upload.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/api/graph_upload.php;
|
||||
fastcgi_param DOCUMENT_ROOT /workspace/examples/crash_reporter/backend/public;
|
||||
fastcgi_pass crash-php:9000;
|
||||
client_max_body_size 4m;
|
||||
fastcgi_read_timeout 120s;
|
||||
}
|
||||
|
||||
location ^~ /app/androidcast_project/graphs/ {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /workspace/examples/crash_reporter/backend/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/index.php;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_ROOT /workspace/examples/crash_reporter/backend/public;
|
||||
fastcgi_pass crash-php:9000;
|
||||
fastcgi_read_timeout 120s;
|
||||
}
|
||||
|
||||
location /app/androidcast_project/crashes/ {
|
||||
alias /workspace/examples/crash_reporter/backend/public/;
|
||||
index index.php;
|
||||
|
||||
@@ -21,6 +21,15 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /app/androidcast_project/graphs/ {
|
||||
proxy_pass http://crashes-fe:8080;
|
||||
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/build/ {
|
||||
proxy_pass http://build-fe:8080;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
USE `androidcast_crashes`;
|
||||
CREATE TABLE IF NOT EXISTS builds (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
build_code VARCHAR(64) NOT NULL,
|
||||
|
||||
28
orchestration/runtime/db-init/070_graph_ecosystem.sql
Normal file
28
orchestration/runtime/db-init/070_graph_ecosystem.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
USE `androidcast_crashes`;
|
||||
CREATE TABLE IF NOT EXISTS graph_sessions (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
session_id VARCHAR(96) NOT NULL,
|
||||
company_id INT UNSIGNED NOT NULL DEFAULT 1,
|
||||
user_id INT UNSIGNED NULL,
|
||||
device_id VARCHAR(128) NULL,
|
||||
app_version VARCHAR(64) NULL,
|
||||
sdk_int INT NULL,
|
||||
started_at_ms BIGINT NOT NULL,
|
||||
ended_at_ms BIGINT NOT NULL,
|
||||
duration_s INT NOT NULL,
|
||||
completed TINYINT(1) NOT NULL DEFAULT 1,
|
||||
direction ENUM('sender','receiver') NOT NULL DEFAULT 'sender',
|
||||
transport VARCHAR(24) NOT NULL DEFAULT 'wifi',
|
||||
avg_kbps INT NOT NULL DEFAULT 0,
|
||||
recv_kbps INT NOT NULL DEFAULT 0,
|
||||
packet_loss_pct DECIMAL(6,3) NOT NULL DEFAULT 0.0,
|
||||
ntp_source VARCHAR(32) NOT NULL DEFAULT 'device',
|
||||
ntp_correction_s INT NULL,
|
||||
install_source VARCHAR(32) NOT NULL DEFAULT 'direct',
|
||||
meta_json LONGTEXT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uq_graph_session_id (session_id),
|
||||
KEY idx_graph_company_time (company_id, started_at_ms),
|
||||
KEY idx_graph_device (device_id),
|
||||
KEY idx_graph_app_version (app_version)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Reference in New Issue
Block a user