Skip to content

Commit 8f2866b

Browse files
authored
feat: Add nodejs10.x layers (#49)
* feat: Add nodejs10.x layers Closes #48 * Update README * More README updates
1 parent 2400709 commit 8f2866b

File tree

4 files changed

+85
-6
lines changed

4 files changed

+85
-6
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ jobs:
6767
name: Publish layers
6868
command: ./publish-layers.sh nodejs8.10
6969

70+
publish-njs10:
71+
docker:
72+
- image: circleci/node:10-stretch
73+
working_directory: ~/circleci-deployment
74+
steps:
75+
- checkout
76+
- run: sudo apt-get install -y python3-pip
77+
- run:
78+
name: Install publish dependencies
79+
command: sudo pip3 install -U awscli
80+
- run:
81+
name: Publish layers
82+
command: ./publish-layers.sh nodejs10.x
83+
7084
workflows:
7185
version: 2
7286
all:
@@ -112,3 +126,12 @@ workflows:
112126
ignore: /.*/
113127
tags:
114128
only: /^v.*/
129+
- publish-njs10:
130+
requires:
131+
- install
132+
- test
133+
filters:
134+
branches:
135+
ignore: /.*/
136+
tags:
137+
only: /^v.*/

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
IOpipe Agent & Tracing Plugin
1+
IOpipe Agent & Bundled Plugins
22
-----------------------------
33

44
[![npm version](https://badge.fury.io/js/%40iopipe%2Fiopipe.svg)](https://badge.fury.io/js/%40iopipe%2Fiopipe)
55
[![Slack](https://img.shields.io/badge/chat-slack-ff69b4.svg)](https://iopipe.now.sh/)
66
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
77

8-
This package provides the IOpipe agent and the tracing plugin pre-bundled.
8+
This package provides the IOpipe agent and plugins pre-bundled.
99

1010
# Installation & usage
1111

@@ -21,9 +21,9 @@ Or via yarn:
2121
yarn add @iopipe/iopipe
2222
```
2323

24-
Then require this module, passing it an object with your project token ([register for access](https://www.iopipe.com)), and it will automatically monitor and collect metrics from your applications running on AWS Lambda.
24+
Then require this module, passing it an object with your project token ([get a free account](https://www.iopipe.com)), and it will automatically monitor and collect metrics from your applications running on AWS Lambda.
2525

26-
If you are using the Serverless Framework to deploy your lambdas, check out our [serverless plugin](https://github.com/iopipe/serverless-plugin-iopipe).
26+
If you are using the Serverless Framework to deploy your lambdas, check out our [serverless plugin](https://github.com/iopipe/serverless-iopipe-layers).
2727

2828
Example:
2929

@@ -35,9 +35,12 @@ exports.handler = iopipe((event, context) => {
3535
});
3636
```
3737

38-
By default this package will enable @iopipe/trace and @iopipe/event-info plugins. For more information on how to use IOpipe and these plugins, see the documentation below:
38+
By default this package will enable `@iopipe/trace` and `@iopipe/event-info` plugins. It also includes the `@iopipe/profiler` plugin, which is disabled by default. For more information on how to use IOpipe and these plugins, see the documentation below:
39+
3940
- [IOpipe Documentation](https://github.com/iopipe/iopipe-js-core#readme)
4041
- [IOpipe Tracing Plugin Documentation](https://github.com/iopipe/iopipe-plugin-trace#readme)
42+
- [IOpipe Event Info Plugin Documentation](https://github.com/iopipe/iopipe-plugin-event-info#readme)
43+
- [IOpipe Profiler Plugin Documentation](https://github.com/iopipe/iopipe-plugin-profiler#readme)
4144

4245
Example With Tracing, Custom Metrics, and Labels (ES6 Module Format):
4346

@@ -65,6 +68,7 @@ exports.handler = iopipe()(async (event, context) => {
6568

6669
IOpipe publishes [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) which are publicly available on AWS. Using a framework that supports lambda layers (such as SAM or Serverless), you can use the following ARNs for your runtime:
6770

71+
* nodejs10.x: `arn:aws:lambda:$REGION:146318645305:layer:IOpipeNodeJS10:$VERSION_NUMBER`
6872
* nodejs8.10: `arn:aws:lambda:$REGION:146318645305:layer:IOpipeNodeJS810:$VERSION_NUMBER`
6973
* nodejs6.10: `arn:aws:lambda:$REGION:146318645305:layer:IOpipeNodeJS610:$VERSION_NUMBER`
7074

latest-layer-arns.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ REGIONS=(
1818
us-west-2
1919
)
2020

21+
echo "### Lambda Layer ARNs"
22+
echo ""
23+
24+
echo "nodejs10.x:"
25+
echo ""
26+
27+
for region in "${REGIONS[@]}"; do
28+
latest_arn=$(aws --region $region lambda list-layer-versions --layer-name IOpipeNodeJS10 --output text --query "LayerVersions[0].LayerVersionArn")
29+
echo "* ${region}: \`${latest_arn}\`"
30+
done
31+
32+
echo ""
2133
echo "nodejs8.10:"
2234
echo ""
2335

publish-layers.sh

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
NODEJS610_DIST=dist/nodejs610.zip
44
NODEJS810_DIST=dist/nodejs810.zip
5+
NODEJS10_DIST=dist/nodejs10.zip
56

67
REGIONS=(
78
ap-northeast-1
@@ -25,7 +26,7 @@ rm -rf dist
2526
mkdir -p dist
2627

2728
function usage {
28-
echo "./publish-layers.sh [nodejs6.10|nodejs8.10]"
29+
echo "./publish-layers.sh [nodejs6.10|nodejs8.10|nodejs10.x]"
2930
exit 1
3031
}
3132

@@ -108,6 +109,45 @@ case "$1" in
108109
echo "Public permissions set for nodejs8.10 Layer version ${nodejs810_version} in region ${region}"
109110
done
110111
;;
112+
"nodejs10.x")
113+
echo "Building iopipe Layer for nodejs10.x"
114+
npm install --prefix nodejs @iopipe/iopipe
115+
zip -rq $NODEJS10_DIST nodejs
116+
rm -rf nodejs package-lock.json
117+
echo "Build complete: ${NODEJS10_DIST}"
118+
119+
nodejs10_hash=$(git rev-parse HEAD)
120+
nodejs10_s3key="iopipe-nodejs10.x/${nodejs10_hash}.zip"
121+
122+
for region in "${REGIONS[@]}"; do
123+
bucket_name="iopipe-layers-${region}"
124+
125+
echo "Uploading ${NODEJS10_DIST} to s3://${bucket_name}/${nodejs10_s3key}"
126+
aws --region $region s3 cp $NODEJS10_DIST "s3://${bucket_name}/${nodejs10_s3key}"
127+
128+
echo "Publishing nodejs10.x layer to ${region}"
129+
nodejs10_version=$(aws lambda publish-layer-version \
130+
--layer-name IOpipeNodeJS10 \
131+
--content "S3Bucket=${bucket_name},S3Key=${nodejs10_s3key}" \
132+
--description "IOpipe Layer for Node 10" \
133+
--compatible-runtimes nodejs10.x \
134+
--license-info "Apache 2.0" \
135+
--region $region \
136+
--output text \
137+
--query Version)
138+
echo "published nodejs10.x layer version ${nodejs10_version} to ${region}"
139+
140+
echo "Setting public permissions for nodejs10.x layer version ${nodejs10_version} in ${region}"
141+
aws lambda add-layer-version-permission \
142+
--layer-name IOpipeNodeJS10 \
143+
--version-number $nodejs10_version \
144+
--statement-id public \
145+
--action lambda:GetLayerVersion \
146+
--principal "*" \
147+
--region $region
148+
echo "Public permissions set for nodejs10.x Layer version ${nodejs10_version} in region ${region}"
149+
done
150+
;;
111151
*)
112152
usage
113153
;;

0 commit comments

Comments
 (0)