sanfrancesco / prerendercloud-lambda-edge

Pre-render CloudFront with this Lambda@Edge function. Powered by https://headless-render-api.com (formerly named prerender.cloud from 2016 - 2022)
https://headless-render-api.com
MIT License
206 stars 35 forks source link

Env stages #5

Closed printedheart closed 6 years ago

printedheart commented 6 years ago

Please test as a Feature Integration:

Support for Environment Stages and Colors We have Red, Yellow, Blue, and Green Deployment Environments Red - Dev | Yellow - Stage/Test | Blue/Green - Prod/QA

Added supported environment variables: color="red" stage="dev"

This allows for multiple Lambda Function names as well

Adding the host as a CNAME to Cloudfront works: Ex: red.test.com CNAME/Alias d42mp9zdib7he3.cloudfront.net

================================================== Proof run:

Successfully associated Lambda functions with CloudFront

CLOUDFRONT_DISTRIBUTION_ID="E2NLPLVW7TK8BE" node create-invalidation.js { Location: 'https://cloudfront.amazonaws.com/2017-03-25/distribution/E2NLPLVW7TK8BE/invalidation/I124JZO7DAUL8C', Invalidation: { Id: 'I124JZO7DAUL8C', Status: 'InProgress', CreateTime: 2018-03-19T17:48:02.874Z, InvalidationBatch: { Paths: [Object], CallerReference: '2018-03-19T17:48:02.311Z' } } } colony005:pre-red Fitch$ make deploy node ./validate.js ./node_modules/.bin/serverless deploy Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Service files not changed. Skipping deployment... Service Information service: Lambda-Edge-Prerendercloud stage: red region: us-east-1 stack: Lambda-Edge-Prerendercloud-red api keys: None endpoints: None functions: viewerRequest: Lambda-Edge-Prerendercloud-red-viewerRequest originRequest: Lambda-Edge-Prerendercloud-red-originRequest CLOUDFRONT_DISTRIBUTION_ID="E2NLPLVW7TK8BE" node deploy.js Lambda-Edge-Prerendercloud-red-viewerRequest Lambda-Edge-Prerendercloud-red-originRequest [ { FunctionName: 'Lambda-Edge-Prerendercloud-red-viewerRequest', EventType: 'viewer-request' }, { FunctionName: 'Lambda-Edge-Prerendercloud-red-originRequest', EventType: 'origin-request' } ] before [] after [ { EventType: 'viewer-request', LambdaFunctionARN: 'arn:aws:lambda:us-east-1:422025336571:function:Lambda-Edge-Prerendercloud-red-viewerRequest:49' }, { EventType: 'origin-request', LambdaFunctionARN: 'arn:aws:lambda:us-east-1:422025336571:function:Lambda-Edge-Prerendercloud-red-originRequest:49' } ]

jotto commented 6 years ago

why delete?

jotto commented 6 years ago

errr, why did you close?

printedheart commented 6 years ago

I found errors in testing. Just submitted #6 Sill have some error control work to do: Programmatically cleanup failed CloudFormation Deletions --stuck sls buckets --stuck lambda from cloudfront publish invalidations --checks for invalidations on cloudfront