Skip to content

Commit cab57be

Browse files
committed
Update to version v5.0.0
1 parent 19cbc3c commit cab57be

38 files changed

+2442
-4338
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
<!-- A clear and concise description of what the bug is. -->
12+
13+
**To Reproduce**
14+
<!-- Steps to reproduce the behavior. -->
15+
16+
**Expected behavior**
17+
<!-- A clear and concise description of what you expected to happen. -->
18+
19+
**Please complete the following information about the solution:**
20+
- [ ] Version: [e.g. v1.0.0]
21+
- [ ] Region: [e.g. us-east-1]
22+
- [ ] Was the solution modified from the version published on this repository?
23+
- [ ] If the answer to the previous question was yes, are the changes available on GitHub?
24+
- [ ] Have you checked your [service quotas](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) for the sevices this solution uses?
25+
- [ ] Were there any errors in the CloudWatch Logs?
26+
27+
**Screenshots**
28+
<!-- If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information). -->
29+
30+
**Additional context**
31+
<!-- Add any other context about the problem here. -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this solution
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12+
13+
**Describe the feature you'd like**
14+
<!-- A clear and concise description of what you want to happen.-->
15+
16+
**Additional context**
17+
<!-- Add any other context or screenshots about the feature request here.-->
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: General question
3+
about: Ask a general question
4+
title: ''
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
**What is your question?**
11+
<!-- Describe your question as detail as possible. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
*Issue #, if available:*
1+
**Issue #, if available:**
2+
<!-- If there're any related issues, please add the issue number here. -->
23

3-
*Description of changes:*
44

55

6+
**Description of changes:**
7+
<!-- Please describe the changes you made -->
8+
9+
10+
**Checklist**
11+
- [ ] :wave: I have run the unit tests, and all unit tests have passed.
12+
- [ ] :warning: This pull request migh incur a breaking change.
13+
614
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [5.0] - 2020-08-31
8+
### Added
9+
- AWS CDK and AWS Solutions Constructs to create AWS CloudFormation template
10+
11+
### Fixed
12+
- Auto WebP does not work properly: [#195](https://github.com/awslabs/serverless-image-handler/pull/195), [#200](https://github.com/awslabs/serverless-image-handler/issues/200), [#205](https://github.com/awslabs/serverless-image-handler/issues/205)
13+
- A bug where base64 encoding containing slash: [#194](https://github.com/awslabs/serverless-image-handler/pull/194)
14+
- Thumbor issues:
15+
- `0` size support: [#183](https://github.com/awslabs/serverless-image-handler/issues/183)
16+
- `convolution` filter does not work: [#187](https://github.com/awslabs/serverless-image-handler/issues/187)
17+
- `fill` filter does not work: [#190](https://github.com/awslabs/serverless-image-handler/issues/190)
18+
- __Note that__ duplicated features has been merged gracefully.
19+
20+
### Removed
21+
- AWS CloudFormation template: `serverless-image-handler.template`
22+
23+
### Changed
24+
- sharp base version (from 0.23.4 to 0.25.4)
25+
- Remove `Promise` to return since `async` functions return promises: [#189](https://github.com/awslabs/serverless-image-handler/issues/189)
26+
- Unit test statement coverage improvement:
27+
- `image-handler.js`: `79.05%` to `100%`
28+
- `image-request.js`: `93.58%` to `100%`
29+
- `thumbor-mapping.js`: `99.29%` to `100%`
30+
- `overall`: `91.55%` to `100%`
31+
732
## [4.2] - 2020-02-06
833
### Added
934
- Honor outputFormat Parameter from the pull request [#117](https://github.com/awslabs/serverless-image-handler/pull/117)
@@ -16,7 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1641
- fix: DeprecationWarning: Buffer() is deprecated from the pull request [#174](https://github.com/awslabs/serverless-image-handler/pull/174)
1742
- Add hex color support for Thumbor ```filters:background_color``` and ```filters:fill``` [#154](https://github.com/awslabs/serverless-image-handler/issues/154)
1843
- Add format and watermark support for Thumbor [#109](https://github.com/awslabs/serverless-image-handler/issues/109), [#131](https://github.com/awslabs/serverless-image-handler/issues/131), [#109](https://github.com/awslabs/serverless-image-handler/issues/142)
19-
* __Note that__ duplicated features has been merged gracefully.
44+
- __Note that__ duplicated features has been merged gracefully.
2045

2146
### Changed
2247
- sharp base version (from 0.23.3 to 0.23.4)

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Serverless Image Handler
22

3-
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44

55
**********************
66
THIRD PARTY COMPONENTS

README.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,84 @@ Published version, additional details and documentation are available here: http
77

88
_Note:_ it is recommend to build the application binary on Amazon Linux.
99

10-
## Building distributable for customization
11-
* Clone the repository, then make the desired code changes
10+
## On This Page
11+
- [Architecture Overview](#architecture-overview)
12+
- [Creating a custom build](#creating-a-custom-build)
13+
- [External Contributors](#external-contributors)
14+
- [License](#license)
15+
16+
## Architecture Overview
17+
![Architecture](architecture.jpeg)
18+
19+
The AWS CloudFormation template deploys an Amazon CloudFront distribution, Amazon API Gateway REST API, and an AWS Lambda function. Amazon CloudFront provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery. The Amazon API Gateway provides endpoint resources and triggers the AWS Lambda function. The AWS Lambda function retrieves the image from the customer's Amazon Simple Storage Service (Amazon S3) bucket and uses Sharp to return a modified version of the image to the API Gateway. Additionally, the solution generates a CloudFront domain name that provides cached access to the image handler API.
20+
21+
_**Note**:_ From v5.0, all AWS CloudFormation template resources are created be [AWS CDK](https://aws.amazon.com/cdk/) and [AWS Solutions Constructs](https://aws.amazon.com/solutions/constructs/). Since the AWS CloudFormation template resources have the same logical ID comparing to v4.x, it makes the solution upgradable mostly from v4.x to v5.
22+
23+
## Creating a custom build
24+
The solution can be deployed through the CloudFormation template available on the solution home page.
25+
To make changes to the solution, download or clone this repo, update the source code and then run the deployment/build-s3-dist.sh script to deploy the updated Lambda code to an Amazon S3 bucket in your account.
26+
27+
### Prerequisites:
28+
* [AWS Command Line Interface](https://aws.amazon.com/cli/)
29+
* Node.js 12.x or later
30+
31+
### 1. Clone the repository
1232
```bash
1333
git clone https://github.com/awslabs/serverless-image-handler.git
1434
```
1535

16-
* Run unit tests to make sure added customization passes the tests:
17-
```
36+
### 2. Run unit tests for customization
37+
Run unit tests to make sure added customization passes the tests:
38+
```bash
1839
cd ./deployment
1940
chmod +x ./run-unit-tests.sh
2041
./run-unit-tests.sh
2142
```
2243

23-
* Create an Amazon S3 Bucket
44+
### 3. Declare environment variables
45+
```bash
46+
export REGION=aws-region-code # the AWS region to launch the solution (e.g. us-east-1)
47+
export DIST_OUTPUT_BUCKET=my-bucket-name # bucket where customized code will reside
48+
export SOLUTION_NAME=my-solution-name # the solution name
49+
export VERSION=my-version # version number for the customized code
2450
```
25-
aws s3 mb s3://my-bucket-us-east-1 --region us-east-1
51+
52+
### 4. Create an Amazon S3 Bucket
53+
The CloudFormation template is configured to pull the Lambda deployment packages from Amazon S3 bucket in the region the template is being launched in. Create a bucket in the desired region with the region name appended to the name of the bucket.
54+
```bash
55+
aws s3 mb s3://$DIST_OUTPUT_BUCKET-$REGION --region $REGION
2656
```
2757

28-
* Navigate to the deployment folder and build the distributable
58+
### 5. Create the deployment packages
59+
Build the distributable:
2960
```bash
3061
chmod +x ./build-s3-dist.sh
31-
./build-s3-dist.sh my-bucket serverless-image-handler my-version
62+
./build-s3-dist.sh $DIST_OUTPUT_BUCKET $SOLUTION_NAME $VERSION
3263
```
3364

34-
> Note: The build-s3-dist script expects the bucket name as one of its parameters, and this value should not include the region suffix.
35-
36-
* Deploy the distributable to an Amazon S3 bucket in your account (you must have the AWS CLI installed)
65+
Deploy the distributable to the Amazon S3 bucket in your account:
3766
```bash
38-
aws s3 cp ./regional-s3-assets/ s3://my-bucket-us-east-1/serverless-image-handler/my-version/ --recursive --acl bucket-owner-full-control
67+
aws s3 sync ./regional-s3-assets/ s3://$DIST_OUTPUT_BUCKET-$REGION/$SOLUTION_NAME/$VERSION/ --recursive --acl bucket-owner-full-control
68+
aws s3 sync ./global-s3-assets/ s3://$DIST_OUTPUT_BUCKET-$REGION/$SOLUTION_NAME/$VERSION/ --recursive --acl bucket-owner-full-control
3969
```
4070

41-
* Get the link of the serverless-image-handler.template uploaded to your Amazon S3 bucket
71+
### 6. Launch the CloudFormation template.
72+
* Get the link of the `serverless-image-handler.template` uploaded to your Amazon S3 bucket.
73+
* Deploy the Serverless Image Handler solution to your account by launching a new AWS CloudFormation stack using the S3 link of the `serverless-image-handler.template`.
4274

43-
* Deploy the Serverless Image Handler solution to your account by launching a new AWS CloudFormation stack using the link of the serverless-image-handler.template
75+
## External Contributors
76+
- [@leviwilson](https://github.com/leviwilson) for [#117](https://github.com/awslabs/serverless-image-handler/pull/117)
77+
- [@rpong](https://github.com/rpong) for [#130](https://github.com/awslabs/serverless-image-handler/pull/130)
78+
- [@harriswong](https://github.com/harriswong) for [#138](https://github.com/awslabs/serverless-image-handler/pull/138)
79+
- [@ganey](https://github.com/ganey) for [#139](https://github.com/awslabs/serverless-image-handler/pull/139)
80+
- [@browniebroke](https://github.com/browniebroke) for [#151](https://github.com/awslabs/serverless-image-handler/pull/151), [#152](https://github.com/awslabs/serverless-image-handler/pull/152)
81+
- [@john-shaffer](https://github.com/john-shaffer) for [#158](https://github.com/awslabs/serverless-image-handler/pull/158)
82+
- [@toredash](https://github.com/toredash) for [#174](https://github.com/awslabs/serverless-image-handler/pull/174), [#195](https://github.com/awslabs/serverless-image-handler/pull/195)
83+
- [@lith-imad](https://github.com/lith-imad) for [#194](https://github.com/awslabs/serverless-image-handler/pull/194)
4484

4585
***
46-
47-
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
86+
## License
87+
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4888

4989
Licensed under the Apache License, Version 2.0 (the "License");
5090
you may not use this file except in compliance with the License.

architecture.jpeg

46.6 KB
Loading

deployment/build-s3-dist.sh

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,16 @@ rm -rf $build_dist_dir
4040
mkdir -p $build_dist_dir
4141

4242
echo "------------------------------------------------------------------------------"
43-
echo "CloudFormation Template"
43+
echo "CloudFormation template with CDK and Constructs"
4444
echo "------------------------------------------------------------------------------"
45-
cp $template_dir/serverless-image-handler.template $template_dist_dir/
45+
export BUCKET_NAME=$1
46+
export SOLUTION_NAME=$2
47+
export VERSION=$3
4648

47-
replace="s/%%BUCKET_NAME%%/$1/g"
48-
echo "sed -i -e $replace"
49-
sed -i -e $replace $template_dist_dir/serverless-image-handler.template
50-
51-
replace="s/%%SOLUTION_NAME%%/$2/g"
52-
echo "sed -i -e $replace"
53-
sed -i -e $replace $template_dist_dir/serverless-image-handler.template
54-
55-
replace="s/%%VERSION%%/$3/g"
56-
echo "sed -i -e $replace"
57-
sed -i -e $replace $template_dist_dir/serverless-image-handler.template
58-
59-
cp $template_dist_dir/serverless-image-handler.template $build_dist_dir/
49+
cd $source_dir/constructs
50+
npm install
51+
npm run build && cdk synth --asset-metadata false --path-metadata false --version-reporting false --json true > serverless-image-handler.json
52+
mv serverless-image-handler.json $template_dist_dir/serverless-image-handler.template
6053

6154
echo "------------------------------------------------------------------------------"
6255
echo "Package the image-handler code"

deployment/manifest-generator/app.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)