This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use the official lightweight Node.js 12 image. | |
| # https://hub.docker.com/_/node | |
| FROM node:12-slim | |
| # Create and change to the app directory. | |
| WORKDIR /usr/src/app | |
| # Copy application dependency manifests to the container image. | |
| # A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | |
| # Copying this first prevents re-running npm install on every code change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| option_settings: | |
| "aws:elasticbeanstalk:container:php:phpini": | |
| document_root: /public | |
| memory_limit: 512M | |
| "aws:elasticbeanstalk:sqsd": | |
| HttpPath: /worker/queue | |
| "aws:elasticbeanstalk:application:environment": | |
| APP_ENV: production | |
| APP_KEY: base64:44cyzPQ+pYFpDz6VLgH3G9jRGXOmTvQe7mUq/PAqDWU= | |
| DB_HOST: testdb.cvrp0yapqs3p.us-east-1.rds.amazonaws.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| output "cloudfront_url" { | |
| value = "${module.cloudfront-image-compression.cloudfront_url}" | |
| } | |
| output "bucket" { | |
| value = "${module.cloudfront-image-compression.bucket}" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| variable "stack_name" { | |
| type = "string" | |
| } | |
| variable "aws_region" { | |
| type = "string" | |
| } | |
| variable "aws_profile" { | |
| type = "string" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws_profile = "default" | |
| aws_region = "eu-west-2" | |
| stack_name = "images" | |
| domain = "getlionel.com" | |
| subdomain = "images" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider "aws" { | |
| region = "${var.aws_region}" | |
| profile = "${var.aws_profile}" | |
| version = "~> 1.9" | |
| } | |
| provider "aws" { | |
| region = "us-east-1" | |
| profile = "${var.aws_profile}" | |
| alias = "us-east-1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const querystring = require('querystring') | |
| const http = require('http') | |
| const Sharp = require('sharp') | |
| exports.handler = (event, context, callback) => { | |
| const request = event.Records[0].cf.request | |
| console.log(request.uri) | |
| if (request.uri === '/favicon.ico') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var supportsWebp = async function() { | |
| if (!self.createImageBitmap) return false; | |
| const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; | |
| const blob = await fetch(webpData).then(r => r.blob()); | |
| return createImageBitmap(blob).then(() => true, () => false); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use Let's Encrypt certbot to order a free certificate | |
| certbot certonly --non-interactive --manual \ | |
| --manual-auth-hook "./auth-hook.sh UPSERT your_domain.com" \ | |
| --manual-cleanup-hook "./auth-hook.sh DELETE your_domain.com" \ | |
| --preferred-challenge dns \ | |
| --config-dir "./letsencrypt" \ | |
| --work-dir "./letsencrypt" \ | |
| --logs-dir "./letsencrypt" \ | |
| --agree-tos \ | |
| --manual-public-ip-logging-ok \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws route53 wait resource-record-sets-changed --id \ | |
| $(aws route53 change-resource-record-sets --hosted-zone-id \ | |
| "$(aws route53 list-hosted-zones-by-name --dns-name $2. \ | |
| --query HostedZones[0].Id --output text)" \ | |
| --query ChangeInfo.Id \ | |
| --output text \ | |
| --change-batch "{ \ | |
| \"Changes\": [{ \ | |
| \"Action\": \"$1\", \ | |
| \"ResourceRecordSet\": { \ |
NewerOlder