Skip to content

Commit 63bc480

Browse files
committed
Fix support for custom domain name.
In particular, the new optional parameter 'CustomDomain' is added to the PCUI stack to specify the custom domain name.
1 parent f3454dd commit 63bc480

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed

infrastructure/environments/demo-cfn-create-args.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Parameters:
3232
# ParameterValue: arn:aws:iam::xxxxxxxxxx:policy/xxxxxxxxxx
3333
# - ParameterKey: IAMRoleAndPolicyPrefix
3434
# ParameterValue: xxxxxxxxxx
35+
# - ParameterKey: CustomDomain
36+
# ParameterValue: xxxxxxxxxx
3537
Capabilities:
3638
- CAPABILITY_AUTO_EXPAND
3739
- CAPABILITY_NAMED_IAM

infrastructure/environments/demo-cfn-update-args.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Parameters:
3232
UsePreviousValue: true
3333
- ParameterKey: IAMRoleAndPolicyPrefix
3434
UsePreviousValue: true
35+
- ParameterKey: CustomDomain
36+
UsePreviousValue: true
3537
Capabilities:
3638
- CAPABILITY_AUTO_EXPAND
3739
- CAPABILITY_NAMED_IAM

infrastructure/parallelcluster-ui.yaml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ Parameters:
6262
Description: 'Prefix applied to the name of every IAM role and policy (max length: 10). [ParallelCluster >= 3.8.0]'
6363
Default: ''
6464
MaxLength: 10
65+
CustomDomain:
66+
Type: String
67+
Description: (Optional) Custom domain name. If omitted, the default domain name will be used.
68+
Default: ''
6569
Metadata:
6670
AWS::CloudFormation::Interface:
6771
ParameterGroups:
@@ -100,6 +104,10 @@ Metadata:
100104
- IAMRoleAndPolicyPrefix
101105
- PermissionsBoundaryPolicy
102106
- PermissionsBoundaryPolicyPCAPI
107+
- Label:
108+
default: (Optional) Custom Domain
109+
Parameters:
110+
- CustomDomain
103111
- Label:
104112
default: (Debugging only) Infrastructure S3 Bucket
105113
Parameters:
@@ -144,11 +152,13 @@ Conditions:
144152
UsePermissionBoundary: !Not [!Equals [!Ref PermissionsBoundaryPolicy, '']]
145153
UsePermissionBoundaryPCAPI: !Not [!Equals [!Ref PermissionsBoundaryPolicyPCAPI, '']]
146154
UseIAMRoleAndPolicyPrefix: !Not [!Equals [!Ref IAMRoleAndPolicyPrefix, '']]
155+
UseCustomDomain: !Not [!Equals [!Ref CustomDomain, '']]
147156

148157
Mappings:
149158
ParallelClusterUI:
150159
Constants:
151160
Version: 2024.07.1 # format YYYY.MM.REVISION
161+
CustomDomainBasePath: pcui
152162

153163
Resources:
154164

@@ -219,13 +229,22 @@ Resources:
219229
Variables:
220230
API_BASE_URL: !GetAtt [ ParallelClusterApi, Outputs.ParallelClusterApiInvokeUrl ]
221231
API_VERSION: !Ref Version
222-
SITE_URL: !Sub
223-
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui
224-
- Api: !Ref ApiGatewayRestApi
232+
SITE_URL: !If
233+
- UseCustomDomain
234+
- !Sub
235+
- https://${CustomDomain}/${CustomDomainBasePath}
236+
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
237+
- !Sub
238+
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}
239+
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
225240
AUTH_PATH: !If [ UseExistingCognito, !Ref UserPoolAuthDomain, !GetAtt [ Cognito, Outputs.UserPoolAuthDomain ]]
226241
SECRET_ID: !GetAtt UserPoolClientSecret.SecretName
227242
AUDIENCE: !Ref CognitoAppClient
228243
OIDC_PROVIDER: 'Cognito'
244+
API_GATEWAY_BASE_PATH: !If
245+
- UseCustomDomain
246+
- !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ]
247+
- !Ref AWS::NoValue
229248
FunctionName: !Sub
230249
- ParallelClusterUIFun-${StackIdSuffix}
231250
- { StackIdSuffix: !Select [2, !Split ['/', !Ref 'AWS::StackId']] }
@@ -351,7 +370,7 @@ Resources:
351370
Format: '{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","path":"$context.path", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength" }'
352371
RestApiId: !Ref ApiGatewayRestApi
353372
DeploymentId: !Ref ApiGatewayDeployment
354-
StageName: pcui
373+
StageName: !If [ UseCustomDomain, prod, pcui ]
355374
MethodSettings:
356375
- ResourcePath: '/*'
357376
HttpMethod: '*'
@@ -371,9 +390,14 @@ Resources:
371390
ExplicitAuthFlows:
372391
- ALLOW_REFRESH_TOKEN_AUTH
373392
CallbackURLs:
374-
- !Sub
375-
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui/login
376-
- Api: !Ref ApiGatewayRestApi
393+
- !If
394+
- UseCustomDomain
395+
- !Sub
396+
- https://${CustomDomain}/${CustomDomainBasePath}/login
397+
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
398+
- !Sub
399+
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}/login
400+
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
377401
SupportedIdentityProviders:
378402
- COGNITO
379403
UserPoolId: !If [ UseExistingCognito, !Ref UserPoolId, !GetAtt [ Cognito, Outputs.UserPoolId ]]
@@ -1011,9 +1035,14 @@ Outputs:
10111035
Description: 'Url to reach the ParallelCluster UI Site.'
10121036
Export:
10131037
Name: !Sub ${AWS::StackName}-ParallelClusterUISite
1014-
Value: !Sub
1015-
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui
1016-
- Api: !Ref ApiGatewayRestApi
1038+
Value: !If
1039+
- UseCustomDomain
1040+
- !Sub
1041+
- https://${CustomDomain}/${CustomDomainBasePath}
1042+
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
1043+
- !Sub
1044+
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}
1045+
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
10171046
AppClientId:
10181047
Description: The id of the Cognito app client
10191048
Value: !Ref CognitoAppClient

0 commit comments

Comments
 (0)