1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 03:57:50 +03:00
Files
android_cast/backend/url-shortener/DEPLOY.md
Anton Afanasyeu fef93d7cdc BE sync
2026-06-11 22:45:47 +02:00

1.7 KiB

URL shortener — deploy (FE → BE)

Topology: same as INFRA.md — TLS on Gentoo FE, app on Alpine BE :80.

Prerequisites

Item Status
DNS s.f0xx.org → FE Done
FE TLS + BE nginx Done
MariaDB url_shortener Done
DB user androidcast (same password as crashes config.php)

Sync to BE

# From dev machine (example — adjust paths)
rsync -av backend/url-shortener/ alpine-be:/var/www/localhost/htdocs/apps/s/

# On BE
cp /var/www/localhost/htdocs/apps/s/config/config.example.php \
   /var/www/localhost/htdocs/apps/s/config/config.php
# set db.mysql.password = same as crash reporter

apk add libqrencode-tools   # QR PNG (/api/v1/qr/…)
rc-service php-fpm81 restart

MariaDB (one-time)

mysql -u root -p < sql/schema.mariadb.sql
./scripts/init-mariadb-grants.sh
php scripts/seed_bearer.php --label=prod   # save printed bearer token

Optional cron (purge expired links + audit >90d):

0 4 * * * php81 /var/www/localhost/htdocs/apps/s/scripts/purge_url_shortener.php

FE (Gentoo)

See deploy/nginx.fe-s.f0xx.org.snippet — full URI → BE :80.

BE nginx

See deploy/nginx.be-url-shortener.fragment.

Quoted regex required: location ~ "^/[a-f0-9]{6,16}$"

Verify

curl -fsS https://s.f0xx.org/api/v1/health
export BEARER='…' ./scripts/smoke_shorten.sh
./scripts/demo_curl.sh
examples/crash_reporter/backend/scripts/validate_be_services.sh

Config

config/config.example.php — prefer socket /run/mysqld/mysqld.sock on Alpine (same as crashes when TCP refused).