@intentius/behold 0.29.55 → 0.29.57

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 (173) hide show
  1. package/THIRD_PARTY.md +21 -0
  2. package/dist/cli.js +7611 -6919
  3. package/example-three-cloud/azure/composites/container-app-site.ts +77 -0
  4. package/example-three-cloud/azure/src/site.ts +14 -46
  5. package/example-three-cloud/dns/composites/latency-entry.ts +73 -0
  6. package/example-three-cloud/dns/src/route53.ts +9 -39
  7. package/example-three-cloud/gcp/composites/public-cloud-run.ts +102 -0
  8. package/example-three-cloud/gcp/src/site.ts +16 -96
  9. package/licenses/aws-architecture-icons-TERMS.md +19 -0
  10. package/licenses/azure-architecture-icons-Microsoft_Terms_of_Use.pdf +0 -0
  11. package/licenses/azure-architecture-icons-TERMS.md +20 -0
  12. package/licenses/google-cloud-icons-TERMS.md +15 -0
  13. package/package.json +1 -1
  14. package/web/app.js +704 -10
  15. package/web/edge-weight.d.ts +5 -0
  16. package/web/edge-weight.js +71 -0
  17. package/web/edge-weight.test.js +49 -0
  18. package/web/icons/aws/alb.svg +1 -0
  19. package/web/icons/aws/api-gateway.svg +1 -0
  20. package/web/icons/aws/app-runner.svg +1 -0
  21. package/web/icons/aws/appsync.svg +1 -0
  22. package/web/icons/aws/athena.svg +1 -0
  23. package/web/icons/aws/auto-scaling.svg +1 -0
  24. package/web/icons/aws/backup.svg +1 -0
  25. package/web/icons/aws/batch.svg +1 -0
  26. package/web/icons/aws/bedrock-agentcore.svg +1 -0
  27. package/web/icons/aws/bedrock.svg +1 -0
  28. package/web/icons/aws/certificate-manager.svg +1 -0
  29. package/web/icons/aws/cloud-map.svg +1 -0
  30. package/web/icons/aws/cloud.svg +1 -0
  31. package/web/icons/aws/cloudformation.svg +1 -0
  32. package/web/icons/aws/cloudfront.svg +1 -0
  33. package/web/icons/aws/cloudtrail.svg +1 -0
  34. package/web/icons/aws/cloudwatch-alarm.svg +1 -0
  35. package/web/icons/aws/cloudwatch-logs.svg +1 -0
  36. package/web/icons/aws/cloudwatch.svg +1 -0
  37. package/web/icons/aws/codebuild.svg +1 -0
  38. package/web/icons/aws/codecommit.svg +1 -0
  39. package/web/icons/aws/codedeploy.svg +1 -0
  40. package/web/icons/aws/codepipeline.svg +1 -0
  41. package/web/icons/aws/cognito.svg +1 -0
  42. package/web/icons/aws/config.svg +1 -0
  43. package/web/icons/aws/documentdb.svg +1 -0
  44. package/web/icons/aws/dynamodb-table.svg +1 -0
  45. package/web/icons/aws/dynamodb.svg +1 -0
  46. package/web/icons/aws/ebs-volume.svg +1 -0
  47. package/web/icons/aws/ec2-instance.svg +1 -0
  48. package/web/icons/aws/ec2.svg +1 -0
  49. package/web/icons/aws/ecr-registry.svg +1 -0
  50. package/web/icons/aws/ecr.svg +1 -0
  51. package/web/icons/aws/ecs-service.svg +1 -0
  52. package/web/icons/aws/ecs-task.svg +1 -0
  53. package/web/icons/aws/ecs.svg +1 -0
  54. package/web/icons/aws/efs.svg +1 -0
  55. package/web/icons/aws/eks.svg +1 -0
  56. package/web/icons/aws/elastic-beanstalk.svg +1 -0
  57. package/web/icons/aws/elastic-ip.svg +1 -0
  58. package/web/icons/aws/elasticache.svg +1 -0
  59. package/web/icons/aws/elb.svg +1 -0
  60. package/web/icons/aws/emr.svg +1 -0
  61. package/web/icons/aws/eventbridge.svg +1 -0
  62. package/web/icons/aws/firehose.svg +1 -0
  63. package/web/icons/aws/global-accelerator.svg +1 -0
  64. package/web/icons/aws/glue.svg +1 -0
  65. package/web/icons/aws/guardduty.svg +1 -0
  66. package/web/icons/aws/iam.svg +1 -0
  67. package/web/icons/aws/internet-gateway.svg +1 -0
  68. package/web/icons/aws/keyspaces.svg +1 -0
  69. package/web/icons/aws/kinesis.svg +1 -0
  70. package/web/icons/aws/kms.svg +1 -0
  71. package/web/icons/aws/lambda-function.svg +1 -0
  72. package/web/icons/aws/lambda.svg +1 -0
  73. package/web/icons/aws/mq.svg +1 -0
  74. package/web/icons/aws/msk.svg +1 -0
  75. package/web/icons/aws/nat-gateway.svg +1 -0
  76. package/web/icons/aws/neptune.svg +1 -0
  77. package/web/icons/aws/network-acl.svg +1 -0
  78. package/web/icons/aws/network-firewall.svg +1 -0
  79. package/web/icons/aws/opensearch.svg +1 -0
  80. package/web/icons/aws/organizations.svg +1 -0
  81. package/web/icons/aws/rds-instance.svg +1 -0
  82. package/web/icons/aws/rds.svg +1 -0
  83. package/web/icons/aws/redshift.svg +1 -0
  84. package/web/icons/aws/route-53-hosted-zone.svg +1 -0
  85. package/web/icons/aws/route-53.svg +1 -0
  86. package/web/icons/aws/router.svg +1 -0
  87. package/web/icons/aws/s3-bucket.svg +1 -0
  88. package/web/icons/aws/s3.svg +1 -0
  89. package/web/icons/aws/sagemaker.svg +1 -0
  90. package/web/icons/aws/secrets-manager.svg +1 -0
  91. package/web/icons/aws/ses.svg +1 -0
  92. package/web/icons/aws/shield.svg +1 -0
  93. package/web/icons/aws/sns-topic.svg +1 -0
  94. package/web/icons/aws/sns.svg +1 -0
  95. package/web/icons/aws/sqs-queue.svg +1 -0
  96. package/web/icons/aws/sqs.svg +1 -0
  97. package/web/icons/aws/step-functions.svg +1 -0
  98. package/web/icons/aws/systems-manager.svg +1 -0
  99. package/web/icons/aws/transfer-family.svg +1 -0
  100. package/web/icons/aws/transit-gateway.svg +1 -0
  101. package/web/icons/aws/vpc-endpoints.svg +1 -0
  102. package/web/icons/aws/vpc-lattice.svg +1 -0
  103. package/web/icons/aws/vpc.svg +1 -0
  104. package/web/icons/aws/vpn-gateway.svg +1 -0
  105. package/web/icons/aws/waf.svg +1 -0
  106. package/web/icons/azure/app-service-plan.svg +1 -0
  107. package/web/icons/azure/app-services.svg +1 -0
  108. package/web/icons/azure/application-gateway.svg +1 -0
  109. package/web/icons/azure/container-app.svg +1 -0
  110. package/web/icons/azure/container-apps-environment.svg +1 -0
  111. package/web/icons/azure/container-instances.svg +1 -0
  112. package/web/icons/azure/container-registry.svg +1 -0
  113. package/web/icons/azure/cosmos-db.svg +1 -0
  114. package/web/icons/azure/dns-zone.svg +1 -0
  115. package/web/icons/azure/front-door.svg +1 -0
  116. package/web/icons/azure/function-app.svg +1 -0
  117. package/web/icons/azure/kubernetes-service.svg +1 -0
  118. package/web/icons/azure/load-balancer.svg +1 -0
  119. package/web/icons/azure/log-analytics.svg +1 -0
  120. package/web/icons/azure/managed-identity.svg +1 -0
  121. package/web/icons/azure/mysql.svg +1 -0
  122. package/web/icons/azure/nat.svg +1 -0
  123. package/web/icons/azure/network-security-group.svg +1 -0
  124. package/web/icons/azure/postgresql.svg +1 -0
  125. package/web/icons/azure/public-ip.svg +1 -0
  126. package/web/icons/azure/redis.svg +1 -0
  127. package/web/icons/azure/resource-group.svg +1 -0
  128. package/web/icons/azure/route-table.svg +1 -0
  129. package/web/icons/azure/sql-database.svg +1 -0
  130. package/web/icons/azure/sql-server.svg +1 -0
  131. package/web/icons/azure/subnet.svg +1 -0
  132. package/web/icons/azure/subscription.svg +1 -0
  133. package/web/icons/azure/virtual-machine.svg +1 -0
  134. package/web/icons/azure/virtual-network-gateway.svg +1 -0
  135. package/web/icons/azure/virtual-network.svg +1 -0
  136. package/web/icons/gcp/artifact-registry.svg +1 -0
  137. package/web/icons/gcp/bigquery.svg +1 -0
  138. package/web/icons/gcp/bigtable.svg +1 -0
  139. package/web/icons/gcp/certificate-manager.svg +1 -0
  140. package/web/icons/gcp/cloud-armor.svg +1 -0
  141. package/web/icons/gcp/cloud-build.svg +1 -0
  142. package/web/icons/gcp/cloud-composer.svg +1 -0
  143. package/web/icons/gcp/cloud-dns.svg +1 -0
  144. package/web/icons/gcp/cloud-functions.svg +1 -0
  145. package/web/icons/gcp/cloud-load-balancing.svg +1 -0
  146. package/web/icons/gcp/cloud-logging.svg +1 -0
  147. package/web/icons/gcp/cloud-monitoring.svg +1 -0
  148. package/web/icons/gcp/cloud-nat.svg +1 -0
  149. package/web/icons/gcp/cloud-router.svg +1 -0
  150. package/web/icons/gcp/cloud-run.svg +1 -0
  151. package/web/icons/gcp/cloud-scheduler.svg +1 -0
  152. package/web/icons/gcp/cloud-spanner.svg +1 -0
  153. package/web/icons/gcp/cloud-sql.svg +1 -0
  154. package/web/icons/gcp/cloud-storage.svg +1 -0
  155. package/web/icons/gcp/cloud-tasks.svg +1 -0
  156. package/web/icons/gcp/compute-engine.svg +1 -0
  157. package/web/icons/gcp/dataflow.svg +1 -0
  158. package/web/icons/gcp/external-ip.svg +1 -0
  159. package/web/icons/gcp/firestore.svg +1 -0
  160. package/web/icons/gcp/firewall-rules.svg +1 -0
  161. package/web/icons/gcp/gke.svg +1 -0
  162. package/web/icons/gcp/iam.svg +1 -0
  163. package/web/icons/gcp/kms.svg +1 -0
  164. package/web/icons/gcp/memorystore.svg +1 -0
  165. package/web/icons/gcp/persistent-disk.svg +1 -0
  166. package/web/icons/gcp/project.svg +1 -0
  167. package/web/icons/gcp/pubsub.svg +1 -0
  168. package/web/icons/gcp/secret-manager.svg +1 -0
  169. package/web/icons/gcp/vpc.svg +1 -0
  170. package/web/index.html +54 -0
  171. package/web/net-trace.js +649 -0
  172. package/web/net-trace.test.js +180 -0
  173. package/web/view-url.js +12 -7
@@ -0,0 +1,77 @@
1
+ // A website on Azure Container Apps, set up the way a production environment
2
+ // is, as two composites: ContainerAppNetwork, the VNet with a subnet delegated
3
+ // to Container Apps, and ContainerAppSite, an environment in that subnet that
4
+ // ships its logs to a Log Analytics workspace, with an app running as a
5
+ // user-assigned identity.
6
+ // Container Apps brings its own ingress and load balancing, so there is no
7
+ // load balancer to declare.
8
+ //
9
+ // The body is a list of `const`s and a `return`, so `chant build` reads it
10
+ // rather than running it and records which argument fed which field.
11
+ import { Composite } from "@intentius/chant";
12
+ import { LogAnalyticsWorkspace, ManagedIdentity, Subnet, VirtualNetwork, managedEnvironments, containerApps } from "@intentius/chant-lexicon-azure";
13
+
14
+ export interface ContainerAppNetworkProps {
15
+ /** The network is named `<name>-vnet`, its subnet `apps`. */
16
+ name: string;
17
+ location: string;
18
+ addressSpace: string;
19
+ /** The environment's subnet: a /23 or larger, delegated to Container Apps. */
20
+ subnetPrefix: string;
21
+ }
22
+
23
+ /** The VNet a Container Apps environment sits in, with its delegated subnet. */
24
+ export const ContainerAppNetwork = Composite((props: ContainerAppNetworkProps) => {
25
+ const vnet = new VirtualNetwork({ name: `${props.name}-vnet`, location: props.location, addressSpace: { addressPrefixes: [props.addressSpace] } });
26
+ const subnet = new Subnet({
27
+ name: `${props.name}-vnet/apps`,
28
+ addressPrefix: props.subnetPrefix,
29
+ delegations: [{ name: "apps", properties: { serviceName: "Microsoft.App/environments" } }],
30
+ });
31
+ return { vnet, subnet };
32
+ }, "ContainerAppNetwork");
33
+
34
+ export interface ContainerAppSiteProps {
35
+ /** The environment's name; the workspace, network and identity are named after it. */
36
+ name: string;
37
+ /** The app's name. */
38
+ app: string;
39
+ location: string;
40
+ /** The subnet the environment goes in: a ContainerAppNetwork's. */
41
+ subnet: { id: string };
42
+ image: string;
43
+ /** The port the container listens on; ingress forwards to it. */
44
+ port: number;
45
+ replicas: number;
46
+ }
47
+
48
+ export const ContainerAppSite = Composite((props: ContainerAppSiteProps) => {
49
+ const logs = new LogAnalyticsWorkspace({ name: `${props.name}-logs`, location: props.location, sku: { name: "PerGB2018" }, retentionInDays: 30 });
50
+ const identity = new ManagedIdentity({ name: `${props.name}-${props.app}`, location: props.location });
51
+ const env = new managedEnvironments({
52
+ name: props.name,
53
+ location: props.location,
54
+ vnetConfiguration: { infrastructureSubnetId: props.subnet.id, internal: false },
55
+ appLogsConfiguration: {
56
+ destination: "log-analytics",
57
+ logAnalyticsConfiguration: {
58
+ customerId: `[reference(resourceId('Microsoft.OperationalInsights/workspaces', '${props.name}-logs')).customerId]`,
59
+ sharedKey: `[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', '${props.name}-logs'), '2023-09-01').primarySharedKey]`,
60
+ },
61
+ },
62
+ workloadProfiles: [{ name: "Consumption", workloadProfileType: "Consumption" }],
63
+ });
64
+ const app = new containerApps({
65
+ name: props.app,
66
+ location: props.location,
67
+ identity: { type: "UserAssigned", userAssignedIdentities: { [`[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', '${props.name}-${props.app}')]`]: {} } },
68
+ managedEnvironmentId: env.id,
69
+ workloadProfileName: "Consumption",
70
+ configuration: { ingress: { external: true, targetPort: props.port, transport: "auto" } },
71
+ template: {
72
+ containers: [{ name: props.app, image: props.image, resources: { cpu: 0.25, memory: "0.5Gi" } }],
73
+ scale: { minReplicas: props.replicas, maxReplicas: props.replicas },
74
+ },
75
+ });
76
+ return { logs, identity, env, app };
77
+ }, "ContainerAppSite");
@@ -1,52 +1,20 @@
1
- import { LogAnalyticsWorkspace, ManagedIdentity, VirtualNetwork, managedEnvironments, containerApps, output } from "@intentius/chant-lexicon-azure";
1
+ import { output } from "@intentius/chant-lexicon-azure";
2
+ import { ContainerAppNetwork, ContainerAppSite } from "../composites/container-app-site";
2
3
 
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";
4
+ // The website on Azure Container Apps in West Europe, from this project's own
5
+ // composites (../composites/container-app-site.ts): its network, and the site
6
+ // in it.
7
+ export const network = ContainerAppNetwork({ name: "three-cloud", location: "westeurope", addressSpace: "10.40.0.0/16", subnetPrefix: "10.40.0.0/23" });
9
8
 
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({
9
+ export const web = ContainerAppSite({
25
10
  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
- },
11
+ app: "web",
12
+ location: "westeurope",
13
+ subnet: network.subnet,
14
+ image: "traefik/whoami:v1.10",
15
+ port: 80,
16
+ replicas: 1,
49
17
  });
50
18
 
51
19
  // The dns member reads this as its `azureEndpoint` parameter.
52
- export const azureEndpoint = output(app.configuration_ingress_fqdn, "azureEndpoint");
20
+ export const azureEndpoint = output(web.app.configuration_ingress_fqdn, "azureEndpoint");
@@ -0,0 +1,73 @@
1
+ // One cloud's way in through Route 53: a latency record for the shared name,
2
+ // guarded by a health check on that cloud's endpoint. A record whose check
3
+ // fails stops answering, and the other clouds' records take its traffic.
4
+ //
5
+ // Two shapes, by what the cloud hands over. HostnameEntry is for an endpoint
6
+ // with a hostname (a load balancer's, a Container App's): the record is a
7
+ // CNAME to it and the check probes it by name. AddressEntry is for an
8
+ // endpoint that is an IP address (a GCP load balancer): it gets a name of its
9
+ // own, an A record, the latency record points at that name, and the check
10
+ // probes the address.
11
+ //
12
+ // Latency records sharing a name must share a type, which is why the address
13
+ // gets its own A record instead of the latency record being one.
14
+ //
15
+ // The bodies are `const`s and a `return`, so `chant build` reads them rather
16
+ // than running them.
17
+ import { Composite } from "@intentius/chant";
18
+ import { HealthCheck, RecordSet } from "@intentius/chant-lexicon-aws";
19
+
20
+ export interface EntryProps {
21
+ /** The hosted zone's id (`zone.Id`). */
22
+ zoneId: string;
23
+ /** The name every cloud answers for. */
24
+ name: string;
25
+ /** The cloud, as the record's set identifier. */
26
+ id: string;
27
+ /** The AWS region whose latency this record is chosen for. */
28
+ region: string;
29
+ /** The cloud's endpoint: a hostname, or for AddressEntry an IP address. */
30
+ endpoint: string;
31
+ }
32
+
33
+ export const HostnameEntry = Composite((props: EntryProps) => {
34
+ const check = new HealthCheck({
35
+ HealthCheckConfig: { Type: "HTTP", FullyQualifiedDomainName: props.endpoint, ResourcePath: "/", RequestInterval: 10, FailureThreshold: 1 },
36
+ });
37
+ const record = new RecordSet({
38
+ HostedZoneId: props.zoneId,
39
+ Name: props.name,
40
+ Type: "CNAME",
41
+ TTL: "60",
42
+ SetIdentifier: props.id,
43
+ Region: props.region,
44
+ ResourceRecords: [props.endpoint],
45
+ HealthCheckId: check.HealthCheckId,
46
+ });
47
+ return { check, record };
48
+ }, "HostnameEntry");
49
+
50
+ export interface AddressEntryProps extends EntryProps {
51
+ /** The name the address is published under (an A record), which the latency record points at. */
52
+ origin: string;
53
+ /** The port the check probes. */
54
+ port: number;
55
+ }
56
+
57
+ export const AddressEntry = Composite((props: AddressEntryProps) => {
58
+ const check = new HealthCheck({
59
+ HealthCheckConfig: { Type: "HTTP", IPAddress: props.endpoint, Port: props.port, ResourcePath: "/", RequestInterval: 10, FailureThreshold: 1 },
60
+ });
61
+ const origin = new RecordSet({ HostedZoneId: props.zoneId, Name: props.origin, Type: "A", TTL: "60", ResourceRecords: [props.endpoint] });
62
+ const record = new RecordSet({
63
+ HostedZoneId: props.zoneId,
64
+ Name: props.name,
65
+ Type: "CNAME",
66
+ TTL: "60",
67
+ SetIdentifier: props.id,
68
+ Region: props.region,
69
+ ResourceRecords: [props.origin],
70
+ HealthCheckId: check.HealthCheckId,
71
+ });
72
+ return { check, origin, record };
73
+ }, "AddressEntry");
@@ -1,4 +1,5 @@
1
- import { HostedZone, HealthCheck, RecordSet, Parameter } from "@intentius/chant-lexicon-aws";
1
+ import { HostedZone, Parameter } from "@intentius/chant-lexicon-aws";
2
+ import { AddressEntry, HostnameEntry } from "../composites/latency-entry";
2
3
 
3
4
  // Route 53 in front of the three clouds: one latency record per cloud, each
4
5
  // guarded by a health check on that cloud's endpoint. A record whose check
@@ -22,41 +23,10 @@ export const awsEndpoint = new Parameter("String", { description: "The aws membe
22
23
  export const azureEndpoint = new Parameter("String", { description: "The azure member's Container App hostname" });
23
24
  export const gcpEndpoint = new Parameter("String", { description: "The gcp member's load balancer IP address" });
24
25
 
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);
26
+ // One entry per cloud, from this project's own composites
27
+ // (../composites/latency-entry.ts). Azure (West Europe) answers as eu-west-1
28
+ // and GCP (Tokyo) as ap-northeast-1, since latency records name AWS regions.
29
+ const endpoint = (p: Parameter) => p as unknown as string;
30
+ export const aws = HostnameEntry({ zoneId: zone.Id, name: NAME, id: "aws", region: "us-east-1", endpoint: endpoint(awsEndpoint) });
31
+ export const azure = HostnameEntry({ zoneId: zone.Id, name: NAME, id: "azure", region: "eu-west-1", endpoint: endpoint(azureEndpoint) });
32
+ 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 });
@@ -0,0 +1,102 @@
1
+ // A website on Cloud Run behind a global external Application Load Balancer,
2
+ // set up the way production is, as two composites: PrivateEgressNetwork, a
3
+ // custom VPC with a subnet for the service's egress, and PublicCloudRun, the
4
+ // service running as its own service account and reached through a
5
+ // reserved address, a forwarding rule, an HTTP proxy, a URL map, a backend
6
+ // service and a serverless network endpoint group that names it.
7
+ //
8
+ // The body is a list of `const`s and a `return`, so `chant build` reads it
9
+ // rather than running it and records which argument fed which field.
10
+ import { Composite } from "@intentius/chant";
11
+ import {
12
+ BackendService,
13
+ CloudRunServiceComposite,
14
+ ComputeAddress,
15
+ ForwardingRule,
16
+ GCPServiceAccount,
17
+ RegionNetworkEndpointGroup,
18
+ Subnetwork,
19
+ TargetHTTPProxy,
20
+ URLMap,
21
+ VPCNetwork,
22
+ } from "@intentius/chant-lexicon-gcp";
23
+
24
+ export interface PrivateEgressNetworkProps {
25
+ /** The network is named `<name>-vpc`, its subnet `<name>-apps`. */
26
+ name: string;
27
+ region: string;
28
+ /** The subnet a service's egress goes into. */
29
+ subnetCidr: string;
30
+ }
31
+
32
+ /** A custom-mode VPC with one subnet in the region a service sends its egress into. */
33
+ export const PrivateEgressNetwork = Composite((props: PrivateEgressNetworkProps) => {
34
+ const vpc = new VPCNetwork({ metadata: { name: `${props.name}-vpc` }, autoCreateSubnetworks: false, routingMode: "REGIONAL" });
35
+ const subnet = new Subnetwork({ metadata: { name: `${props.name}-apps` }, region: props.region, ipCidrRange: props.subnetCidr, networkRef: { name: vpc.name } });
36
+ return { vpc, subnet };
37
+ }, "PrivateEgressNetwork");
38
+
39
+ export interface PublicCloudRunProps {
40
+ /** The prefix every resource is named with. */
41
+ name: string;
42
+ project: string;
43
+ region: string;
44
+ /** The network its egress goes into: a PrivateEgressNetwork's VPC and subnet. */
45
+ vpc: { name: string };
46
+ subnet: { name: string };
47
+ image: string;
48
+ /** The port the container listens on. */
49
+ port: number;
50
+ instances: number;
51
+ }
52
+
53
+ export const PublicCloudRun = Composite((props: PublicCloudRunProps) => {
54
+ const runtime = new GCPServiceAccount({ metadata: { name: `${props.name}-run` }, displayName: `${props.name} website runtime` });
55
+ const run = CloudRunServiceComposite({
56
+ name: `${props.name}-site`,
57
+ image: props.image,
58
+ projectId: props.project,
59
+ location: props.region,
60
+ port: props.port,
61
+ minInstanceCount: props.instances,
62
+ maxInstanceCount: props.instances,
63
+ publicAccess: true,
64
+ serviceAccount: `${props.name}-run`,
65
+ defaults: {
66
+ service: {
67
+ template: {
68
+ vpcAccess: { egress: "PRIVATE_RANGES_ONLY", networkInterfaces: [{ networkRef: { name: props.vpc.name }, subnetworkRef: { name: props.subnet.name } }] },
69
+ },
70
+ },
71
+ },
72
+ });
73
+ const service = run.service;
74
+ const publicAccess = run.publicIam;
75
+ const neg = new RegionNetworkEndpointGroup({
76
+ metadata: { name: `${props.name}-neg` },
77
+ region: props.region,
78
+ networkEndpointType: "SERVERLESS",
79
+ cloudRun: { serviceRef: { name: service.name } },
80
+ });
81
+ // A backend service over a serverless NEG takes no health check: Cloud Run
82
+ // reports its own readiness.
83
+ const backend = new BackendService({
84
+ metadata: { name: `${props.name}-backend` },
85
+ location: "global",
86
+ loadBalancingScheme: "EXTERNAL_MANAGED",
87
+ protocol: "HTTP",
88
+ backend: [{ group: { networkEndpointGroupRef: { name: neg.name } } }],
89
+ });
90
+ const urlMap = new URLMap({ metadata: { name: `${props.name}-map` }, location: "global", defaultService: { backendServiceRef: { name: backend.name } } });
91
+ const proxy = new TargetHTTPProxy({ metadata: { name: `${props.name}-proxy` }, location: "global", urlMapRef: { name: urlMap.name } });
92
+ const address = new ComputeAddress({ metadata: { name: `${props.name}-ip` }, location: "global" });
93
+ const rule = new ForwardingRule({
94
+ metadata: { name: `${props.name}-rule` },
95
+ location: "global",
96
+ loadBalancingScheme: "EXTERNAL_MANAGED",
97
+ portRange: String(props.port),
98
+ ipAddress: { addressRef: { name: address.name } },
99
+ target: { targetHTTPProxyRef: { name: proxy.name } },
100
+ });
101
+ return { runtime, service, publicAccess, neg, backend, urlMap, proxy, address, rule };
102
+ }, "PublicCloudRun");
@@ -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";
14
-
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";
21
-
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",
1
+ import { output } from "@intentius/chant-lexicon-gcp";
2
+ import { PrivateEgressNetwork, PublicCloudRun } from "../composites/public-cloud-run";
3
+
4
+ // The website on Cloud Run in Tokyo behind a global load balancer, from this
5
+ // project's own composites (../composites/public-cloud-run.ts): its network,
6
+ // and the site that sends its egress into it.
7
+ export const network = PrivateEgressNetwork({ name: "three-cloud", region: "asia-northeast1", subnetCidr: "10.30.0.0/24" });
8
+
9
+ export const web = PublicCloudRun({
10
+ name: "three-cloud",
11
+ project: "three-cloud",
12
+ region: "asia-northeast1",
13
+ vpc: network.vpc,
14
+ subnet: network.subnet,
40
15
  image: "traefik/whoami:v1.10",
41
- projectId: "three-cloud",
42
- location: region,
43
16
  port: 80,
44
- minInstanceCount: 1,
45
- 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 } },
17
+ instances: 1,
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");
@@ -0,0 +1,19 @@
1
+ # AWS Architecture Icons — terms of use
2
+
3
+ Source: https://aws.amazon.com/architecture/icons/ — the "Icon package" asset
4
+ download, release 2026-07-31 (`Icon-package_07312026.zip`), retrieved
5
+ 2026-10-21.
6
+
7
+ The page states:
8
+
9
+ > We allow customers and partners to use these toolkits and assets to create
10
+ > architecture diagrams.
11
+
12
+ > You can also put icons in materials like whitepapers, presentations, data
13
+ > sheets, and posters.
14
+
15
+ behold uses the icons only to draw architecture diagrams of a user's own
16
+ infrastructure: each icon stands for the AWS service or resource it was
17
+ published for, drawn unmodified. "AWS", "Amazon Web Services" and the service
18
+ names are trademarks of Amazon.com, Inc. or its affiliates. The site terms at
19
+ https://aws.amazon.com/terms/ govern the assets.
@@ -0,0 +1,20 @@
1
+ # Azure architecture icons — terms of use
2
+
3
+ Source: https://learn.microsoft.com/azure/architecture/icons/ — "Download SVG
4
+ icons", `Azure_Public_Service_Icons_V24.zip`, retrieved 2026-10-21. The pack's
5
+ own `Microsoft_Terms_of_Use.pdf` is vendored beside this file.
6
+
7
+ The page's icon terms:
8
+
9
+ > Microsoft permits the use of these icons in architectural diagrams, training
10
+ > materials, or documentation. You can copy, distribute, and display the icons
11
+ > only for the permitted use unless granted explicit permission by Microsoft.
12
+ > Microsoft reserves all other rights.
13
+
14
+ and its guidelines: use the icons to illustrate how products work together;
15
+ don't crop, flip, rotate, distort or change their shape; don't use them to
16
+ represent your own product.
17
+
18
+ behold draws the icons, unmodified, in architecture diagrams of a user's own
19
+ Azure resources, each standing for the service it was published for. Microsoft
20
+ and Azure are trademarks of the Microsoft group of companies.
@@ -0,0 +1,15 @@
1
+ # Google Cloud icons — terms of use
2
+
3
+ Source: https://cloud.google.com/icons — `google-cloud-icons.zip`
4
+ (https://cloud.google.com/static/icons/files/google-cloud-icons.zip), retrieved
5
+ 2026-10-21. The pack carries no licence file of its own.
6
+
7
+ Google publishes the icon library for representing Google Cloud products in
8
+ architecture diagrams, and its earlier icon guidance allowed the product logos
9
+ to be used to refer accurately to Google's products, architecture diagrams
10
+ being the example it gave. No current licence text was found at retrieval.
11
+ behold draws each icon,
12
+ unmodified, to stand for the Google Cloud product it was published for, in
13
+ architecture diagrams of a user's own resources. Google Cloud and the product
14
+ names are trademarks of Google LLC. Check https://cloud.google.com/icons for
15
+ the current terms before re-vendoring.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.55",
3
+ "version": "0.29.57",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",