-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AWS+MySQL Rotator Agent #2
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fc86da8
Add js extensions to agent-core imports
nmanoogian 57c1568
Remove node resolution flag from http-postgres-rotator
nmanoogian 8f5a2fa
Update processRequest to accept remote or local keyset override
nmanoogian daaf182
Add utils/aws for fetching the keyset from S3
nmanoogian 3b99c90
Add aws-mysql-rotator agent
nmanoogian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM node:16-alpine as build | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Copy package files and install all dependencies | ||
COPY ./package*.json ./ | ||
COPY ./agent-core/package*.json ./agent-core/ | ||
COPY ./rotators/mysql/package*.json ./rotators/mysql/ | ||
COPY ./utils/aws/package*.json ./utils/aws/ | ||
COPY ./apps/aws-mysql-rotator/package*.json ./apps/aws-mysql-rotator/ | ||
RUN npm install --workspace apps/aws-mysql-rotator | ||
|
||
# Copy sources | ||
COPY ./tsconfig* ./ | ||
COPY ./agent-core ./agent-core | ||
COPY ./rotators/mysql ./rotators/mysql | ||
COPY ./utils/aws ./utils/aws | ||
COPY ./apps/aws-mysql-rotator ./apps/aws-mysql-rotator | ||
|
||
# Build dependencies and app | ||
RUN npm --prefix ./agent-core run build | ||
RUN npm --prefix ./rotators/mysql run build | ||
RUN npm --prefix ./utils/aws run build | ||
RUN npm --prefix ./apps/aws-mysql-rotator run build | ||
|
||
# Remove node_modules to be reinstalled later | ||
RUN rm -r node_modules | ||
|
||
FROM public.ecr.aws/lambda/nodejs:16 | ||
|
||
WORKDIR ${LAMBDA_TASK_ROOT} | ||
|
||
COPY --from=build /usr/src/app . | ||
|
||
# Only install production dependencies | ||
RUN npm clean-install --production | ||
|
||
CMD [ "apps/aws-mysql-rotator/dist/app.handler" ] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { JWKSOption, processRequest } from "agent-core"; | ||
import mysqlHandler from "mysql-rotator"; | ||
import { fetchS3KeySet } from "aws-utils"; | ||
|
||
export async function handler(event: { body: string }) { | ||
let keySetOption: JWKSOption; | ||
if (process.env.OVERRIDE_KEY_SET) { | ||
keySetOption = { type: "local", keySet: JSON.parse(process.env.OVERRIDE_KEY_SET) }; | ||
} else { | ||
keySetOption = { type: "local", keySet: await fetchS3KeySet(process.env.OVERRIDE_KEY_SET_S3_BUCKET) }; | ||
} | ||
return await processRequest(event.body, mysqlHandler, { overrideKeySet: keySetOption }); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "aws-mysql-rotator", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"description": "", | ||
"main": "dist/app.js", | ||
"types": "dist/app.d.ts", | ||
"engines": { | ||
"node": "16.x" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"typescript": "^4.6.4" | ||
}, | ||
"dependencies": { | ||
"agent-core": "*", | ||
"mysql-rotator": "*", | ||
"aws-utils": "*" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
}, | ||
"references": [{ "path": "../../agent-core" }, { "path": "../../rotators/mysql" }, { "path": "../../utils/aws" }] | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this Dockerfile is still meant to build a deployable image. We're currently considering switching to S3-based code bundle deployments. If we go that route, not much will change other than this file and some additional deploy scripts.