@bitblit/ratchet-epsilon-common 5.0.109 → 5.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -83
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Epsilon
|
|
1
|
+
# Ratchet-Epsilon-Common
|
|
2
2
|
|
|
3
|
-
A tiny library to simplify serving consistent apis from Lambda with OpenAPI
|
|
3
|
+
A tiny library to simplify serving consistent apis from Lambda with OpenAPI (and GraphQL)
|
|
4
4
|
|
|
5
5
|
You may wish to read [the changelog](CHANGELOG.md)
|
|
6
6
|
|
|
@@ -35,87 +35,6 @@ You may wish to read [the changelog](CHANGELOG.md)
|
|
|
35
35
|
- Environmental service
|
|
36
36
|
- Simple redirects
|
|
37
37
|
|
|
38
|
-
# CDK Automatic Construction
|
|
39
|
-
|
|
40
|
-
## Introduction
|
|
41
|
-
|
|
42
|
-
## Prerequisites
|
|
43
|
-
|
|
44
|
-
- Any time you are doing something automated like this, I **HIGHLY RECOMMEND** setting up a billing alert first. Don't
|
|
45
|
-
blame me if you skip this step and then accidentally spend $1,000 next month. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html)
|
|
46
|
-
- CDK V2 must be bootstrapped in your account (https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html)
|
|
47
|
-
-- e.g. (**npx cdk bootstrap aws://1234567890/us-east-1**)
|
|
48
|
-
- The user running the CDK deploy needs -LOTS- of AWS privs (I'll list them all later. For now, assume a bunch)
|
|
49
|
-
- Policy **arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole** must exist (this should be there by default)
|
|
50
|
-
- Policy **arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole** must exist (You may have to create it - see https://docs.aws.amazon.com/batch/latest/userguide/service_IAM_role.html)
|
|
51
|
-
- You should have a VPC that your Lambda's will deploy into, and you should know its id (e.g., **vpc-123456789**)
|
|
52
|
-
- That VPC should have one or more subnets, and you should know their ids (e.g., **05966bfadca940a88**)
|
|
53
|
-
- That VPC should have a security group, which probably should allow outbound traffic if you want your lambda to talk to the internet. You should know its id (e.g., **02a89a55b0f2cb4ae** - leave off the **sg-** prefix)
|
|
54
|
-
|
|
55
|
-
## Api Setup
|
|
56
|
-
|
|
57
|
-
- Your api layer, in addition to depending on Epsilon, will need:
|
|
58
|
-
** "aws-cdk-lib": (Peer version)
|
|
59
|
-
** "constructs": (Peer version)
|
|
60
|
-
\*\* "walk": (Peer version)
|
|
61
|
-
|
|
62
|
-
## Docker setup
|
|
63
|
-
|
|
64
|
-
### .dockerignore
|
|
65
|
-
|
|
66
|
-
In general the docker file needs to be in a folder above both your api and cdk folders, but it must ignore
|
|
67
|
-
the cdk folder in that case or it will infinitely recurse
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
# Need this here to prevent infinite recusion of cdk folder at least
|
|
71
|
-
.github
|
|
72
|
-
.idea
|
|
73
|
-
.yarn
|
|
74
|
-
.git
|
|
75
|
-
modules/cdk
|
|
76
|
-
node_modules
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### DockerFile
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
FROM public.ecr.aws/lambda/nodejs:14
|
|
83
|
-
COPY modules/api/package.json modules/api/gql-codegen.yml modules/api/tsconfig.json ${LAMBDA_TASK_ROOT}/
|
|
84
|
-
COPY modules/api/src ${LAMBDA_TASK_ROOT}/src
|
|
85
|
-
COPY lambda-bootstrap-shell.sh ${LAMBDA_TASK_ROOT}
|
|
86
|
-
RUN npm install -g yarn
|
|
87
|
-
RUN yarn install
|
|
88
|
-
RUN yarn clean-compile
|
|
89
|
-
ENTRYPOINT ["sh","/var/task/lambda-bootstrap-shell.sh"]
|
|
90
|
-
CMD [ "dist/lambda.handler" ]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### lambda-bootstrap-shell.sh
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
#!/bin/sh
|
|
97
|
-
# Based on the default script in public.ecr.aws/lambda/nodejs:14, which is copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
98
|
-
# Modifications copyright Christopher Weiss, 2022
|
|
99
|
-
|
|
100
|
-
if [ -z "${EPSILON_RUNNING_IN_AWS_BATCH}" ]; then
|
|
101
|
-
if [ $# -lt 1 ]; then
|
|
102
|
-
echo "entrypoint requires the handler name to be the first argument" 1>&2
|
|
103
|
-
exit 142
|
|
104
|
-
fi
|
|
105
|
-
export _HANDLER="$1"
|
|
106
|
-
|
|
107
|
-
RUNTIME_ENTRYPOINT=/var/runtime/bootstrap
|
|
108
|
-
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
|
|
109
|
-
exec /usr/local/bin/aws-lambda-rie $RUNTIME_ENTRYPOINT
|
|
110
|
-
else
|
|
111
|
-
exec $RUNTIME_ENTRYPOINT
|
|
112
|
-
fi
|
|
113
|
-
else
|
|
114
|
-
echo "Running Epsilon inside AWS batch - triggering direct $1 $2"
|
|
115
|
-
exec node dist/aws-batch-cli.js --process $1 --data $2
|
|
116
|
-
fi
|
|
117
|
-
```
|
|
118
|
-
|
|
119
38
|
# GraphQL Support (v0.1.x and above)
|
|
120
39
|
|
|
121
40
|
If you are just doing straight GraphQL then you don't really need to use Epsilon at all (I'd recommend just
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-epsilon-common",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.110",
|
|
4
4
|
"description": "Tiny adapter to simplify building API gateway Lambda APIS",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"@aws-sdk/client-sns": "3.658.1",
|
|
67
67
|
"@aws-sdk/client-sqs": "3.658.1",
|
|
68
68
|
"@aws-sdk/types": "3.654.0",
|
|
69
|
-
"@bitblit/ratchet-aws": "5.0.
|
|
70
|
-
"@bitblit/ratchet-common": "5.0.
|
|
71
|
-
"@bitblit/ratchet-misc": "5.0.
|
|
72
|
-
"@bitblit/ratchet-node-only": "5.0.
|
|
69
|
+
"@bitblit/ratchet-aws": "5.0.110",
|
|
70
|
+
"@bitblit/ratchet-common": "5.0.110",
|
|
71
|
+
"@bitblit/ratchet-misc": "5.0.110",
|
|
72
|
+
"@bitblit/ratchet-node-only": "5.0.110",
|
|
73
73
|
"@smithy/abort-controller": "3.1.4",
|
|
74
74
|
"@smithy/smithy-client": "3.3.5",
|
|
75
75
|
"@smithy/util-waiter": "3.1.5",
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@apollo/server": "^4.11.0",
|
|
89
|
-
"@bitblit/ratchet-aws": "5.0.
|
|
90
|
-
"@bitblit/ratchet-common": "5.0.
|
|
91
|
-
"@bitblit/ratchet-misc": "5.0.
|
|
92
|
-
"@bitblit/ratchet-node-only": "5.0.
|
|
89
|
+
"@bitblit/ratchet-aws": "5.0.110",
|
|
90
|
+
"@bitblit/ratchet-common": "5.0.110",
|
|
91
|
+
"@bitblit/ratchet-misc": "5.0.110",
|
|
92
|
+
"@bitblit/ratchet-node-only": "5.0.110",
|
|
93
93
|
"graphql": "^16.9.0"
|
|
94
94
|
},
|
|
95
95
|
"peerDependenciesMeta": {
|