diff --git a/site/decodal-site/src/scripts/playground-examples.js b/site/decodal-site/src/scripts/playground-examples.js index 84b6b42..40d3c3b 100644 --- a/site/decodal-site/src/scripts/playground-examples.js +++ b/site/decodal-site/src/scripts/playground-examples.js @@ -16,19 +16,25 @@ in owner = org.teams.checkout; port = 8443; replicas = env.capacity.base_replicas + 2; - resources.cpu_milli = env.capacity.cpu_milli; - resources.memory_mb = env.capacity.memory_mb; - autoscaling.enabled = true; - autoscaling.min = env.capacity.base_replicas; - autoscaling.max = env.capacity.base_replicas * 4; - rollout.strategy = match release.risk { - "high": "canary"; - "medium": "rolling"; - _: "all-at-once"; + resources = { + cpu_milli = env.capacity.cpu_milli; + memory_mb = env.capacity.memory_mb; }; - rollout.canary_percent = match release.risk { - "high": 10; - _: 100; + autoscaling = { + enabled = true; + min = env.capacity.base_replicas; + max = env.capacity.base_replicas * 4; + }; + rollout = { + strategy = match release.risk { + "high": "canary"; + "medium": "rolling"; + _: "all-at-once"; + }; + canary_percent = match release.risk { + "high": 10; + _: 100; + }; }; ingress.hosts = env.domains.public ++ ["checkout.internal.example.com"]; labels = org.common_labels ++ ["service:checkout", "tier:edge"]; @@ -41,16 +47,24 @@ in owner = String; port = Int & >= 1024 & <= 65535 default 8080; replicas = Int & > 0 default 2; - resources.cpu_milli = Int & >= 100 default 500; - resources.memory_mb = Int & >= 128 default 512; - autoscaling.enabled = Bool default false; - autoscaling.min = Int & > 0 default 2; - autoscaling.max = Int & > 0 default 4; - rollout.strategy = String default "rolling"; - rollout.canary_percent = Int & >= 0 & <= 100 default 100; - observability.metrics = Bool default true; - observability.tracing = Bool default true; - observability.logs = Bool default true; + resources = { + cpu_milli = Int & >= 100 default 500; + memory_mb = Int & >= 128 default 512; + }; + autoscaling = { + enabled = Bool default false; + min = Int & > 0 default 2; + max = Int & > 0 default 4; + }; + rollout = { + strategy = String default "rolling"; + canary_percent = Int & >= 0 & <= 100 default 100; + }; + observability = { + metrics = Bool default true; + tracing = Bool default true; + logs = Bool default true; + }; network.public = Bool default false; }; `, @@ -64,8 +78,10 @@ domains.public = ["checkout.example.com", "api.example.com"]; Production = { network.public = true; - observability.tracing = true; - observability.logs = true; + observability = { + tracing = true; + logs = true; + }; }; `, 'org/platform.dcdl': `teams = { @@ -99,12 +115,16 @@ in schema.Tenant & (plans.Enterprise // region.Europe // customer.Acme // { slug = "acme"; display_name = "Acme Manufacturing"; - limits.users = customer.seats + 25; - limits.projects = 200; - limits.storage_gb = 2048; - features.audit_log = true; - features.sso = true; - features.data_residency = true; + limits = { + users = customer.seats + 25; + projects = 200; + storage_gb = 2048; + }; + features = { + audit_log = true; + sso = true; + data_residency = true; + }; compliance.retention_days = match customer.contract_tier { "regulated": 2555; _: 365; @@ -116,31 +136,45 @@ in slug = String; display_name = String; plan = String default "standard"; - limits.users = Int & > 0 default 25; - limits.projects = Int & > 0 default 20; - limits.storage_gb = Int & > 0 default 100; - features.sso = Bool default false; - features.audit_log = Bool default true; - features.data_residency = Bool default false; - compliance.region = String default "us"; - compliance.retention_days = Int & >= 30 default 90; - billing.currency = String default "USD"; - billing.invoice_day = Int & >= 1 & <= 28 default 1; + limits = { + users = Int & > 0 default 25; + projects = Int & > 0 default 20; + storage_gb = Int & > 0 default 100; + }; + features = { + sso = Bool default false; + audit_log = Bool default true; + data_residency = Bool default false; + }; + compliance = { + region = String default "us"; + retention_days = Int & >= 30 default 90; + }; + billing = { + currency = String default "USD"; + invoice_day = Int & >= 1 & <= 28 default 1; + }; }; `, 'plans.dcdl': `Enterprise = { plan = "enterprise"; - limits.users = 500; - limits.projects = 100; - limits.storage_gb = 1024; - features.sso = true; - features.audit_log = true; + limits = { + users = 500; + projects = 100; + storage_gb = 1024; + }; + features = { + sso = true; + audit_log = true; + }; billing.invoice_day = 15; }; `, 'regions/eu.dcdl': `Europe = { - compliance.region = "eu-west"; - compliance.retention_days = 365; + compliance = { + region = "eu-west"; + retention_days = 365; + }; billing.currency = "EUR"; }; `, @@ -168,14 +202,20 @@ Acme = { in schema.Pipeline & env.Production & { name = "events-rollup"; - source.kafka_cluster = sources.cluster; - source.topic = sources.raw_topic; - source.consumer_group = "analytics-events-rollup"; - sink.table = sinks.daily_events_table; - sink.mode = "append"; + source = { + kafka_cluster = sources.cluster; + topic = sources.raw_topic; + consumer_group = "analytics-events-rollup"; + }; + sink = { + table = sinks.daily_events_table; + mode = "append"; + }; workers = env.scale.worker_count; - batch.size = env.scale.batch_size; - batch.timeout_seconds = 60 + 30; + batch = { + size = env.scale.batch_size; + timeout_seconds = 60 + 30; + }; schedule.cron = "*/15 * * * *"; transforms = transforms.standard ++ transforms.privacy ++ ["aggregate_daily"]; quality.max_lag_seconds = match env.tier { @@ -188,18 +228,26 @@ in `, 'schemas/pipeline.dcdl': `Pipeline = { name = String; - source.kafka_cluster = String; - source.topic = String; - source.consumer_group = String; - sink.table = String; - sink.mode = String default "append"; + source = { + kafka_cluster = String; + topic = String; + consumer_group = String; + }; + sink = { + table = String; + mode = String default "append"; + }; workers = Int & > 0 default 2; - batch.size = Int & >= 100 default 1000; - batch.timeout_seconds = Int & > 0 default 60; + batch = { + size = Int & >= 100 default 1000; + timeout_seconds = Int & > 0 default 60; + }; schedule.cron = String; quality.max_lag_seconds = Int & > 0 default 300; - dead_letter.enabled = Bool default true; - dead_letter.topic = String default "events.dead_letter"; + dead_letter = { + enabled = Bool default true; + topic = String default "events.dead_letter"; + }; }; `, 'env/prod.dcdl': `tier = "gold"; @@ -238,26 +286,38 @@ in schema.EdgeApplication & security.StrictHeaders & { name = "docs-and-playground"; domains = domains.primary ++ domains.aliases; - origin.host = "origin-docs.internal.example.com"; - origin.port = 443; + origin = { + host = "origin-docs.internal.example.com"; + port = 443; + }; tls.mode = "strict"; - cache.default_ttl_seconds = 60 * 60; - cache.static_ttl_seconds = 60 * 60 * 24; - cache.bypass_preview = env != "production"; - routing.docs_paths = ["/docs/*", "/assets/*"]; - routing.playground_paths = ["/playground/*"]; - waf.enabled = true; - waf.rules = security.managed_rules ++ ["block-country:kp", "rate-limit-login"]; + cache = { + default_ttl_seconds = 60 * 60; + static_ttl_seconds = 60 * 60 * 24; + bypass_preview = env != "production"; + }; + routing = { + docs_paths = ["/docs/*", "/assets/*"]; + playground_paths = ["/playground/*"]; + }; + waf = { + enabled = true; + rules = security.managed_rules ++ ["block-country:kp", "rate-limit-login"]; + }; } `, 'schemas/edge.dcdl': `EdgeApplication = { name = String; - origin.host = String; - origin.port = Int & >= 1 & <= 65535 default 443; + origin = { + host = String; + port = Int & >= 1 & <= 65535 default 443; + }; tls.mode = String default "strict"; - cache.default_ttl_seconds = Int & >= 0 default 300; - cache.static_ttl_seconds = Int & >= 0 default 86400; - cache.bypass_preview = Bool default false; + cache = { + default_ttl_seconds = Int & >= 0 default 300; + static_ttl_seconds = Int & >= 0 default 86400; + bypass_preview = Bool default false; + }; waf.enabled = Bool default true; }; `, @@ -267,9 +327,11 @@ aliases = ["www.decodal.example.com", "docs.decodal.example.com"]; 'security.dcdl': `managed_rules = ["owasp-core", "known-bots", "credential-stuffing"]; StrictHeaders = { - headers.hsts = "max-age=31536000; includeSubDomains; preload"; - headers.referrer_policy = "same-origin"; - headers.frame_options = "DENY"; + headers = { + hsts = "max-age=31536000; includeSubDomains; preload"; + referrer_policy = "same-origin"; + frame_options = "DENY"; + }; }; `, }, @@ -296,12 +358,14 @@ in "sev2": 15; _: 60; }; - escalation.after_minutes = match severity { - "sev1": 10; - "sev2": 30; - _: 120; + escalation = { + after_minutes = match severity { + "sev1": 10; + "sev2": 30; + _: 120; + }; + targets = teams.platform_secondary ++ calendar.executive_watch; }; - escalation.targets = teams.platform_secondary ++ calendar.executive_watch; runbooks = ["runbooks/payments-api", "runbooks/database-failover"]; } `,