mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 22:08:03 +00:00
sam deploy refuses a template with any top-level image function unless it is given an image repository, even when that function's Condition is false, so every deploy of the template failed. The video function now lives in video-function.yaml, a nested stack created only when VideoImageUri is set. The release ships it beside template.yaml and the CLI stages both. A new workflow runs the CLI's sam deploy argv against the template with fake credentials and requires it to reach the first upload.
105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
AWSTemplateFormatVersion: "2010-09-09"
|
|
Description: >-
|
|
HyperFrames arm64 chunk renderer: the render handler as a container image, invoked for renderChunk
|
|
only. Nested in template.yaml when VideoImageUri is set; plain CloudFormation, because `sam deploy`
|
|
demands an image repository for any top-level image function, even one whose Condition is false.
|
|
|
|
Parameters:
|
|
ProjectName:
|
|
Type: String
|
|
ImageUri:
|
|
Type: String
|
|
RenderBucket:
|
|
Type: String
|
|
MemorySize:
|
|
Type: Number
|
|
Timeout:
|
|
Type: Number
|
|
ReservedConcurrency:
|
|
Type: Number
|
|
ChromeSource:
|
|
Type: String
|
|
|
|
Conditions:
|
|
HasReservedConcurrency: !Not [!Equals [!Ref ReservedConcurrency, -1]]
|
|
|
|
Resources:
|
|
Role:
|
|
Type: AWS::IAM::Role
|
|
Properties:
|
|
AssumeRolePolicyDocument:
|
|
Version: "2012-10-17"
|
|
Statement:
|
|
- Effect: Allow
|
|
Principal:
|
|
Service: lambda.amazonaws.com
|
|
Action: sts:AssumeRole
|
|
ManagedPolicyArns:
|
|
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AWSXRayDaemonWriteAccess"
|
|
# The render function's S3CrudPolicy plus AbortMultipartUpload, spelled out.
|
|
Policies:
|
|
- PolicyName: render-bucket
|
|
PolicyDocument:
|
|
Version: "2012-10-17"
|
|
Statement:
|
|
- Effect: Allow
|
|
Action:
|
|
- s3:GetObject
|
|
- s3:ListBucket
|
|
- s3:GetBucketLocation
|
|
- s3:GetObjectVersion
|
|
- s3:PutObject
|
|
- s3:PutObjectAcl
|
|
- s3:GetLifecycleConfiguration
|
|
- s3:PutLifecycleConfiguration
|
|
- s3:DeleteObject
|
|
- s3:AbortMultipartUpload
|
|
Resource:
|
|
- !Sub "arn:${AWS::Partition}:s3:::${RenderBucket}"
|
|
- !Sub "arn:${AWS::Partition}:s3:::${RenderBucket}/*"
|
|
Tags:
|
|
- Key: Project
|
|
Value: !Ref ProjectName
|
|
- Key: HyperFramesComponent
|
|
Value: lambda-renderer
|
|
|
|
Function:
|
|
Type: AWS::Lambda::Function
|
|
Properties:
|
|
FunctionName: !Sub "${ProjectName}-video"
|
|
Description: HyperFrames distributed render handler on arm64, invoked for renderChunk only.
|
|
PackageType: Image
|
|
Code:
|
|
ImageUri: !Ref ImageUri
|
|
Architectures: [arm64]
|
|
Role: !GetAtt Role.Arn
|
|
MemorySize: !Ref MemorySize
|
|
Timeout: !Ref Timeout
|
|
ReservedConcurrentExecutions: !If
|
|
- HasReservedConcurrency
|
|
- !Ref ReservedConcurrency
|
|
- !Ref AWS::NoValue
|
|
EphemeralStorage:
|
|
Size: 10240
|
|
TracingConfig:
|
|
Mode: Active
|
|
Environment:
|
|
Variables:
|
|
NODE_OPTIONS: "--enable-source-maps"
|
|
HYPERFRAMES_LAMBDA_CHROME_SOURCE: !Ref ChromeSource
|
|
TMPDIR: /tmp
|
|
HYPERFRAMES_RENDER_BUCKET: !Ref RenderBucket
|
|
HYPERFRAMES_LAMBDA_RESERVED_CONCURRENCY: !Ref ReservedConcurrency
|
|
Tags:
|
|
- Key: Project
|
|
Value: !Ref ProjectName
|
|
- Key: HyperFramesComponent
|
|
Value: lambda-renderer
|
|
|
|
Outputs:
|
|
FunctionArn:
|
|
Value: !GetAtt Function.Arn
|
|
FunctionName:
|
|
Value: !Ref Function
|