-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3115 from Zemnmez/staging-zemn-me
add staging.zemn.me
- Loading branch information
Showing
7 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * as staging from 'ts/pulumi/me/zemn/staging'; | ||
export * as zone from 'ts/pulumi/me/zemn/zone'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("//ts:rules.bzl", "ts_project") | ||
load("//ts/next.js:rules.bzl", "next_project") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
ts_project( | ||
name = "staging", | ||
data = ["//ts/pulumi/me/zemn/staging/public:public_next"], | ||
deps = [ | ||
"//:node_modules/@pulumi/aws-static-website", | ||
"//:node_modules/@pulumi/pulumi", | ||
"//:node_modules/@pulumi/aws", | ||
"//ts/pulumi/me/zemn/zone" | ||
], | ||
assets = glob(["**/*.css"]) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as aws from '@pulumi/aws'; | ||
import * as staticwebsite from '@pulumi/aws-static-website'; | ||
import * as pulumi from '@pulumi/pulumi'; | ||
import * as asset from '@pulumi/pulumi/asset'; | ||
import * as zone from 'ts/pulumi/me/zemn/zone'; | ||
|
||
const domainName = pulumi.interpolate`staging.${zone.zone.name}`; | ||
|
||
export const cert = new aws.acm.Certificate('staging.zemn.me_cert', { | ||
domainName: domainName, | ||
validationMethod: 'DNS', | ||
}); | ||
|
||
const second = 1; | ||
const minute = 60 * second; | ||
|
||
// this code seems stupid but you can't iterate over a list | ||
// in pulumi outputs so it's necessary. | ||
|
||
// NB: number of validations is the number of domains https://github.com/pulumi/pulumi/issues/5736#issuecomment-725767836 | ||
|
||
const record = ( | ||
name: string, | ||
validation: pulumi.Output<aws.types.output.acm.CertificateDomainValidationOption> | ||
) => | ||
new aws.route53.Record(name, { | ||
name: validation.resourceRecordName, | ||
records: [validation.resourceRecordValue], | ||
type: validation.resourceRecordType, | ||
zoneId: zone.zone.zoneId, | ||
ttl: 1 * minute, // because these really don't need to be cached | ||
}); | ||
|
||
export const validation0 = record( | ||
'cert_validation_0', | ||
cert.domainValidationOptions[0] | ||
); | ||
|
||
export const validation = new aws.acm.CertificateValidation('cert-validation', { | ||
certificateArn: cert.arn, | ||
validationRecordFqdns: [validation0.fqdn], | ||
}); | ||
|
||
// should use this one because it waits for the certificate to actualy be validated | ||
export const arn = validation.certificateArn; | ||
|
||
export const site = new staticwebsite.Website('staging.zemn.me', { | ||
withCDN: true, | ||
indexHTML: new asset.FileAsset( | ||
'ts/pulumi/me/zemn/staging/public/out/index.html' | ||
).path, | ||
error404: new asset.FileAsset( | ||
'ts/pulumi/me/zemn/staging/public/out/404.html' | ||
).path, | ||
sitePath: 'ts/pulumi/me/zemn/staging/public/out', | ||
targetDomain: 'staging.zemn.me', | ||
certificateARN: arn, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
load("//ts:rules.bzl", "ts_project") | ||
load("//ts/next.js:rules.bzl", "next_project") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
ts_project( | ||
name = "public", | ||
deps = [ | ||
"//:node_modules/@types/react", | ||
"//:node_modules/next", | ||
"//:node_modules/react", | ||
"//ts/next.js" | ||
], | ||
assets = glob(["**/*.css"]) | ||
) | ||
|
||
next_project( | ||
name = "public_next", | ||
srcs = [":public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { AppProps } from 'next/app'; | ||
import { HeaderTags } from 'ts/next.js'; | ||
|
||
export function App({ Component, pageProps }: AppProps) { | ||
return ( | ||
<> | ||
<HeaderTags /> | ||
<Component {...pageProps} /> | ||
</> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Head from 'next/head'; | ||
|
||
export default function Main() { | ||
return ( | ||
<> | ||
<Head> | ||
<title>zemn.me</title> | ||
</Head> | ||
|
||
<p>This is the staging site for zemn.me! </p> | ||
<p>I am excited to see it work!</p> | ||
</> | ||
); | ||
} |