Skip to content
Permalink
Browse files

flatten directory structure

  • Loading branch information...
ThatJoeMoore committed Jun 13, 2018
1 parent ef81c5c commit f4a5dc938f790c0f39437045773016042158f589
Showing with 47 additions and 65 deletions.
  1. 0 {infrastructure → .aws-infrastructure}/.gitignore
  2. 0 {infrastructure → .aws-infrastructure}/account-and-iam.yml
  3. +5 −5 {infrastructure → .aws-infrastructure}/deploy-environment.sh
  4. +36 −55 {infrastructure → .aws-infrastructure}/environment-template.mustache.yml
  5. 0 {packages → }/assembler/.dockerignore
  6. 0 {packages → }/assembler/.gitignore
  7. 0 {packages → }/assembler/Dockerfile
  8. 0 {packages → }/assembler/bin/cdn-assembler.js
  9. 0 {packages → }/assembler/codebuild.sh
  10. 0 {packages → }/assembler/index.js
  11. 0 {packages → }/assembler/package.json
  12. 0 {packages → }/assembler/src/aliases.js
  13. 0 {packages → }/assembler/src/assemble-manifest.js
  14. 0 {packages → }/assembler/src/build-layout.js
  15. 0 {packages → }/assembler/src/build-meta.js
  16. 0 {packages → }/assembler/src/constants.js
  17. 0 {packages → }/assembler/src/copy-resources.js
  18. 0 {packages → }/assembler/src/download-sources.js
  19. 0 {packages → }/assembler/src/manifest.js
  20. 0 {packages → }/assembler/src/plan-actions.js
  21. 0 {packages → }/assembler/src/providers/github-provider.js
  22. 0 {packages → }/assembler/src/providers/index.js
  23. 0 {packages → }/assembler/src/providers/npm-provider.js
  24. 0 {packages → }/assembler/src/repo-config.js
  25. 0 {packages → }/assembler/src/upload-files.js
  26. 0 {packages → }/assembler/src/util/basic-usage-processor.js
  27. 0 {packages → }/assembler/src/util/cloudfront.js
  28. 0 {packages → }/assembler/src/util/get-tarball.js
  29. 0 {packages → }/assembler/src/util/globs.js
  30. 0 {packages → }/assembler/src/util/http.js
  31. 0 {packages → }/assembler/src/util/load-github-credentials.js
  32. 0 {packages → }/assembler/src/util/preload-headers.js
  33. 0 {packages → }/assembler/src/util/run-command.js
  34. 0 {packages → }/assembler/src/util/scan-files.js
  35. 0 {packages → }/assembler/src/util/sets.js
  36. 0 {packages → }/assembler/src/util/util.js
  37. 0 {packages → }/assembler/test/fixtures/assertFileStructure.js
  38. 0 {packages → }/assembler/test/src/aliases_test.js
  39. 0 {packages → }/assembler/test/src/assemble-manifest_test.js
  40. 0 {packages → }/assembler/test/src/copy-resources_test.js
  41. 0 {packages → }/assembler/test/src/plan-actions_test.js
  42. 0 {packages → }/assembler/test/src/providers/github-provider_test.js
  43. 0 {packages → }/assembler/test/src/util/basic-usage-processor_test.js
  44. 0 {packages → }/assembler/test/src/util/http_test.js
  45. 0 {packages → }/assembler/yarn.lock
  46. +3 −4 buildspec.yml
  47. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/apply-rules.js
  48. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/cache.js
  49. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/codebuild.sh
  50. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/config.json
  51. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/index.js
  52. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/package.json
  53. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/redirect-handler.js
  54. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/redirect-rules-loader.js
  55. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/test/apply-rules_test.js
  56. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/test/cache_test.js
  57. 0 {packages/alias-resolver-lambda → edge-lambdas/eager-redirect}/yarn.lock
  58. 0 {packages/cors-headers-edge-lambda → edge-lambdas/enhanced-headers}/codebuild.sh
  59. 0 {packages/cors-headers-edge-lambda → edge-lambdas/enhanced-headers}/index.js
  60. 0 {packages/cors-headers-edge-lambda → edge-lambdas/enhanced-headers}/package.json
  61. 0 {packages/cors-headers-edge-lambda → edge-lambdas/enhanced-headers}/test/index_test.js
  62. 0 ...rs-headers-edge-lambda → edge-lambdas/enhanced-headers}/test/requests/theme-specific-version.json
  63. 0 {packages/cors-headers-edge-lambda → edge-lambdas/enhanced-headers}/yarn.lock
  64. +3 −1 lerna.json
  65. 0 {packages → }/webhooks/codebuild.sh
  66. 0 {packages → }/webhooks/lambda.js
  67. 0 {packages → }/webhooks/lib/hooks/github-hook.js
  68. 0 {packages → }/webhooks/lib/http-error.js
  69. 0 {packages → }/webhooks/lib/main-config-loader.js
  70. 0 {packages → }/webhooks/lib/req-defaults.js
  71. 0 {packages → }/webhooks/lib/start-assembler.js
  72. 0 {packages → }/webhooks/local.js
  73. 0 {packages → }/webhooks/package-lock.json
  74. 0 {packages → }/webhooks/package.json
  75. 0 {packages → }/webhooks/webhooks.js
  76. 0 {packages → }/webhooks/yarn.lock
File renamed without changes.
File renamed without changes.
@@ -38,15 +38,15 @@ working=$(pwd)

now=$(date +"%s")

alias_resolver_hash=`packageChecksum packages/alias-resolver-lambda`
alias_resolver_hash_short=`echo ${alias_resolver_hash} | cut -c -6`
eager_redirect_hash=`packageChecksum edge-lambdas/eager-redirect`
eager_redirect_hash_short=`echo ${eager_redirect_hash} | cut -c -6`

cors_hash=`packageChecksum packages/cors-headers-edge-lambda`
cors_hash_short=`echo ${cors_hash} | cut -c -6`
enhanced_headers_hash=`packageChecksum edge-lambdas/enhanced-headers`
enhanced_headers_hash_short=`echo ${enhanced_headers_hash} | cut -c -6`

templateDataFile=/tmp/template-data-$now.json

echo '{ "aliasResolver": { "sha": "'${alias_resolver_hash_short}'" }, "corsHeaders": { "sha": "'${cors_hash_short}'" } }' > ${templateDataFile}
echo '{ "eagerRedirect": { "sha": "'${eager_redirect_hash_short}'" }, "enhancedHeaders": { "sha": "'${enhanced_headers_hash_short}'" } }' > ${templateDataFile}

renderedCfnFile=${here}/environment-template-rendered.yml

@@ -199,7 +199,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${CDNName}-webhooks-${Environment}"
CodeUri: ./../packages/webhooks/
CodeUri: ./../webhooks/
Handler: lambda.handler
Runtime: nodejs6.10
MemorySize: 128
@@ -259,9 +259,9 @@ Resources:
MinTTL: !FindInMap [ NormalCacheTTL, !Ref Environment, min ]
LambdaFunctionAssociations:
- EventType: origin-request
LambdaFunctionARN: !Ref AliasResolverVersion{{aliasResolver.sha}}
LambdaFunctionARN: !Ref EagerRedirectVersion{{eagerRedirect.sha}}
- EventType: origin-response
LambdaFunctionARN: !Ref CorsHeaderVersion{{corsHeaders.sha}}
LambdaFunctionARN: !Ref EnhancedHeadersVersion{{enhancedHeaders.sha}}
CacheBehaviors:
- PathPattern: '/.cdn-infra/*'
AllowedMethods: [GET, HEAD, OPTIONS]
@@ -273,53 +273,10 @@ Resources:
DefaultTTL: !FindInMap [ NormalCacheTTL, !Ref Environment, default ]
MaxTTL: !FindInMap [ NormalCacheTTL, !Ref Environment, max ]
MinTTL: !FindInMap [ NormalCacheTTL, !Ref Environment, min ]
# CacheBehaviors:
# - PathPattern: '/*/latest/*'
# AllowedMethods: [GET, HEAD, OPTIONS]
# Compress: true
# ForwardedValues:
# QueryString: false
# TargetOriginId: only-origin
# ViewerProtocolPolicy: redirect-to-https
# DefaultTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, default ]
# MaxTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, max ]
# MinTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, min ]
# LambdaFunctionAssociations:
# - EventType: origin-request
# LambdaFunctionARN: !Ref AliasResolverVersion{{aliasResolver.sha}}
# - EventType: origin-response
# LambdaFunctionARN: !Ref CorsHeaderVersion{{corsHeaders.sha}}
# - PathPattern: '/*/unstable/*'
# AllowedMethods: [GET, HEAD, OPTIONS]
# Compress: true
# ForwardedValues:
# Headers: [Origin, Access-Control-Request-Headers, Access-Control-Request-Method]
# QueryString: false
# TargetOriginId: only-origin
# ViewerProtocolPolicy: redirect-to-https
# DefaultTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, default ]
# MaxTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, max ]
# MinTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, min ]
# LambdaFunctionAssociations:
# - EventType: origin-request
# LambdaFunctionARN: !Ref AliasResolverVersion{{aliasResolver.sha}}
# - EventType: origin-response
# LambdaFunctionARN: !Ref CorsHeaderVersion{{corsHeaders.sha}}
# - PathPattern: '/*/*.*.x/*'
# AllowedMethods: [GET, HEAD, OPTIONS]
# Compress: true
# ForwardedValues:
# QueryString: false
# TargetOriginId: only-origin
# ViewerProtocolPolicy: redirect-to-https
# DefaultTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, default ]
# MaxTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, max ]
# MinTTL: !FindInMap [ AliasCacheTTL, !Ref Environment, min ]
# LambdaFunctionAssociations:
# - EventType: origin-request
# LambdaFunctionARN: !Ref AliasResolverVersion{{aliasResolver.sha}}
# - EventType: origin-response
# LambdaFunctionARN: !Ref CorsHeaderVersion{{corsHeaders.sha}}
LambdaFunctionAssociations:
- EventType: origin-response
LambdaFunctionARN: !Ref EnhancedHeadersVersion{{enhancedHeaders.sha}}

Logging:
Bucket:
Fn::ImportValue: !Sub "${AccountStackName}-InfraAndLogBucketDomain"
@@ -368,15 +325,27 @@ Resources:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${CDNName}-edge-alias-resolver-${Environment}"
CodeUri: ./../packages/alias-resolver-lambda/
CodeUri: ./../edge-lambdas/eager-redirect/
Handler: index.handler
Runtime: nodejs8.10
MemorySize: 512
Timeout: 20
Role:
Fn::ImportValue: !Sub "${AccountStackName}-EdgeLambdaExecutionRole"

EagerRedirectFunc:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${CDNName}-edge-eager-redirect-${Environment}"
CodeUri: ./../edge-lambdas/eager-redirect/
Handler: index.handler
Runtime: nodejs8.10
MemorySize: 512
Timeout: 20
Role:
Fn::ImportValue: !Sub "${AccountStackName}-EdgeLambdaExecutionRole"

AliasResolverVersion{{aliasResolver.sha}}:
EagerRedirectVersion{{eagerRedirect.sha}}:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref AliasResolverFunc
@@ -385,18 +354,30 @@ Resources:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${CDNName}-edge-cors-headers-${Environment}"
CodeUri: ./../packages/cors-headers-edge-lambda/
CodeUri: ./../edge-lambdas/enhanced-headers/
Handler: index.handler
Runtime: nodejs6.10
MemorySize: 128
Timeout: 20
Role:
Fn::ImportValue: !Sub "${AccountStackName}-EdgeLambdaExecutionRole"

EnhancedHeaderFunc:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${CDNName}-edge-enhanced-headers-${Environment}"
CodeUri: ./../edge-lambdas/enhanced-headers/
Handler: index.handler
Runtime: nodejs6.10
MemorySize: 128
Timeout: 20
Role:
Fn::ImportValue: !Sub "${AccountStackName}-EdgeLambdaExecutionRole"

CorsHeaderVersion{{corsHeaders.sha}}:
EnhancedHeaderVersion{{enhancedHeaders.sha}}:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref CorsHeaderFunc
FunctionName: !Ref EnhancedHeaderFunc

Outputs:
ContentBucket:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -10,20 +10,19 @@ env:
phases:
install:
commands:
- chmod a+x .codebuild/setup.sh && .codebuild/setup.sh
- find . -type f -name '*.sh' ! -path '**/node_modules/**' -exec chmod u+x {} \;
- .codebuild/setup.sh
- pip install awscli --upgrade --user
- mkdir -p /root/.cache/yarn && yarn config set cache-folder /root/.cache/yarn
pre_build:
commands:
- lerna bootstrap
- lerna exec -- chmod a+x ./codebuild.sh
- chmod a+x infrastructure/deploy-environment.sh
build:
commands:
- lerna exec -- ./codebuild.sh
- echo $EXTRA_TAGS
- find ./* -mtime +10950 -exec touch {} \;
- infrastructure/deploy-environment.sh $CDN_NAME $ENV $ROOT_DNS $ACCOUNT_STACK_NAME $CERTIFICATE_ARN $CONFIG_REPO $CONFIG_BRANCH "$EXTRA_TAGS"
- .aws-infrastructure/deploy-environment.sh $CDN_NAME $ENV $ROOT_DNS $ACCOUNT_STACK_NAME $CERTIFICATE_ARN $CONFIG_REPO $CONFIG_BRANCH "$EXTRA_TAGS"


cache:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,9 @@
{
"lerna": "2.4.0",
"packages": [
"packages/*"
"assembler",
"edge-lambdas/*",
"webhooks"
],
"version": "1.0.0",
"npmClient": "yarn",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f4a5dc9

Please sign in to comment.
You can’t perform that action at this time.