# Ladill Link — deployment Ladill Link is the platform URL shortener. Public short URLs live on **ladl.link**; the management app runs at **link.ladill.com**. ## Domains | Host | Purpose | |------|---------| | `ladl.link` | Public short-link resolution (`/{slug}`) | | `link.ladill.com` | SSO management UI (create/edit links) | Both vhosts point at the same Laravel app. Set `LINK_PUBLIC_DOMAIN=ladl.link` in `.env`. ## Pricing GHS **0.05** per link created (`LINK_PRICE_PER_LINK_GHS`). Debited from the central UserWallet via the Billing API. ## Platform onboarding From the monolith: ```bash php artisan ladill:onboard-app link --run-dns php artisan ladill:launcher:sync --propagate --push ``` Register the Passport OIDC client: ```bash php artisan passport:client \ --name="Ladill Link" \ --redirect_uri="https://link.ladill.com/sso/callback" ``` Set `BILLING_API_KEY_LINK` and `IDENTITY_API_KEY_LINK` on both monolith and this app. Grant read access to platform AI settings: ```bash sudo mysql -e "GRANT SELECT ON ladilldb.platform_settings TO 'ladill_link'@'127.0.0.1'; FLUSH PRIVILEGES;" ``` Afia reads `ai_*` keys from `platform_settings` (same as ladill.com admin). Optional `AFIA_API_KEY` in `.env` overrides for local dev. ## Legacy URLs `https://ladill.com/q/{code}` continues to work for existing QR and storefront codes. New links use `https://ladl.link/{code}`. Unknown slugs on ladl.link fall back to the legacy resolver. ## Database ```bash php artisan migrate --force ``` Database name: `ladill_link`. ## Country analytics (GeoIP) Click countries are resolved from CDN headers when present (`CF-IPCountry`, etc.), then from the visitor IP using a local MaxMind GeoLite2 Country database. 1. Create a free MaxMind account and generate a license key. 2. Set in `.env`: ```env MAXMIND_ACCOUNT_ID= MAXMIND_LICENSE_KEY= ``` 3. Download the database: ```bash php artisan config:clear php artisan link:geoip-update php artisan config:cache ``` On the server, edit **`/var/www/ladill-link/shared/.env`** (not a release copy). After deploy, `current/.env` symlinks to that file. If you add env vars while config is cached, run `config:clear` before `link:geoip-update` or Laravel will not see the new values. The file is stored at `storage/app/geoip/GeoLite2-Country.mmdb` by default. The command is scheduled weekly via the app scheduler — ensure cron runs `php artisan schedule:run` for link.ladill.com.