Commit Graph
13 Commits
Author SHA1 Message Date
mohmdsdgandCursor 82f63d224e fix(replicas): reach publisher via unix socket or sudo postgres
TCP 127.0.0.1:15432 is often closed; the cluster listens on a unix
socket. Fall back to /var/run/postgresql then runuser -u postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:59:45 +03:30
mohmdsdgandCursor 1cc5e09b5f fix(replicas): parse Prisma DATABASE_URL and dump tables by name
Passwords with @ broke libpq URIs; convert to keyword conninfo.
pg_dump -t public."table" produced empty dumps so replicas stayed at 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:55:39 +03:30
mohmdsdgandCursor 26630cecf6 fix(replicas): use PUBLISHER_DSN when DATABASE_URL breaks pg_dump
Prisma DATABASE_URL passwords with @ confuse libpq URI parsing (host
Montime@127.0.0.1). Repair scripts now prefer explicit PUBLISHER_DSN.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:41:23 +03:30
mohmdsdgandCursor 693b1ef93e fix(replicas): do not flock on manual repair-data
Operator --repair was blocked when pm2 watch owned /tmp lock file.
Only --repair-if-needed uses flock; lock path moved under deploy/.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:39:45 +03:30
mohmdsdgandCursor 16d562caa5 feat(replicas): auto-heal slave data drift and no-store public settings
Add sync-replica-data repair on deploy, a publisher-side replica watch
(60s + after tenant/settings writes), REFRESH PUBLICATION after migrate,
and Cache-Control no-store on program-settings and get_version.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:32:30 +03:30
mohmdsdgandCursor d57ce0a3cb feat(settings): store Khanegi keys in settings tables instead of tenant JSON
Template defaults seed from deploy_settings_const; new tenants copy them, import decides per key, and /get_settings reads the per-tenant rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 20:14:17 +03:30
mohmdsdgandCursor 25c0a4e941 fix(api): allow nest build of program-settings and cleaner replica --check
Cast stored JSON through asSettingsArray so tsc accepts the snapshot payload, and strip Prisma ?schema= from DATABASE_URL before psql.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 16:01:55 +03:30
mohmdsdgandCursor 515e39d420 feat(deploy): sync schema to replication subscribers before migrating
Logical replication carries rows but not DDL, so a migration that adds a
column stalls every subscriber with "missing replicated columns" until the
column exists there too. _prisma_migrations is replicated, so migrate deploy
on a subscriber reports nothing pending while its tables lag behind.

sync-replica-schema.sh applies pending migrations to each subscriber first,
tracking them locally in _replica_ddl_applied, then migrates the publisher.
--check reports subscription state and columns missing on any replica.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 21:34:02 +03:30
MahdiandCursor be50c99f65 feat: public GET /manifest.json from tenant branding
Serve PWA/APK web manifest per domain (name, theme colors, multi-size icons from avatar), exclude from api prefix, and proxy via nginx.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-09 15:41:50 +03:30
MahdiandCursor 039a2a606b Fix SMS batch apply dry-run env and add rollout tracker.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 15:34:45 +03:30
MahdiandCursor 448dc444c9 Add Khanegi SMS sync inventory, batch import, and rollout helpers.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 15:30:43 +03:30
Mahdi 0a08cdb7ca Edit dist/src/main.js 2026-07-30 20:53:53 +03:30
MahdiandCursor 5cd8683fe6 Add AGENTS.md and deploy configs to the API repo.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 19:21:30 +03:30