Skip to content

Commit ffd765b

Browse files
committed
chore: wip
1 parent 3db9a67 commit ffd765b

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

.stacks/core/cloud/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ This package assists you in setting up & maintaining your application's cloud in
55
## ☘️ Features
66

77
- Cloud Creation & Management
8-
- Domain Management
8+
- Web Application Firewall (WAF) Management
9+
- CDN Management
10+
- SSL Certificate Management
11+
- Domain & DNS Management
912
- Stacks Buddy Commands
1013

1114
### TODO

.stacks/core/cloud/bin/deploy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
import * as cdk from 'aws-cdk-lib'
33
import { app as a, services as s } from '@stacksjs/config'
4-
import { StacksCloud } from '../cloud.js'
4+
import { StacksCloud } from '../src/cloud.js'
55

66
const app = new cdk.App()
77
const cloudName = `${a.name ?? 'Stacks'}Cloud`

.stacks/core/cloud/cloud.js renamed to .stacks/core/cloud/src/cloud.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { app } from '@stacksjs/config'
2-
import { publicPath } from '@stacksjs/path'
2+
// import { publicPath } from '@stacksjs/path'
33
import {
44
Duration,
55
Fn,
@@ -35,20 +35,22 @@ export class StacksCloud extends Stack {
3535
validation: acm.CertificateValidation.fromDns(zone), // Use DNS validation
3636
})
3737

38-
const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', {
38+
const webBucket = new s3.Bucket(this, 'WebBucket', {
39+
bucketName: `stacksjs.com-${app.env}-web`,
3940
versioned: true,
4041
removalPolicy: RemovalPolicy.DESTROY,
4142
autoDeleteObjects: true,
4243
})
4344

4445
// Create an S3 bucket for CloudFront access logs
45-
const logBucket = new s3.Bucket(this, 'LogBucket', {
46+
const logsBucket = new s3.Bucket(this, 'LogBucket', {
47+
bucketName: `stacksjs.com-${app.env}-logs`,
4648
removalPolicy: RemovalPolicy.DESTROY,
4749
autoDeleteObjects: true,
4850
objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_PREFERRED,
4951
})
5052

51-
logBucket.addLifecycleRule({
53+
logsBucket.addLifecycleRule({
5254
enabled: true,
5355
expiration: Duration.days(30),
5456
id: 'rule',
@@ -93,7 +95,7 @@ export class StacksCloud extends Stack {
9395
certificate,
9496
originShieldEnabled: true,
9597
enableLogging: true,
96-
logBucket,
98+
logBucket: logsBucket,
9799
httpVersion: cloudfront.HttpVersion.HTTP2_AND_3,
98100
priceClass: cloudfront.PriceClass.PRICE_CLASS_ALL,
99101
enabled: true,
@@ -102,7 +104,7 @@ export class StacksCloud extends Stack {
102104
enableIpv6: true,
103105

104106
defaultBehavior: {
105-
origin: new origins.S3Origin(websiteBucket, {
107+
origin: new origins.S3Origin(webBucket, {
106108
originAccessIdentity,
107109
}),
108110
compress: true,
@@ -149,24 +151,31 @@ export class StacksCloud extends Stack {
149151

150152
// eslint-disable-next-line no-new
151153
new s3deploy.BucketDeployment(this, 'DeployWebsite', {
152-
sources: [s3deploy.Source.asset(publicPath())],
153-
destinationBucket: websiteBucket,
154+
sources: [s3deploy.Source.asset('../../../storage/public')],
155+
destinationBucket: webBucket,
154156
distribution,
155157
distributionPaths: ['/*'],
156158
})
157159

158160
// Prints out the web endpoint to the terminal
159161
// eslint-disable-next-line no-new
160162
new Output(this, 'AppUrl', {
161-
value: distribution.domainName,
163+
value: `https://stacksjs.com`,
162164
description: 'The URL of the deployed application',
163165
})
164166

165-
// Output the nameservers of the hosted zone
167+
// Prints out the web endpoint to the terminal
166168
// eslint-disable-next-line no-new
167-
new Output(this, 'Nameservers', {
168-
value: Fn.join(', ', zone.hostedZoneNameServers),
169-
description: 'Nameservers for the application domain',
169+
new Output(this, 'VanityUrl', {
170+
value: distribution.domainName,
171+
description: 'The vanity URL of the deployed application',
170172
})
173+
174+
// Output the nameservers of the hosted zone
175+
// eslint-disable-next-line no-new
176+
// new Output(this, 'Nameservers', {
177+
// value: Fn.join(', ', zone.hostedZoneNameServers),
178+
// description: 'Nameservers for the application domain',
179+
// })
171180
}
172181
}

0 commit comments

Comments
 (0)