@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.
- package/AGENTS.md +323 -26
- package/THIRD_PARTY.md +21 -0
- package/demos.json +1 -1
- package/dist/cli.js +12393 -8612
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/README.md +10 -10
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-three-cloud/README.md +17 -9
- package/example-three-cloud/aws/chant.config.ts +1 -1
- package/example-three-cloud/aws/site.component.ts +13 -0
- package/example-three-cloud/azure/chant.config.ts +1 -1
- package/example-three-cloud/azure/src/site.component.ts +13 -0
- package/example-three-cloud/azure/src/site.ts +12 -46
- package/example-three-cloud/dns/chant.config.ts +1 -1
- package/example-three-cloud/dns/src/records.component.ts +14 -0
- package/example-three-cloud/dns/src/route53.ts +8 -39
- package/example-three-cloud/gcp/chant.config.ts +1 -1
- package/example-three-cloud/gcp/src/site.component.ts +13 -0
- package/example-three-cloud/gcp/src/site.ts +12 -92
- package/example-three-cloud/package-lock.json +19 -19
- package/example-three-cloud/package.json +4 -4
- package/example-three-cloud/scripts/front-door.ts +89 -15
- package/licenses/aws-architecture-icons-TERMS.md +19 -0
- package/licenses/azure-architecture-icons-Microsoft_Terms_of_Use.pdf +0 -0
- package/licenses/azure-architecture-icons-TERMS.md +20 -0
- package/licenses/google-cloud-icons-TERMS.md +15 -0
- package/package.json +8 -9
- package/web/agent-move.js +60 -0
- package/web/agent-move.test.js +55 -0
- package/web/app.js +1084 -66
- package/web/dots-lod.js +1 -1
- package/web/edge-weight.d.ts +5 -0
- package/web/edge-weight.js +71 -0
- package/web/edge-weight.test.js +49 -0
- package/web/embed.d.ts +3 -0
- package/web/embed.js +5 -3
- package/web/embed.test.js +8 -0
- package/web/icons/aws/alb.svg +1 -0
- package/web/icons/aws/api-gateway.svg +1 -0
- package/web/icons/aws/app-runner.svg +1 -0
- package/web/icons/aws/appsync.svg +1 -0
- package/web/icons/aws/athena.svg +1 -0
- package/web/icons/aws/auto-scaling.svg +1 -0
- package/web/icons/aws/backup.svg +1 -0
- package/web/icons/aws/batch.svg +1 -0
- package/web/icons/aws/bedrock-agentcore.svg +1 -0
- package/web/icons/aws/bedrock.svg +1 -0
- package/web/icons/aws/certificate-manager.svg +1 -0
- package/web/icons/aws/cloud-map.svg +1 -0
- package/web/icons/aws/cloud.svg +1 -0
- package/web/icons/aws/cloudformation.svg +1 -0
- package/web/icons/aws/cloudfront.svg +1 -0
- package/web/icons/aws/cloudtrail.svg +1 -0
- package/web/icons/aws/cloudwatch-alarm.svg +1 -0
- package/web/icons/aws/cloudwatch-logs.svg +1 -0
- package/web/icons/aws/cloudwatch.svg +1 -0
- package/web/icons/aws/codebuild.svg +1 -0
- package/web/icons/aws/codecommit.svg +1 -0
- package/web/icons/aws/codedeploy.svg +1 -0
- package/web/icons/aws/codepipeline.svg +1 -0
- package/web/icons/aws/cognito.svg +1 -0
- package/web/icons/aws/config.svg +1 -0
- package/web/icons/aws/documentdb.svg +1 -0
- package/web/icons/aws/dynamodb-table.svg +1 -0
- package/web/icons/aws/dynamodb.svg +1 -0
- package/web/icons/aws/ebs-volume.svg +1 -0
- package/web/icons/aws/ec2-instance.svg +1 -0
- package/web/icons/aws/ec2.svg +1 -0
- package/web/icons/aws/ecr-registry.svg +1 -0
- package/web/icons/aws/ecr.svg +1 -0
- package/web/icons/aws/ecs-service.svg +1 -0
- package/web/icons/aws/ecs-task.svg +1 -0
- package/web/icons/aws/ecs.svg +1 -0
- package/web/icons/aws/efs.svg +1 -0
- package/web/icons/aws/eks.svg +1 -0
- package/web/icons/aws/elastic-beanstalk.svg +1 -0
- package/web/icons/aws/elastic-ip.svg +1 -0
- package/web/icons/aws/elasticache.svg +1 -0
- package/web/icons/aws/elb.svg +1 -0
- package/web/icons/aws/emr.svg +1 -0
- package/web/icons/aws/eventbridge.svg +1 -0
- package/web/icons/aws/firehose.svg +1 -0
- package/web/icons/aws/global-accelerator.svg +1 -0
- package/web/icons/aws/glue.svg +1 -0
- package/web/icons/aws/guardduty.svg +1 -0
- package/web/icons/aws/iam.svg +1 -0
- package/web/icons/aws/internet-gateway.svg +1 -0
- package/web/icons/aws/keyspaces.svg +1 -0
- package/web/icons/aws/kinesis.svg +1 -0
- package/web/icons/aws/kms.svg +1 -0
- package/web/icons/aws/lambda-function.svg +1 -0
- package/web/icons/aws/lambda.svg +1 -0
- package/web/icons/aws/mq.svg +1 -0
- package/web/icons/aws/msk.svg +1 -0
- package/web/icons/aws/nat-gateway.svg +1 -0
- package/web/icons/aws/neptune.svg +1 -0
- package/web/icons/aws/network-acl.svg +1 -0
- package/web/icons/aws/network-firewall.svg +1 -0
- package/web/icons/aws/opensearch.svg +1 -0
- package/web/icons/aws/organizations.svg +1 -0
- package/web/icons/aws/rds-instance.svg +1 -0
- package/web/icons/aws/rds.svg +1 -0
- package/web/icons/aws/redshift.svg +1 -0
- package/web/icons/aws/route-53-hosted-zone.svg +1 -0
- package/web/icons/aws/route-53.svg +1 -0
- package/web/icons/aws/router.svg +1 -0
- package/web/icons/aws/s3-bucket.svg +1 -0
- package/web/icons/aws/s3.svg +1 -0
- package/web/icons/aws/sagemaker.svg +1 -0
- package/web/icons/aws/secrets-manager.svg +1 -0
- package/web/icons/aws/ses.svg +1 -0
- package/web/icons/aws/shield.svg +1 -0
- package/web/icons/aws/sns-topic.svg +1 -0
- package/web/icons/aws/sns.svg +1 -0
- package/web/icons/aws/sqs-queue.svg +1 -0
- package/web/icons/aws/sqs.svg +1 -0
- package/web/icons/aws/step-functions.svg +1 -0
- package/web/icons/aws/systems-manager.svg +1 -0
- package/web/icons/aws/transfer-family.svg +1 -0
- package/web/icons/aws/transit-gateway.svg +1 -0
- package/web/icons/aws/vpc-endpoints.svg +1 -0
- package/web/icons/aws/vpc-lattice.svg +1 -0
- package/web/icons/aws/vpc.svg +1 -0
- package/web/icons/aws/vpn-gateway.svg +1 -0
- package/web/icons/aws/waf.svg +1 -0
- package/web/icons/azure/app-service-plan.svg +1 -0
- package/web/icons/azure/app-services.svg +1 -0
- package/web/icons/azure/application-gateway.svg +1 -0
- package/web/icons/azure/container-app.svg +1 -0
- package/web/icons/azure/container-apps-environment.svg +1 -0
- package/web/icons/azure/container-instances.svg +1 -0
- package/web/icons/azure/container-registry.svg +1 -0
- package/web/icons/azure/cosmos-db.svg +1 -0
- package/web/icons/azure/dns-zone.svg +1 -0
- package/web/icons/azure/front-door.svg +1 -0
- package/web/icons/azure/function-app.svg +1 -0
- package/web/icons/azure/kubernetes-service.svg +1 -0
- package/web/icons/azure/load-balancer.svg +1 -0
- package/web/icons/azure/log-analytics.svg +1 -0
- package/web/icons/azure/managed-identity.svg +1 -0
- package/web/icons/azure/mysql.svg +1 -0
- package/web/icons/azure/nat.svg +1 -0
- package/web/icons/azure/network-security-group.svg +1 -0
- package/web/icons/azure/postgresql.svg +1 -0
- package/web/icons/azure/public-ip.svg +1 -0
- package/web/icons/azure/redis.svg +1 -0
- package/web/icons/azure/resource-group.svg +1 -0
- package/web/icons/azure/route-table.svg +1 -0
- package/web/icons/azure/sql-database.svg +1 -0
- package/web/icons/azure/sql-server.svg +1 -0
- package/web/icons/azure/subnet.svg +1 -0
- package/web/icons/azure/subscription.svg +1 -0
- package/web/icons/azure/virtual-machine.svg +1 -0
- package/web/icons/azure/virtual-network-gateway.svg +1 -0
- package/web/icons/azure/virtual-network.svg +1 -0
- package/web/icons/gcp/artifact-registry.svg +1 -0
- package/web/icons/gcp/bigquery.svg +1 -0
- package/web/icons/gcp/bigtable.svg +1 -0
- package/web/icons/gcp/certificate-manager.svg +1 -0
- package/web/icons/gcp/cloud-armor.svg +1 -0
- package/web/icons/gcp/cloud-build.svg +1 -0
- package/web/icons/gcp/cloud-composer.svg +1 -0
- package/web/icons/gcp/cloud-dns.svg +1 -0
- package/web/icons/gcp/cloud-functions.svg +1 -0
- package/web/icons/gcp/cloud-load-balancing.svg +1 -0
- package/web/icons/gcp/cloud-logging.svg +1 -0
- package/web/icons/gcp/cloud-monitoring.svg +1 -0
- package/web/icons/gcp/cloud-nat.svg +1 -0
- package/web/icons/gcp/cloud-router.svg +1 -0
- package/web/icons/gcp/cloud-run.svg +1 -0
- package/web/icons/gcp/cloud-scheduler.svg +1 -0
- package/web/icons/gcp/cloud-spanner.svg +1 -0
- package/web/icons/gcp/cloud-sql.svg +1 -0
- package/web/icons/gcp/cloud-storage.svg +1 -0
- package/web/icons/gcp/cloud-tasks.svg +1 -0
- package/web/icons/gcp/compute-engine.svg +1 -0
- package/web/icons/gcp/dataflow.svg +1 -0
- package/web/icons/gcp/external-ip.svg +1 -0
- package/web/icons/gcp/firestore.svg +1 -0
- package/web/icons/gcp/firewall-rules.svg +1 -0
- package/web/icons/gcp/gke.svg +1 -0
- package/web/icons/gcp/iam.svg +1 -0
- package/web/icons/gcp/kms.svg +1 -0
- package/web/icons/gcp/memorystore.svg +1 -0
- package/web/icons/gcp/persistent-disk.svg +1 -0
- package/web/icons/gcp/project.svg +1 -0
- package/web/icons/gcp/pubsub.svg +1 -0
- package/web/icons/gcp/secret-manager.svg +1 -0
- package/web/icons/gcp/vpc.svg +1 -0
- package/web/index.html +98 -9
- package/web/net-trace.js +649 -0
- package/web/net-trace.test.js +180 -0
- package/web/panel.js +28 -4
- package/web/release.js +6 -4
- package/web/release.test.js +2 -2
- package/web/search-view.d.ts +27 -0
- package/web/search-view.js +213 -0
- package/web/search-view.test.js +144 -0
- package/web/shot-frame.d.ts +5 -0
- package/web/shot-frame.js +116 -0
- package/web/shot-frame.test.js +90 -0
- package/web/themes.js +1 -1
- package/web/view-url.d.ts +18 -0
- package/web/view-url.js +162 -10
- package/web/view-url.test.js +72 -1
|
@@ -83,25 +83,25 @@ HCL.
|
|
|
83
83
|
|
|
84
84
|
## It needs the lexicon
|
|
85
85
|
|
|
86
|
-
behold parses no HCL
|
|
87
|
-
`@intentius/chant-lexicon-terraform`,
|
|
88
|
-
a ~1.8 MB wasm blob. Both are
|
|
89
|
-
|
|
90
|
-
|
|
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
|
|
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.
|
|
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
|
|
|
@@ -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
|
|
9
|
-
dns/src/route53.ts
|
|
10
|
-
dns/ops/front-door.op.ts
|
|
11
|
-
aws/src/site.ts
|
|
12
|
-
azure/src/site.ts
|
|
13
|
-
gcp/src/site.ts
|
|
14
|
-
|
|
15
|
-
|
|
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.
|
|
46
|
+
Needs chant 0.124.39 or newer.
|
|
@@ -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 {
|
|
1
|
+
import { ContainerAppNetwork, ContainerAppSite, output } from "@intentius/chant-lexicon-azure";
|
|
2
2
|
|
|
3
|
-
// The website on Azure Container Apps in West Europe,
|
|
4
|
-
//
|
|
5
|
-
|
|
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
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
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 {
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
16
|
-
// its
|
|
17
|
-
|
|
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
|
|
23
|
-
|
|
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
|
-
|
|
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.
|
|
10
|
-
"@intentius/chant-lexicon-aws": "^0.124.
|
|
11
|
-
"@intentius/chant-lexicon-azure": "^0.124.
|
|
12
|
-
"@intentius/chant-lexicon-gcp": "^0.124.
|
|
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.
|
|
448
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.
|
|
449
|
-
"integrity": "sha512-
|
|
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.
|
|
477
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.
|
|
478
|
-
"integrity": "sha512-
|
|
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.
|
|
485
|
+
"@intentius/chant": "^0.124.40"
|
|
486
486
|
}
|
|
487
487
|
},
|
|
488
488
|
"node_modules/@intentius/chant-lexicon-azure": {
|
|
489
|
-
"version": "0.124.
|
|
490
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.
|
|
491
|
-
"integrity": "sha512-
|
|
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.
|
|
497
|
+
"@intentius/chant": "^0.124.40"
|
|
498
498
|
}
|
|
499
499
|
},
|
|
500
500
|
"node_modules/@intentius/chant-lexicon-gcp": {
|
|
501
|
-
"version": "0.124.
|
|
502
|
-
"resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.
|
|
503
|
-
"integrity": "sha512-
|
|
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.
|
|
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.
|
|
12
|
-
"@intentius/chant-lexicon-aws": "^0.124.
|
|
13
|
-
"@intentius/chant-lexicon-azure": "^0.124.
|
|
14
|
-
"@intentius/chant-lexicon-gcp": "^0.124.
|
|
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
|
}
|