# The name of your project service: **project** # Plugins for additional Serverless functionality plugins: - serverless-s3-deploy - serverless-plugin-scripts # Configuration for AWS provider: name: aws runtime: nodejs8.10 profile: serverless # Some future functionality requires us to use us-east-1 at this time region: us-east-1 # This enables us to use the default stage definition, but override it from the command line stage: ${opt:stage, self:provider.stage} # This enables us to prepend the stage name for non-production environments domain: fulldomain: prod: ${self:custom.domain.domain} other: ${self:custom.stage}.${self:custom.domain.domain} # This value has been customised so I can maintain multiple demonstration sites domain: ${self:custom.postname}.${self:custom.domain.zonename} domainname: ${self:custom.domain.fulldomain.${self:custom.stage}, self:custom.domain.fulldomain.other} # DNS Zone name (this is only required so I can maintain multiple demonstration sites) zonename: alphageek.com.au cacheControlMaxAgeHTMLByStage: # HTML Cache time for production environment prod: 3600 # HTML Cache time for other environments other: 0 cacheControlMaxAgeHTML: ${self:custom.domain.cacheControlMaxAgeHTMLByStage.${self:custom.stage}, self:custom.domain.cacheControlMaxAgeHTMLByStage.other} sslCertificateARN: arn:aws:acm:us-east-1:165657443288:certificate/61d202ea-12f2-4282-b602-9c3b83183c7a assets: targets: # Configuration for HTML files (overriding the default cache control age) - bucket: Ref: WebsiteS3Bucket files: - source: ./public/ headers: CacheControl: max-age=${self:custom.domain.cacheControlMaxAgeHTML} empty: true globs: - '**/*.html' # Configuration for all assets - bucket: Ref: WebsiteS3Bucket files: - source: ./public/ empty: true globs: - '**/*.js' - '**/*.css' - '**/*.jpg' - '**/*.png' - '**/*.gif' scripts: hooks: # Run these commands when creating the deployment artifacts package:createDeploymentArtifacts: > hexo clean && hexo generate # Run these commands after infrastructure changes have been completed deploy:finalize: > sls s3deploy -s ${self:custom.stage} # AWS Region to S3 website hostname mapping s3DNSName: us-east-2: s3-website.us-east-2.amazonaws.com us-east-1: s3-website-us-east-1.amazonaws.com us-west-1: s3-website-us-west-1.amazonaws.com us-west-2: s3-website-us-west-2.amazonaws.com ap-south-1: s3-website.ap-south-1.amazonaws.com ap-northeast-3: s3-website.ap-northeast-3.amazonaws.com ap-northeast-2: s3-website.ap-northeast-2.amazonaws.com ap-southeast-1: s3-website-ap-southeast-1.amazonaws.com ap-southeast-2: s3-website-ap-southeast-2.amazonaws.com ap-northeast-1: s3-website-ap-northeast-1.amazonaws.com ca-central-1: s3-website.ca-central-1.amazonaws.com eu-central-1: s3-website.eu-central-1.amazonaws.com eu-west-1: s3-website-eu-west-1.amazonaws.com eu-west-2: s3-website.eu-west-2.amazonaws.com eu-west-3: s3-website.eu-west-3.amazonaws.com eu-north-1: s3-website.eu-north-1.amazonaws.com sa-east-1: s3-website-sa-east-1.amazonaws.com # Determine what resources file to include based on the current stage customConfigFile: ${self:custom.customConfigFiles.${self:custom.stage}, self:custom.customConfigFiles.other} customConfigFiles: prod: prod other: other # Define the resources we will need to host the site resources: # Include the resources file - ${file(config/resources.yml)} # Include the outputs file - ${file(config/outputs.yml)} # Include a custom configuration file based on the environment - ${file(config/resources/environment/${self:custom.customConfigFile}.yml)}