Phase 1 continued: ProjectsWorker, DomainsWorker, Oban Cron schedule
ProjectsWorker mirrors DO Projects to cloud_projects table in a two-pass sweep: upsert projects, then walk each project's resource membership (list_project_resources) and update cloud_resources.cloud_project_id + tenant_id. DO URN kinds get normalized via normalize_kind/1 (domain → dns_zone, space → spaces_bucket) so attribution matches local naming. DomainsWorker syncs DNS zones (DO Domains). Same upsert chokepoint, same three-strike stale handling. Zones are global to the account; attribution happens via ProjectsWorker if a domain is in a DO project, else stays NULL pending operator classification. Oban.Plugins.Cron added with 15-minute schedules for ProjectsWorker, DropletsWorker, DomainsWorker — workers run automatically once a token is configured. Phase 0/1 cadence; phase 2 moves droplets to cloud_sync_fast (1-min) for real-time status visibility. DigitalOcean.Client gains list_domains / list_volumes / list_floating_ips. Volumes and floating IPs not yet wired to workers; trivial follow-on. Live smoke test: 5 droplets + 7 DNS zones discovered, all attributed to their existing DO projects via membership lookup (skyai-internal becomes the fallback only for genuinely orphan resources). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,15 @@ config :arcadia_cloud, Oban,
|
||||
metering: 2,
|
||||
default: 5
|
||||
],
|
||||
plugins: [
|
||||
{Oban.Plugins.Cron,
|
||||
crontab: [
|
||||
# ProjectsWorker first so attribution is fresh before resource syncs
|
||||
{"*/15 * * * *", ArcadiaCloud.Sync.ProjectsWorker},
|
||||
{"*/15 * * * *", ArcadiaCloud.Sync.DropletsWorker},
|
||||
{"*/15 * * * *", ArcadiaCloud.Sync.DomainsWorker}
|
||||
]}
|
||||
],
|
||||
repo: ArcadiaCloud.Repo
|
||||
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
|
||||
Reference in New Issue
Block a user