mirror of
git://f0xx.org/ac/ac-ms-url-shortener
synced 2026-07-29 01:19:38 +03:00
2.4 KiB
2.4 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
config/config.php is gitignored — rsync or submodule checkout does not restore it.
# From dev machine (example — adjust paths)
rsync -av backend/url-shortener/ alpine-be:/var/www/localhost/htdocs/apps/s/
# On BE — restore prod config from crashes DB credentials (idempotent):
cd /var/www/.../androidcast_project/android_cast
php81 examples/crash_reporter/backend/scripts/ensure_url_shortener_prod_config.php
apk add libqrencode-tools # QR PNG (/api/v1/qr/…)
rc-service php-fpm81 restart
Manual fallback: copy config.example.php → config.php and set db.mysql.password = same as crash reporter (chmod 644 so php-fpm/nginx can read).
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
Hub admin (Short links card)
Operator UI lives in the crashes console (shared ac_crash_sess), not on s.f0xx.org:
https://apps.f0xx.org/app/androidcast_project/crashes/?view=short_links- Enable in crashes
config.php:url_shortener.enabled => true+ MariaDBurl_shortenerblock (seeexamples/crash_reporter/backend/config/config.example.php) - Smoke:
examples/crash_reporter/backend/scripts/test_short_links_api.sh
Config
config/config.example.php — prefer socket /run/mysqld/mysqld.sock on Alpine (same as crashes when TCP refused).