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>
65 lines
1.9 KiB
Elixir
65 lines
1.9 KiB
Elixir
# This file is responsible for configuring your application
|
|
# and its dependencies with the aid of the Config module.
|
|
#
|
|
# This configuration file is loaded before any dependency and
|
|
# is restricted to this project.
|
|
|
|
# General application configuration
|
|
import Config
|
|
|
|
config :arcadia_cloud,
|
|
ecto_repos: [ArcadiaCloud.Repo],
|
|
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
|
|
|
# Configure the endpoint
|
|
config :arcadia_cloud, ArcadiaCloudWeb.Endpoint,
|
|
url: [host: "localhost"],
|
|
adapter: Bandit.PhoenixAdapter,
|
|
render_errors: [
|
|
formats: [json: ArcadiaCloudWeb.ErrorJSON],
|
|
layout: false
|
|
],
|
|
pubsub_server: ArcadiaCloud.PubSub,
|
|
live_view: [signing_salt: "4W6q5pDB"]
|
|
|
|
# Configure Elixir's Logger
|
|
config :logger, :default_formatter,
|
|
format: "$time $metadata[$level] $message\n",
|
|
metadata: [:request_id]
|
|
|
|
# Use Jason for JSON parsing in Phoenix
|
|
config :phoenix, :json_library, Jason
|
|
|
|
# Guardian — JWTs are issued by arcadia-app. arcadia-cloud only verifies them.
|
|
# Issuer and secret_key MUST match arcadia-app's Arcadia.Guardian config.
|
|
config :arcadia_cloud, ArcadiaCloud.Guardian,
|
|
issuer: "arcadia",
|
|
verify_issuer: true
|
|
|
|
# Oban — provisioning, sync, billing, gateway-event consumption queues
|
|
config :arcadia_cloud, Oban,
|
|
engine: Oban.Engines.Basic,
|
|
queues: [
|
|
provisioning: 5,
|
|
cloud_sync_fast: 5,
|
|
cloud_sync_full: 3,
|
|
cloud_sync_slow: 1,
|
|
cloud_billing: 1,
|
|
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
|
|
# of this file so it overrides the configuration defined above.
|
|
import_config "#{config_env()}.exs"
|