@intentius/behold 0.29.56 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/AGENTS.md +323 -26
  2. package/THIRD_PARTY.md +21 -0
  3. package/demos.json +1 -1
  4. package/dist/cli.js +12393 -8612
  5. package/example-choudoufu-estate/chant.workspace.json +1 -1
  6. package/example-terraform-estate/README.md +10 -10
  7. package/example-terraform-estate/chant.workspace.json +1 -1
  8. package/example-three-cloud/README.md +17 -9
  9. package/example-three-cloud/aws/chant.config.ts +1 -1
  10. package/example-three-cloud/aws/site.component.ts +13 -0
  11. package/example-three-cloud/azure/chant.config.ts +1 -1
  12. package/example-three-cloud/azure/src/site.component.ts +13 -0
  13. package/example-three-cloud/azure/src/site.ts +12 -46
  14. package/example-three-cloud/dns/chant.config.ts +1 -1
  15. package/example-three-cloud/dns/src/records.component.ts +14 -0
  16. package/example-three-cloud/dns/src/route53.ts +8 -39
  17. package/example-three-cloud/gcp/chant.config.ts +1 -1
  18. package/example-three-cloud/gcp/src/site.component.ts +13 -0
  19. package/example-three-cloud/gcp/src/site.ts +12 -92
  20. package/example-three-cloud/package-lock.json +19 -19
  21. package/example-three-cloud/package.json +4 -4
  22. package/example-three-cloud/scripts/front-door.ts +89 -15
  23. package/licenses/aws-architecture-icons-TERMS.md +19 -0
  24. package/licenses/azure-architecture-icons-Microsoft_Terms_of_Use.pdf +0 -0
  25. package/licenses/azure-architecture-icons-TERMS.md +20 -0
  26. package/licenses/google-cloud-icons-TERMS.md +15 -0
  27. package/package.json +8 -9
  28. package/web/agent-move.js +60 -0
  29. package/web/agent-move.test.js +55 -0
  30. package/web/app.js +1084 -66
  31. package/web/dots-lod.js +1 -1
  32. package/web/edge-weight.d.ts +5 -0
  33. package/web/edge-weight.js +71 -0
  34. package/web/edge-weight.test.js +49 -0
  35. package/web/embed.d.ts +3 -0
  36. package/web/embed.js +5 -3
  37. package/web/embed.test.js +8 -0
  38. package/web/icons/aws/alb.svg +1 -0
  39. package/web/icons/aws/api-gateway.svg +1 -0
  40. package/web/icons/aws/app-runner.svg +1 -0
  41. package/web/icons/aws/appsync.svg +1 -0
  42. package/web/icons/aws/athena.svg +1 -0
  43. package/web/icons/aws/auto-scaling.svg +1 -0
  44. package/web/icons/aws/backup.svg +1 -0
  45. package/web/icons/aws/batch.svg +1 -0
  46. package/web/icons/aws/bedrock-agentcore.svg +1 -0
  47. package/web/icons/aws/bedrock.svg +1 -0
  48. package/web/icons/aws/certificate-manager.svg +1 -0
  49. package/web/icons/aws/cloud-map.svg +1 -0
  50. package/web/icons/aws/cloud.svg +1 -0
  51. package/web/icons/aws/cloudformation.svg +1 -0
  52. package/web/icons/aws/cloudfront.svg +1 -0
  53. package/web/icons/aws/cloudtrail.svg +1 -0
  54. package/web/icons/aws/cloudwatch-alarm.svg +1 -0
  55. package/web/icons/aws/cloudwatch-logs.svg +1 -0
  56. package/web/icons/aws/cloudwatch.svg +1 -0
  57. package/web/icons/aws/codebuild.svg +1 -0
  58. package/web/icons/aws/codecommit.svg +1 -0
  59. package/web/icons/aws/codedeploy.svg +1 -0
  60. package/web/icons/aws/codepipeline.svg +1 -0
  61. package/web/icons/aws/cognito.svg +1 -0
  62. package/web/icons/aws/config.svg +1 -0
  63. package/web/icons/aws/documentdb.svg +1 -0
  64. package/web/icons/aws/dynamodb-table.svg +1 -0
  65. package/web/icons/aws/dynamodb.svg +1 -0
  66. package/web/icons/aws/ebs-volume.svg +1 -0
  67. package/web/icons/aws/ec2-instance.svg +1 -0
  68. package/web/icons/aws/ec2.svg +1 -0
  69. package/web/icons/aws/ecr-registry.svg +1 -0
  70. package/web/icons/aws/ecr.svg +1 -0
  71. package/web/icons/aws/ecs-service.svg +1 -0
  72. package/web/icons/aws/ecs-task.svg +1 -0
  73. package/web/icons/aws/ecs.svg +1 -0
  74. package/web/icons/aws/efs.svg +1 -0
  75. package/web/icons/aws/eks.svg +1 -0
  76. package/web/icons/aws/elastic-beanstalk.svg +1 -0
  77. package/web/icons/aws/elastic-ip.svg +1 -0
  78. package/web/icons/aws/elasticache.svg +1 -0
  79. package/web/icons/aws/elb.svg +1 -0
  80. package/web/icons/aws/emr.svg +1 -0
  81. package/web/icons/aws/eventbridge.svg +1 -0
  82. package/web/icons/aws/firehose.svg +1 -0
  83. package/web/icons/aws/global-accelerator.svg +1 -0
  84. package/web/icons/aws/glue.svg +1 -0
  85. package/web/icons/aws/guardduty.svg +1 -0
  86. package/web/icons/aws/iam.svg +1 -0
  87. package/web/icons/aws/internet-gateway.svg +1 -0
  88. package/web/icons/aws/keyspaces.svg +1 -0
  89. package/web/icons/aws/kinesis.svg +1 -0
  90. package/web/icons/aws/kms.svg +1 -0
  91. package/web/icons/aws/lambda-function.svg +1 -0
  92. package/web/icons/aws/lambda.svg +1 -0
  93. package/web/icons/aws/mq.svg +1 -0
  94. package/web/icons/aws/msk.svg +1 -0
  95. package/web/icons/aws/nat-gateway.svg +1 -0
  96. package/web/icons/aws/neptune.svg +1 -0
  97. package/web/icons/aws/network-acl.svg +1 -0
  98. package/web/icons/aws/network-firewall.svg +1 -0
  99. package/web/icons/aws/opensearch.svg +1 -0
  100. package/web/icons/aws/organizations.svg +1 -0
  101. package/web/icons/aws/rds-instance.svg +1 -0
  102. package/web/icons/aws/rds.svg +1 -0
  103. package/web/icons/aws/redshift.svg +1 -0
  104. package/web/icons/aws/route-53-hosted-zone.svg +1 -0
  105. package/web/icons/aws/route-53.svg +1 -0
  106. package/web/icons/aws/router.svg +1 -0
  107. package/web/icons/aws/s3-bucket.svg +1 -0
  108. package/web/icons/aws/s3.svg +1 -0
  109. package/web/icons/aws/sagemaker.svg +1 -0
  110. package/web/icons/aws/secrets-manager.svg +1 -0
  111. package/web/icons/aws/ses.svg +1 -0
  112. package/web/icons/aws/shield.svg +1 -0
  113. package/web/icons/aws/sns-topic.svg +1 -0
  114. package/web/icons/aws/sns.svg +1 -0
  115. package/web/icons/aws/sqs-queue.svg +1 -0
  116. package/web/icons/aws/sqs.svg +1 -0
  117. package/web/icons/aws/step-functions.svg +1 -0
  118. package/web/icons/aws/systems-manager.svg +1 -0
  119. package/web/icons/aws/transfer-family.svg +1 -0
  120. package/web/icons/aws/transit-gateway.svg +1 -0
  121. package/web/icons/aws/vpc-endpoints.svg +1 -0
  122. package/web/icons/aws/vpc-lattice.svg +1 -0
  123. package/web/icons/aws/vpc.svg +1 -0
  124. package/web/icons/aws/vpn-gateway.svg +1 -0
  125. package/web/icons/aws/waf.svg +1 -0
  126. package/web/icons/azure/app-service-plan.svg +1 -0
  127. package/web/icons/azure/app-services.svg +1 -0
  128. package/web/icons/azure/application-gateway.svg +1 -0
  129. package/web/icons/azure/container-app.svg +1 -0
  130. package/web/icons/azure/container-apps-environment.svg +1 -0
  131. package/web/icons/azure/container-instances.svg +1 -0
  132. package/web/icons/azure/container-registry.svg +1 -0
  133. package/web/icons/azure/cosmos-db.svg +1 -0
  134. package/web/icons/azure/dns-zone.svg +1 -0
  135. package/web/icons/azure/front-door.svg +1 -0
  136. package/web/icons/azure/function-app.svg +1 -0
  137. package/web/icons/azure/kubernetes-service.svg +1 -0
  138. package/web/icons/azure/load-balancer.svg +1 -0
  139. package/web/icons/azure/log-analytics.svg +1 -0
  140. package/web/icons/azure/managed-identity.svg +1 -0
  141. package/web/icons/azure/mysql.svg +1 -0
  142. package/web/icons/azure/nat.svg +1 -0
  143. package/web/icons/azure/network-security-group.svg +1 -0
  144. package/web/icons/azure/postgresql.svg +1 -0
  145. package/web/icons/azure/public-ip.svg +1 -0
  146. package/web/icons/azure/redis.svg +1 -0
  147. package/web/icons/azure/resource-group.svg +1 -0
  148. package/web/icons/azure/route-table.svg +1 -0
  149. package/web/icons/azure/sql-database.svg +1 -0
  150. package/web/icons/azure/sql-server.svg +1 -0
  151. package/web/icons/azure/subnet.svg +1 -0
  152. package/web/icons/azure/subscription.svg +1 -0
  153. package/web/icons/azure/virtual-machine.svg +1 -0
  154. package/web/icons/azure/virtual-network-gateway.svg +1 -0
  155. package/web/icons/azure/virtual-network.svg +1 -0
  156. package/web/icons/gcp/artifact-registry.svg +1 -0
  157. package/web/icons/gcp/bigquery.svg +1 -0
  158. package/web/icons/gcp/bigtable.svg +1 -0
  159. package/web/icons/gcp/certificate-manager.svg +1 -0
  160. package/web/icons/gcp/cloud-armor.svg +1 -0
  161. package/web/icons/gcp/cloud-build.svg +1 -0
  162. package/web/icons/gcp/cloud-composer.svg +1 -0
  163. package/web/icons/gcp/cloud-dns.svg +1 -0
  164. package/web/icons/gcp/cloud-functions.svg +1 -0
  165. package/web/icons/gcp/cloud-load-balancing.svg +1 -0
  166. package/web/icons/gcp/cloud-logging.svg +1 -0
  167. package/web/icons/gcp/cloud-monitoring.svg +1 -0
  168. package/web/icons/gcp/cloud-nat.svg +1 -0
  169. package/web/icons/gcp/cloud-router.svg +1 -0
  170. package/web/icons/gcp/cloud-run.svg +1 -0
  171. package/web/icons/gcp/cloud-scheduler.svg +1 -0
  172. package/web/icons/gcp/cloud-spanner.svg +1 -0
  173. package/web/icons/gcp/cloud-sql.svg +1 -0
  174. package/web/icons/gcp/cloud-storage.svg +1 -0
  175. package/web/icons/gcp/cloud-tasks.svg +1 -0
  176. package/web/icons/gcp/compute-engine.svg +1 -0
  177. package/web/icons/gcp/dataflow.svg +1 -0
  178. package/web/icons/gcp/external-ip.svg +1 -0
  179. package/web/icons/gcp/firestore.svg +1 -0
  180. package/web/icons/gcp/firewall-rules.svg +1 -0
  181. package/web/icons/gcp/gke.svg +1 -0
  182. package/web/icons/gcp/iam.svg +1 -0
  183. package/web/icons/gcp/kms.svg +1 -0
  184. package/web/icons/gcp/memorystore.svg +1 -0
  185. package/web/icons/gcp/persistent-disk.svg +1 -0
  186. package/web/icons/gcp/project.svg +1 -0
  187. package/web/icons/gcp/pubsub.svg +1 -0
  188. package/web/icons/gcp/secret-manager.svg +1 -0
  189. package/web/icons/gcp/vpc.svg +1 -0
  190. package/web/index.html +98 -9
  191. package/web/net-trace.js +649 -0
  192. package/web/net-trace.test.js +180 -0
  193. package/web/panel.js +28 -4
  194. package/web/release.js +6 -4
  195. package/web/release.test.js +2 -2
  196. package/web/search-view.d.ts +27 -0
  197. package/web/search-view.js +213 -0
  198. package/web/search-view.test.js +144 -0
  199. package/web/shot-frame.d.ts +5 -0
  200. package/web/shot-frame.js +116 -0
  201. package/web/shot-frame.test.js +90 -0
  202. package/web/themes.js +1 -1
  203. package/web/view-url.d.ts +18 -0
  204. package/web/view-url.js +162 -10
  205. package/web/view-url.test.js +72 -1
@@ -4,7 +4,7 @@
4
4
  "pins": [
5
5
  {
6
6
  "package": "@intentius/chant-lexicon-terraform",
7
- "version": "0.124.0"
7
+ "version": "0.124.46"
8
8
  }
9
9
  ],
10
10
  "members": [
@@ -83,25 +83,25 @@ HCL.
83
83
 
84
84
  ## It needs the lexicon
85
85
 
86
- behold parses no HCL and ships no HCL parser. The reading goes through
87
- `@intentius/chant-lexicon-terraform`, which loads `@cdktn/hcl2json` underneath —
88
- a ~1.8 MB wasm blob. Both are declared as optional peers and behold does not
89
- install them, so that every user who serves an ordinary chant project does not
90
- carry an HCL parser they will never run:
86
+ behold parses no HCL itself. The reading goes through
87
+ `@intentius/chant-lexicon-terraform`, and chant parses the HCL with
88
+ `@cdktn/hcl2json`, a ~1.8 MB wasm blob. Both are dependencies of behold
89
+ (#909), so `npx @intentius/behold demo terraform-estate` needs nothing else.
90
+
91
+ An install that skipped or pruned them makes the demo refuse before it serves,
92
+ naming both packages, the ranges behold declares, where it looked, and the line
93
+ that puts them back:
91
94
 
92
95
  ```sh
93
- npm install --no-save @intentius/chant-lexicon-terraform@^0.124.0 @cdktn/hcl2json@^0.24.0
96
+ npm install @intentius/chant-lexicon-terraform@^0.124.38 @cdktn/hcl2json@^0.24.0
94
97
  ```
95
98
 
96
- Without them the demo refuses before it serves, naming both packages, the
97
- ranges behold declares, and where it looked.
98
-
99
99
  The estate is a declared chant workspace, and chant reads a member's kind from
100
100
  the packages `chant.workspace.json` pins, looked up from the workspace's own
101
101
  `node_modules` at exactly the pinned version. A demo copy has no
102
102
  `node_modules`, so `behold demo` links the lexicon behold resolved into the
103
103
  copy and sets the copy's pin to that version (#484). It says so as it loads:
104
- `linked @intentius/chant-lexicon-terraform 0.124.0 into the copy`. Serving
104
+ `linked @intentius/chant-lexicon-terraform 0.124.38 into the copy`. Serving
105
105
  your own declared workspace is different: install the pinned lexicon in its
106
106
  root, the way `chant workspace check` asks.
107
107
 
@@ -4,7 +4,7 @@
4
4
  "pins": [
5
5
  {
6
6
  "package": "@intentius/chant-lexicon-terraform",
7
- "version": "0.124.0"
7
+ "version": "0.124.46"
8
8
  }
9
9
  ],
10
10
  "members": [
@@ -5,16 +5,24 @@ the floci emulators. It is behold's `three-cloud` demo, and its exported page
5
5
  asks one question: turn Azure off, and where does traffic go?
6
6
 
7
7
  ```
8
- chant.workspace.json the workspace: dns, aws, azure, gcp
9
- dns/src/route53.ts hosted zone, a health check and a latency CNAME per cloud
10
- dns/ops/front-door.op.ts the Op that rebuilds the page
11
- aws/src/site.ts ECS on Fargate behind a load balancer (FargateAlb)
12
- azure/src/site.ts a Container Apps environment and app
13
- gcp/src/site.ts Cloud Run (CloudRunServiceComposite)
14
- scripts/emulators-up.sh boots floci, floci-az and floci-gcp
15
- scripts/front-door.ts the Op's steps: apply, turn Azure off, wait, export
8
+ chant.workspace.json the workspace: dns, aws, azure, gcp
9
+ dns/src/route53.ts hosted zone, and a latency entry per cloud (HostnameEntry, AddressEntry)
10
+ dns/ops/front-door.op.ts the Op that rebuilds the page
11
+ aws/src/site.ts ECS on Fargate behind a load balancer (FargateAlb)
12
+ azure/src/site.ts a Container Apps site and its network (ContainerAppSite, ContainerAppNetwork)
13
+ gcp/src/site.ts Cloud Run behind a global load balancer (PublicCloudRun, PrivateEgressNetwork)
14
+ *.component.ts one component per member: how it deploys
15
+ (aws/ at its root, beside its stacks; the others in src/)
16
+ scripts/emulators-up.sh boots floci, floci-az and floci-gcp
17
+ scripts/front-door.ts the Op's steps: apply, turn Azure off, wait, export
16
18
  ```
17
19
 
20
+ The composites are the lexicons' own. Each member is one component. aws
21
+ deploys with `cfn-deploy`. azure and gcp run their member's apply from
22
+ `scripts/front-door.ts` (`apply-azure`, `apply-gcp`) until their lexicons have
23
+ deploy steps of their own (chant#4273). dns runs `apply-dns`, which points
24
+ each health check at the emulator that answers for it.
25
+
18
26
  Each cloud publishes its endpoint with `output()` and `dns` reads it as a
19
27
  parameter of the same name.
20
28
 
@@ -35,4 +43,4 @@ npx serve export
35
43
 
36
44
  `cd dns && npx chant run front-door` runs the same steps as an Op.
37
45
 
38
- Needs chant 0.124.38 or newer.
46
+ Needs chant 0.124.39 or newer.
@@ -3,6 +3,6 @@
3
3
  export default {
4
4
  lexicons: ["aws"],
5
5
  sourceDir: "src",
6
- environments: ["local"],
6
+ environments: [{ name: "local", endpoint: "http://localhost:4566" }],
7
7
  stacks: [{ name: "three-cloud-aws", src: "src" }],
8
8
  };
@@ -0,0 +1,13 @@
1
+ import { phase, type Component } from "@intentius/chant/components";
2
+
3
+ // The aws member as one component: build its template, then apply it as the
4
+ // stack three-cloud-aws, the name the dns member reads its output from.
5
+ export const site: Component = {
6
+ name: "site",
7
+ archetype: "infra",
8
+ dependsOn: [],
9
+ deploy: [
10
+ phase("Build", [{ kind: "shell", cmd: "npx chant build src -o dist/site.json", reason: "the template cfn-deploy applies is this member's own build" }]),
11
+ phase("Apply", [{ kind: "cfn-deploy", stack: "three-cloud-aws", template: "dist/site.json" }]),
12
+ ],
13
+ };
@@ -1 +1 @@
1
- export default { lexicons: ["azure"], sourceDir: "src", environments: ["local"] };
1
+ export default { lexicons: ["azure"], sourceDir: "src", environments: [{ name: "local", endpoint: "http://localhost:4577" }] };
@@ -0,0 +1,13 @@
1
+ import { phase, type Component } from "@intentius/chant/components";
2
+
3
+ // The azure member as one component: build its ARM template, then deploy it
4
+ // into the resource group named after the environment.
5
+ export const site: Component = {
6
+ name: "site",
7
+ archetype: "infra",
8
+ dependsOn: [],
9
+ deploy: [
10
+ phase("Build", [{ kind: "shell", cmd: "npx chant build src -o dist/site.json", reason: "the template arm-deploy applies is this member's own build" }]),
11
+ phase("Apply", [{ kind: "arm-deploy", template: "dist/site.json", resourceGroup: "local", location: "westeurope", noRollback: "a failed deploy is fixed forward by deploying the template again" }]),
12
+ ],
13
+ };
@@ -1,52 +1,18 @@
1
- import { LogAnalyticsWorkspace, ManagedIdentity, VirtualNetwork, managedEnvironments, containerApps, output } from "@intentius/chant-lexicon-azure";
1
+ import { ContainerAppNetwork, ContainerAppSite, output } from "@intentius/chant-lexicon-azure";
2
2
 
3
- // The website on Azure Container Apps in West Europe, set up the way a
4
- // production environment is: the environment sits in its own VNet subnet and
5
- // ships its logs to a Log Analytics workspace, and the app runs as a
6
- // user-assigned identity. Container Apps brings its own ingress and load
7
- // balancing, so there is no load balancer to declare.
8
- const location = "westeurope";
3
+ // The website on Azure Container Apps in West Europe, from the lexicon's
4
+ // composites: its network, and the site in it.
5
+ export const network = ContainerAppNetwork({ name: "three-cloud", location: "westeurope", addressSpace: "10.40.0.0/16", subnetPrefix: "10.40.0.0/23" });
9
6
 
10
- export const logs = new LogAnalyticsWorkspace({ name: "three-cloud-logs", location, sku: { name: "PerGB2018" }, retentionInDays: 30 });
11
-
12
- // A Container Apps environment on workload profiles takes a /23 or larger,
13
- // delegated to it. The subnet is declared inside the VNet: chant's own Subnet
14
- // resource writes the ARM type as virtualNetworks_subnets (reported to chant).
15
- export const vnet = new VirtualNetwork({
16
- name: "three-cloud-vnet",
17
- location,
18
- addressSpace: { addressPrefixes: ["10.40.0.0/16"] },
19
- subnets: [{ name: "apps", properties: { addressPrefix: "10.40.0.0/23", delegations: [{ name: "apps", properties: { serviceName: "Microsoft.App/environments" } }] } }],
20
- });
21
-
22
- export const identity = new ManagedIdentity({ name: "three-cloud-web", location });
23
-
24
- export const env = new managedEnvironments({
7
+ export const web = ContainerAppSite({
25
8
  name: "three-cloud",
26
- location,
27
- vnetConfiguration: { infrastructureSubnetId: "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'three-cloud-vnet', 'apps')]", internal: false },
28
- appLogsConfiguration: {
29
- destination: "log-analytics",
30
- logAnalyticsConfiguration: {
31
- customerId: "[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'three-cloud-logs')).customerId]",
32
- sharedKey: "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', 'three-cloud-logs'), '2023-09-01').primarySharedKey]",
33
- },
34
- },
35
- workloadProfiles: [{ name: "Consumption", workloadProfileType: "Consumption" }],
36
- });
37
-
38
- export const app = new containerApps({
39
- name: "web",
40
- location,
41
- identity: { type: "UserAssigned", userAssignedIdentities: { "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'three-cloud-web')]": {} } },
42
- managedEnvironmentId: env.id,
43
- workloadProfileName: "Consumption",
44
- configuration: { ingress: { external: true, targetPort: 80, transport: "auto" } },
45
- template: {
46
- containers: [{ name: "web", image: "traefik/whoami:v1.10", resources: { cpu: 0.25, memory: "0.5Gi" } }],
47
- scale: { minReplicas: 1, maxReplicas: 1 },
48
- },
9
+ app: "web",
10
+ location: "westeurope",
11
+ subnetId: network.subnet.id as unknown as string,
12
+ image: "traefik/whoami:v1.10",
13
+ port: 80,
14
+ replicas: 1,
49
15
  });
50
16
 
51
17
  // The dns member reads this as its `azureEndpoint` parameter.
52
- export const azureEndpoint = output(app.configuration_ingress_fqdn, "azureEndpoint");
18
+ export const azureEndpoint = output(web.containerApp.configuration_ingress_fqdn, "azureEndpoint");
@@ -1 +1 @@
1
- export default { lexicons: ["aws"], sourceDir: "src", environments: ["local"] };
1
+ export default { lexicons: ["aws"], sourceDir: "src", environments: [{ name: "local", endpoint: "http://localhost:4566" }] };
@@ -0,0 +1,14 @@
1
+ import { phase, type Component } from "@intentius/chant/components";
2
+
3
+ // The dns member as one component, applied after the three sites: its
4
+ // parameters are the endpoints they publish. The step is the emulator apply in
5
+ // scripts/front-door.ts, which reads those endpoints from what is applied and
6
+ // points each health check at the emulator that answers for it.
7
+ export const records: Component = {
8
+ name: "records",
9
+ archetype: "infra",
10
+ dependsOn: [],
11
+ deploy: [
12
+ phase("Apply", [{ kind: "shell", cmd: "npx tsx ../scripts/front-door.ts apply-dns", reason: "the checks probe emulator addresses that only exist on this machine" }]),
13
+ ],
14
+ };
@@ -1,4 +1,4 @@
1
- import { HostedZone, HealthCheck, RecordSet, Parameter } from "@intentius/chant-lexicon-aws";
1
+ import { AddressEntry, HostedZone, HostnameEntry, Parameter } from "@intentius/chant-lexicon-aws";
2
2
 
3
3
  // Route 53 in front of the three clouds: one latency record per cloud, each
4
4
  // guarded by a health check on that cloud's endpoint. A record whose check
@@ -22,41 +22,10 @@ export const awsEndpoint = new Parameter("String", { description: "The aws membe
22
22
  export const azureEndpoint = new Parameter("String", { description: "The azure member's Container App hostname" });
23
23
  export const gcpEndpoint = new Parameter("String", { description: "The gcp member's load balancer IP address" });
24
24
 
25
- function healthCheck(endpoint: Parameter) {
26
- return new HealthCheck({
27
- HealthCheckConfig: {
28
- Type: "HTTP",
29
- FullyQualifiedDomainName: endpoint,
30
- ResourcePath: "/",
31
- RequestInterval: 10,
32
- FailureThreshold: 1,
33
- },
34
- });
35
- }
36
-
37
- function latencyRecord(id: string, region: string, endpoint: Parameter | string, check: HealthCheck) {
38
- return new RecordSet({
39
- HostedZoneId: zone.Id,
40
- Name: NAME,
41
- Type: "CNAME",
42
- TTL: "60",
43
- SetIdentifier: id,
44
- Region: region,
45
- ResourceRecords: [endpoint as unknown as string],
46
- HealthCheckId: check.HealthCheckId,
47
- });
48
- }
49
-
50
- export const awsCheck = healthCheck(awsEndpoint);
51
- export const azureCheck = healthCheck(azureEndpoint);
52
- // The check on GCP probes the load balancer's address directly.
53
- export const gcpCheck = new HealthCheck({
54
- HealthCheckConfig: { Type: "HTTP", IPAddress: gcpEndpoint, Port: 80, ResourcePath: "/", RequestInterval: 10, FailureThreshold: 1 },
55
- });
56
-
57
- const GCP_ORIGIN = "gcp.three-cloud.example.";
58
- export const gcpOrigin = new RecordSet({ HostedZoneId: zone.Id, Name: GCP_ORIGIN, Type: "A", TTL: "60", ResourceRecords: [gcpEndpoint as unknown as string] });
59
-
60
- export const awsRecord = latencyRecord("aws", "us-east-1", awsEndpoint, awsCheck);
61
- export const azureRecord = latencyRecord("azure", "eu-west-1", azureEndpoint, azureCheck);
62
- export const gcpRecord = latencyRecord("gcp", "ap-northeast-1", GCP_ORIGIN, gcpCheck);
25
+ // One entry per cloud, from the lexicon's composites. Azure (West Europe)
26
+ // answers as eu-west-1 and GCP (Tokyo) as ap-northeast-1, since latency
27
+ // records name AWS regions.
28
+ const endpoint = (p: Parameter) => p as unknown as string;
29
+ export const aws = HostnameEntry({ zoneId: zone.Id, name: NAME, id: "aws", region: "us-east-1", endpoint: endpoint(awsEndpoint) });
30
+ export const azure = HostnameEntry({ zoneId: zone.Id, name: NAME, id: "azure", region: "eu-west-1", endpoint: endpoint(azureEndpoint) });
31
+ export const gcp = AddressEntry({ zoneId: zone.Id, name: NAME, id: "gcp", region: "ap-northeast-1", endpoint: endpoint(gcpEndpoint), origin: "gcp.three-cloud.example.", port: 80 });
@@ -1,2 +1,2 @@
1
1
  // The project every gcp resource builds, applies and is read in.
2
- export default { lexicons: ["gcp"], sourceDir: "src", environments: ["local"], gcp: { project: "three-cloud" } };
2
+ export default { lexicons: ["gcp"], sourceDir: "src", environments: [{ name: "local", endpoint: "http://localhost:4588" }], gcp: { project: "three-cloud" } };
@@ -0,0 +1,13 @@
1
+ import { phase, type Component } from "@intentius/chant/components";
2
+
3
+ // The gcp member as one component: build its Config Connector manifest, then
4
+ // apply it into the project.
5
+ export const site: Component = {
6
+ name: "site",
7
+ archetype: "infra",
8
+ dependsOn: [],
9
+ deploy: [
10
+ phase("Build", [{ kind: "shell", cmd: "npx chant build src -o dist/site.yaml", reason: "the manifest gcp-apply applies is this member's own build" }]),
11
+ phase("Apply", [{ kind: "gcp-apply", manifest: "dist/site.yaml", project: "three-cloud", noRollback: "a failed apply is fixed forward by applying the manifest again" }]),
12
+ ],
13
+ };
@@ -1,100 +1,20 @@
1
- import {
2
- BackendService,
3
- CloudRunServiceComposite,
4
- ComputeAddress,
5
- ForwardingRule,
6
- GCPServiceAccount,
7
- RegionNetworkEndpointGroup,
8
- Subnetwork,
9
- TargetHTTPProxy,
10
- URLMap,
11
- VPCNetwork,
12
- output,
13
- } from "@intentius/chant-lexicon-gcp";
1
+ import { PrivateEgressNetwork, PublicCloudRun, output } from "@intentius/chant-lexicon-gcp";
14
2
 
15
- // The website on Cloud Run in Tokyo, running as its own service account with
16
- // its egress in a VPC subnet, behind a global external Application Load
17
- // Balancer as production sets it up: a
18
- // static address and a forwarding rule, an HTTP proxy, a URL map, a backend
19
- // service, and a serverless network endpoint group that names the service.
20
- const region = "asia-northeast1";
3
+ // The website on Cloud Run in Tokyo behind a global load balancer, from the
4
+ // lexicon's composites: its network, and the site that sends its egress into it.
5
+ export const network = PrivateEgressNetwork({ name: "three-cloud", region: "asia-northeast1", subnetCidr: "10.30.0.0/24" });
21
6
 
22
- export const runtime = new GCPServiceAccount({
23
- metadata: { name: "three-cloud-run" },
24
- displayName: "three-cloud website runtime",
25
- });
26
-
27
- // The network Cloud Run sends its egress into (Direct VPC egress), a custom
28
- // VPC with one subnet in the service's region.
29
- export const vpc = new VPCNetwork({ metadata: { name: "three-cloud-vpc" }, autoCreateSubnetworks: false, routingMode: "REGIONAL" });
30
-
31
- export const subnet = new Subnetwork({
32
- metadata: { name: "three-cloud-apps" },
33
- region,
34
- ipCidrRange: "10.30.0.0/24",
35
- networkRef: { name: vpc.name },
36
- });
37
-
38
- export const web = CloudRunServiceComposite({
39
- name: "three-cloud-site",
40
- image: "traefik/whoami:v1.10",
7
+ export const web = PublicCloudRun({
8
+ name: "three-cloud",
41
9
  projectId: "three-cloud",
42
- location: region,
10
+ region: "asia-northeast1",
11
+ vpc: network.vpc,
12
+ subnet: network.subnet,
13
+ image: "traefik/whoami:v1.10",
43
14
  port: 80,
15
+ frontendPort: 80,
44
16
  minInstanceCount: 1,
45
17
  maxInstanceCount: 1,
46
- publicAccess: true,
47
- serviceAccount: "three-cloud-run",
48
- defaults: {
49
- service: {
50
- template: {
51
- vpcAccess: {
52
- egress: "PRIVATE_RANGES_ONLY",
53
- networkInterfaces: [{ networkRef: { name: vpc.name }, subnetworkRef: { name: subnet.name } }],
54
- },
55
- },
56
- },
57
- },
58
- });
59
-
60
- export const neg = new RegionNetworkEndpointGroup({
61
- metadata: { name: "three-cloud-neg" },
62
- region,
63
- networkEndpointType: "SERVERLESS",
64
- cloudRun: { serviceRef: { name: web.service.name } },
65
- });
66
-
67
- // A backend service over a serverless NEG takes no health check: Cloud Run
68
- // reports its own readiness.
69
- export const backend = new BackendService({
70
- metadata: { name: "three-cloud-backend" },
71
- location: "global",
72
- loadBalancingScheme: "EXTERNAL_MANAGED",
73
- protocol: "HTTP",
74
- backend: [{ group: { networkEndpointGroupRef: { name: neg.name } } }],
75
- });
76
-
77
- export const urlMap = new URLMap({
78
- metadata: { name: "three-cloud-map" },
79
- location: "global",
80
- defaultService: { backendServiceRef: { name: backend.name } },
81
- });
82
-
83
- export const proxy = new TargetHTTPProxy({
84
- metadata: { name: "three-cloud-proxy" },
85
- location: "global",
86
- urlMapRef: { name: urlMap.name },
87
- });
88
-
89
- export const address = new ComputeAddress({ metadata: { name: "three-cloud-ip" }, location: "global" });
90
-
91
- export const rule = new ForwardingRule({
92
- metadata: { name: "three-cloud-rule" },
93
- location: "global",
94
- loadBalancingScheme: "EXTERNAL_MANAGED",
95
- portRange: "80",
96
- ipAddress: { addressRef: { name: address.name } },
97
- target: { targetHTTPProxyRef: { name: proxy.name } },
98
18
  });
99
19
 
100
20
  // The dns member reads this as its `gcpEndpoint` parameter: the load
@@ -102,4 +22,4 @@ export const rule = new ForwardingRule({
102
22
  // YAML has no outputs and neither kind exposes the IP as an attribute, so
103
23
  // this declares the join for the graph, and scripts/front-door.ts reads the
104
24
  // IP from the emulator.
105
- export const gcpEndpoint = output(rule.status_selfLink, "gcpEndpoint");
25
+ export const gcpEndpoint = output(web.rule.status_selfLink, "gcpEndpoint");
@@ -6,10 +6,10 @@
6
6
  "": {
7
7
  "name": "behold-example-three-cloud",
8
8
  "dependencies": {
9
- "@intentius/chant": "^0.124.38",
10
- "@intentius/chant-lexicon-aws": "^0.124.38",
11
- "@intentius/chant-lexicon-azure": "^0.124.38",
12
- "@intentius/chant-lexicon-gcp": "^0.124.38"
9
+ "@intentius/chant": "^0.124.40",
10
+ "@intentius/chant-lexicon-aws": "^0.124.40",
11
+ "@intentius/chant-lexicon-azure": "^0.124.40",
12
+ "@intentius/chant-lexicon-gcp": "^0.124.40"
13
13
  }
14
14
  },
15
15
  "node_modules/@dagrejs/dagre": {
@@ -444,9 +444,9 @@
444
444
  }
445
445
  },
446
446
  "node_modules/@intentius/chant": {
447
- "version": "0.124.38",
448
- "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.38.tgz",
449
- "integrity": "sha512-BCLGgZTOHkwHCDaUNh3kLZJsgJbpJ6iTcrjYAIGLjt7JlZiUAZKB4vVmOxKqfGc/u0K7+pbTYeiIYQOTgjA7Pg==",
447
+ "version": "0.124.40",
448
+ "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.40.tgz",
449
+ "integrity": "sha512-ZyhBR+ggbl6FOolf+xCc/Lj8aAO2XCto+QhJOTkx5WS4e82FIWXBLukSJu/rI4ie/6lqTHBFDhtGzsiyodE/Nw==",
450
450
  "license": "Apache-2.0",
451
451
  "dependencies": {
452
452
  "@dagrejs/dagre": "^3.0.0",
@@ -473,34 +473,34 @@
473
473
  }
474
474
  },
475
475
  "node_modules/@intentius/chant-lexicon-aws": {
476
- "version": "0.124.38",
477
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.38.tgz",
478
- "integrity": "sha512-S9IRHJxWeaswwezVCYbYflaXPhs3y98Xun8pLZSYTL8vLKY9+LI7cfvZI6WkyPGWyu+/ViVtlSAwgxSeUTAzGA==",
476
+ "version": "0.124.40",
477
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.40.tgz",
478
+ "integrity": "sha512-FNUgx40SChU6Gq9NKabAswBklupr2VWvyVAW0g/fWD6lhyYdkwty+egpaMbVHTRTHKhSDR+QoP+YoETNr2z90g==",
479
479
  "license": "Apache-2.0",
480
480
  "dependencies": {
481
481
  "fflate": "^0.8.2",
482
482
  "js-yaml": "^4.3.1"
483
483
  },
484
484
  "peerDependencies": {
485
- "@intentius/chant": "^0.124.38"
485
+ "@intentius/chant": "^0.124.40"
486
486
  }
487
487
  },
488
488
  "node_modules/@intentius/chant-lexicon-azure": {
489
- "version": "0.124.38",
490
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.38.tgz",
491
- "integrity": "sha512-dXTxFRg6uxgdWiN/cz5jhkZM885wxcX3CLrskyP9xgcqFP9kWvPCqv1eE1Cr3MoRqIBVT5wj6K+RtoBm0pojug==",
489
+ "version": "0.124.40",
490
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.40.tgz",
491
+ "integrity": "sha512-if0wRta/8M/zip1AcYX3iI/NEOFgu35KkXXCitOTe+YXqw9Dkij6ITxtr/9kp9g4xJfvOKAN/QaH2mZrxp9W2w==",
492
492
  "license": "Apache-2.0",
493
493
  "dependencies": {
494
494
  "fflate": "^0.8.2"
495
495
  },
496
496
  "peerDependencies": {
497
- "@intentius/chant": "^0.124.38"
497
+ "@intentius/chant": "^0.124.40"
498
498
  }
499
499
  },
500
500
  "node_modules/@intentius/chant-lexicon-gcp": {
501
- "version": "0.124.38",
502
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.38.tgz",
503
- "integrity": "sha512-4DQlfww4TAq3pVGOOV7Eys+lvcRT4Azp4t+DIcKYZhGH0BRZPSr5eUhboAWOgTLyqjQOqFIdy1ueNgWNtVUUTg==",
501
+ "version": "0.124.40",
502
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.40.tgz",
503
+ "integrity": "sha512-RgsDWwSzoKIclMqVRiUqzsJ7dsMlHhUrFjOTFIpqn+mZq9azQDZFhIwYxR+wX+3qc2EWwl8RlVg6tAVvw6z1DA==",
504
504
  "license": "Apache-2.0",
505
505
  "dependencies": {
506
506
  "@types/js-yaml": "^4.0.9",
@@ -508,7 +508,7 @@
508
508
  "js-yaml": "^4.3.1"
509
509
  },
510
510
  "peerDependencies": {
511
- "@intentius/chant": "^0.124.38"
511
+ "@intentius/chant": "^0.124.40"
512
512
  }
513
513
  },
514
514
  "node_modules/@types/js-yaml": {
@@ -8,9 +8,9 @@
8
8
  "front-door": "tsx scripts/front-door.ts all --out export"
9
9
  },
10
10
  "dependencies": {
11
- "@intentius/chant": "^0.124.38",
12
- "@intentius/chant-lexicon-aws": "^0.124.38",
13
- "@intentius/chant-lexicon-azure": "^0.124.38",
14
- "@intentius/chant-lexicon-gcp": "^0.124.38"
11
+ "@intentius/chant": "^0.124.40",
12
+ "@intentius/chant-lexicon-aws": "^0.124.40",
13
+ "@intentius/chant-lexicon-azure": "^0.124.40",
14
+ "@intentius/chant-lexicon-gcp": "^0.124.40"
15
15
  }
16
16
  }