@appliance.sh/install-aws 1.9.0 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appliance.sh/install-aws",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Install the Appliance platform on AWS",
5
5
  "repository": "https://github.com/appliance-sh/appliance.sh",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "test": "echo \"Error: no test specified\" && exit 1"
14
14
  },
15
15
  "dependencies": {
16
- "@appliance.sh/sdk": "1.9.0",
16
+ "@appliance.sh/sdk": "1.11.0",
17
17
  "@aws-sdk/client-cloudfront": "^3.955.0",
18
18
  "aws-cdk": "^2.1033.0",
19
19
  "aws-cdk-lib": "^2.230.0",
package/src/index.ts CHANGED
@@ -1,50 +1,15 @@
1
1
  #!/usr/bin/env ts-node
2
2
 
3
- import { ApplianceApiGlobalStackV1 } from './lib/ApplianceApiGlobalStackV1';
4
-
5
3
  export * from './version';
6
4
 
7
5
  import 'source-map-support/register';
8
6
  import * as cdk from 'aws-cdk-lib';
9
- import { ApplianceApiStackV1 } from './lib/ApplianceApiStackV1';
10
- import { ApplianceGlobalStackV1 } from './lib/ApplianceGlobalStackV1';
11
- import { ApplianceBase } from './lib/ApplianceBase';
7
+ import { ApplianceInstaller } from './lib/ApplianceInstaller';
12
8
 
13
9
  const app = new cdk.App();
14
10
 
15
- const stackId = `appliance-api-${`stack`}`;
16
-
17
- const base = new ApplianceBase(app, 'appliance-base', {
18
- env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
19
- });
20
-
21
- const domainName = base.domainName;
22
-
23
- const globalStack = new ApplianceGlobalStackV1(app, `${stackId}-global`, {
24
- env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' },
25
- domain: domainName.valueAsString,
26
- crossRegionReferences: true,
27
- });
28
-
29
- if (!globalStack.hostedZone) throw new Error('Global stack not deployed');
30
- if (!globalStack.cfDistribution) throw new Error('Global stack not deployed');
31
- if (!globalStack.globalCertificate) throw new Error('Global stack not deployed');
32
-
33
- const localApiStack = new ApplianceApiStackV1(app, stackId, {
34
- env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
35
- crossRegionReferences: true,
36
- hostedZone: globalStack.hostedZone,
37
- cfDistribution: globalStack.cfDistribution,
38
- domain: domainName.valueAsString,
39
- });
40
-
41
- if (!localApiStack.apiLambdaUrl) throw new Error('Local API stack not deployed');
11
+ const stackId = `appliance-installer`;
42
12
 
43
- new ApplianceApiGlobalStackV1(app, `${stackId}-api-global`, {
44
- functionUrl: localApiStack.apiLambdaUrl,
45
- globalCertificate: globalStack.globalCertificate,
46
- hostedZone: globalStack.hostedZone,
47
- cfDistribution: globalStack.cfDistribution,
48
- crossRegionReferences: true,
13
+ new ApplianceInstaller(app, stackId, {
49
14
  env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
50
15
  });
@@ -0,0 +1,36 @@
1
+ import * as cdk from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+
4
+ export class ApplianceInstaller extends cdk.Stack {
5
+ public readonly name: cdk.CfnParameter;
6
+ public readonly domainName: cdk.CfnParameter;
7
+ public readonly state: cdk.aws_s3.Bucket;
8
+ public readonly stateBucketArn: cdk.CfnOutput;
9
+
10
+ constructor(scope: Construct, id: string, props: cdk.StackProps = {}) {
11
+ super(scope, id, props);
12
+
13
+ this.name = new cdk.CfnParameter(this, 'name', {
14
+ type: 'String',
15
+ description: 'The name of the appliance stack',
16
+ default: 'stack',
17
+ });
18
+
19
+ this.domainName = new cdk.CfnParameter(this, 'domainName', {
20
+ type: 'String',
21
+ description: 'The domain name of the appliance stack',
22
+ default: 'appliance.sh',
23
+ });
24
+
25
+ this.state = new cdk.aws_s3.Bucket(this, `state`, {
26
+ encryption: cdk.aws_s3.BucketEncryption.S3_MANAGED,
27
+ bucketKeyEnabled: true,
28
+ blockPublicAccess: cdk.aws_s3.BlockPublicAccess.BLOCK_ALL,
29
+ });
30
+
31
+ this.stateBucketArn = new cdk.CfnOutput(this, `state-bucket-arn`, {
32
+ key: 'stateBucketArn',
33
+ value: this.state.bucketArn,
34
+ });
35
+ }
36
+ }