Skip to content

Commit bf3d87f

Browse files
Merge pull request awslabs#290 from awslabs/staging
Merge v3.0.2 to master
2 parents c447bfc + 84bd22c commit bf3d87f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+11021
-14852
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,37 @@ If you have previously set up a v1 developer portal (non-SAM deployed), you will
3030
#### Deploy
3131

3232
Run:
33+
3334
>In the command below, replace the `your-lambda-artifacts-bucket-name` with the name of a bucket that you manage and that already exists. Then, run:
35+
3436
```bash
35-
sam package --template-file ./cloudformation/template.yaml --output-template-file ./cloudformation/packaged.yaml --s3-bucket your-lambda-artifacts-bucket-name
37+
sam package --template-file ./cloudformation/template.yaml \
38+
--output-template-file ./cloudformation/packaged.yaml \
39+
--s3-bucket your-lambda-artifacts-bucket-name
3640
```
3741

38-
Then run:
42+
Then run:
43+
3944
>In the command below, replace the `your-lambda-artifacts-bucket-name` with the name of a bucket that you manage and that already exists, and replace `custom-prefix` with some prefix that is globally unique, like your org name or username. Then, run:
45+
4046
```bash
41-
sam deploy --template-file ./cloudformation/packaged.yaml --stack-name "dev-portal" --s3-bucket your-lambda-artifacts-bucket-name --capabilities CAPABILITY_NAMED_IAM --parameter-overrides DevPortalSiteS3BucketName="custom-prefix-dev-portal-static-assets" ArtifactsS3BucketName="custom-prefix-dev-portal-artifacts" CognitoDomainNameOrPrefix="custom-prefix"
47+
sam deploy --template-file ./cloudformation/packaged.yaml \
48+
--stack-name "dev-portal" \
49+
--s3-bucket your-lambda-artifacts-bucket-name \
50+
--capabilities CAPABILITY_NAMED_IAM \
51+
--parameter-overrides \
52+
DevPortalSiteS3BucketName="custom-prefix-dev-portal-static-assets" \
53+
ArtifactsS3BucketName="custom-prefix-dev-portal-artifacts" \
54+
CognitoDomainNameOrPrefix="custom-prefix"
4255
```
4356

4457
The command will exit when the stack creation is successful. If you'd like to watch it create in real-time, you can log into the cloudformation console.
4558

4659
To get the URL for the newly created developer portal instance, find the websiteURL field in the cloudformation console's outputs or run this command:
4760

4861
```bash
49-
aws cloudformation describe-stacks --query "Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
62+
aws cloudformation describe-stacks --query \
63+
"Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
5064
```
5165

5266
You can override any of the parameters in the template using the `--parameter-overrides key="value"` format. This will be necessary if you intend to deploy several instances of the developer portal or customize some of the features. You can see a full list of overridable parameters in `cloudformation/template.yaml` under the `Parameters` section.

cloudformation/template.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ Parameters:
7272

7373
StaticAssetRebuildMode:
7474
Type: String
75-
Description: By default, a static asset rebuild doesn't overwrite custom-content. Provide the value `overwrite_content` to replace the custom-content with your local version. Don't do this unless you know what you're doing -- all custom changes in your s3 bucket will be lost.
75+
Description: By default, a static asset rebuild doesn't overwrite custom-content. Provide the value `overwrite-content` to replace the custom-content with your local version. Don't do this unless you know what you're doing -- all custom changes in your s3 bucket will be lost.
7676
Default: ''
77+
AllowedValues:
78+
- 'overwrite-content'
79+
- ''
80+
ConstraintDescription: Malformed input - Parameter StaticAssetRebuildMode value must be either 'overwrite-content' or left blank.
7781

7882
MarketplaceSubscriptionTopicProductCode:
7983
Type: String
@@ -108,11 +112,19 @@ Parameters:
108112
Type: String
109113
Description: Only applicable if creating a custom domain name for your dev portal. Defaults to false, and you'll need to provide your own nameserver hosting. If set to true, a Route53 HostedZone and RecordSet are created for you.
110114
Default: 'false'
115+
AllowedValues:
116+
- 'false'
117+
- 'true'
118+
ConstraintDescription: Malformed input - Parameter UseRoute53Nameservers value must be either 'true' or 'false'
111119

112120
DevelopmentMode:
113121
Type: String
114-
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, CORS, etc.) for easier development. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
122+
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, CORS, etc.) for easier development. It also breaks frontend routing (except to /index.html), including deep linking and page refresh. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
115123
Default: 'false'
124+
AllowedValues:
125+
- 'false'
126+
- 'true'
127+
ConstraintDescription: Malformed input - Parameter DevelopmentMode value must be either 'true' or 'false'
116128

117129
Conditions:
118130
UseCustomDomainName: !And [!And [!Not [!Equals [!Ref CustomDomainName, '']], !Not [!Equals [!Ref CustomDomainNameAcmCertArn, '']]], !Condition NotDevelopmentMode]
@@ -1109,20 +1121,20 @@ Resources:
11091121
SupportedIdentityProviders: [ "COGNITO" ] # should (eventually) allow people to add values
11101122
CallbackURL: !If [ DevelopmentMode,
11111123
[
1112-
'http://localhost:3000/login',
1113-
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName ]]
1124+
'http://localhost:3000/index.html?action=login',
1125+
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName, '/index.html?action=login' ]]
11141126
],
11151127
[
1116-
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ], '/login' ]]
1128+
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ], '/index.html?action=login' ]]
11171129
]
11181130
]
11191131
LogoutURL: !If [ DevelopmentMode,
11201132
[
1121-
'http://localhost:3000',
1122-
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName]]
1133+
'http://localhost:3000/index.html?action=logout',
1134+
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName, '/index.html?action=logout' ]]
11231135
],
11241136
[
1125-
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ]]]
1137+
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ], '/index.html?action=logout' ]]
11261138
]
11271139
]
11281140
AllowedOAuthFlowsUserPoolClient: true

dev-portal/.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
NODE_PATH=src/
21
SKIP_PREFLIGHT_CHECK=true

dev-portal/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module.exports = {
3030

3131
// Set this to overwrite-content if you want to reset your custom content back to the defaults. Defaults to ``
3232
// staticAssetRebuildMode: `overwrite-content` // ONLY SET
33+
34+
// AWS SAM CLI profile option: optional specific profile from your AWS credential file. Not used by default
35+
//awsSamCliProfile: "my-profile"
3336
}
3437
```
3538
4. Run `npm run release`. This will build the static assets, deploy them, and generate the `dev-portal/public/config.js` file needed for local development. Take note of the bucket names you use

dev-portal/jsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
3+
"baseUrl": "src",
44
"moduleResolution": "node",
5-
"jsx": "react",
6-
"paths": {
7-
"*": ["src/*"]
8-
}
5+
"jsx": "react"
96
},
107
"exclude": [
118
"node_modules",

0 commit comments

Comments
 (0)