# Notifier Migration Context

Generated: 2026-06-12

This folder documents the current production Notifier installation so it can be moved to another server without losing behavior, data, scheduler safety, or operational guardrails.

## Current Production Facts

- App path: `/workspace/notifier`
- Public URL: `https://www.tonki.dev/notifier/`
- API base: `https://www.tonki.dev/notifier/api`
- Runtime: PHP 8.3 FPM behind nginx
- Database: SQLite at `/workspace/notifier/database.sqlite`
- Uploads: `/workspace/notifier/uploads`
- Cron user: `agent`
- Scheduler lock file: `/tmp/notifier.lock`
- Display timezone: `America/Mexico_City`
- Active cron:
  - every minute: `/usr/bin/php /workspace/notifier/scheduler.php >> /workspace/notifier/logs/scheduler.log 2>&1`
  - every 10 minutes: `/workspace/notifier/scripts/cron-health-check.sh >> /workspace/notifier/logs/cron-health.log 2>&1`

## What Must Be Preserved

The ZIP package should be treated as sensitive because it includes `config.php`, `database.sqlite`, uploads, and notification setup assets.

Must preserve:

- `config.php`: Telegram, UI auth, API token, MailerSend, paths, scheduler settings.
- `database.sqlite`: all notification definitions, jobs, history, recurrence state, health state.
- `uploads/`: images referenced by active notifications and follow-ups.
- `notifications-setup/`: source/context assets used to create notification sets.
- `migrations/`: schema history and reproducibility.
- `scripts/cron-health-check.*`: health guardrail.
- `scheduler.php`, `src/services/*`: scheduler and delivery logic.
- nginx `/notifier/api` and `/notifier/` routing behavior.
- cron entries above.

## Current Data Inventory

SQLite table counts at audit time:

- `notifications`: 68
- `notification_recurrence`: 58
- `notification_dates`: 35
- `notification_subsequents`: 138
- `send_jobs`: 469
- `notification_history`: 306
- `categories`: 7
- `scheduler_state`: 1
- `bot_state`: 1
- `schema_migrations`: 6

Scheduler status at audit time:

- Lock held: no
- Jobs: cancelled 155, failed 4, pending 4, sent 306
- Pending work ready now: 0
- Stuck jobs to reset: 0

Categories:

- Relevant
- Amazing
- Servers
- Mascotas
- Vehiculos
- Pagos
- Propiedades

## Package Contents

The migration ZIP should include the full `/workspace/notifier` folder, including this context folder.

Because the ZIP contains secrets and personal scheduling data, do not publish it casually. Download it, move it directly to the new server, and then rotate tokens/passwords if the package was exposed.
