-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add worker lambda template that's deployed by AWS CDK (#395)
Co-authored-by: Ryan Ling <[email protected]>
- Loading branch information
1 parent
f496b80
commit 13b3bce
Showing
20 changed files
with
1,191 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'skuba': minor | ||
--- | ||
|
||
**template/lambda-sqs-worker-cdk:** Add new template |
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
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"incremental": true, | ||
"moduleResolution": "node" | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true | ||
}, | ||
"extends": "tsconfig-seek" | ||
} |
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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# managed by skuba | ||
.cdk.staging/ | ||
.idea/ | ||
.serverless/ | ||
.vscode/ | ||
cdk.out/ | ||
node_modules*/ | ||
|
||
/coverage*/ | ||
|
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,61 @@ | ||
dev-agent: &dev-agent | ||
agents: | ||
queue: <%- devBuildkiteQueueName %> | ||
|
||
prod-agent: &prod-agent | ||
agents: | ||
queue: <%- prodBuildkiteQueueName %> | ||
|
||
plugins: &plugins #alias for shared plugins | ||
seek-oss/aws-sm#v2.3.1: | ||
env: | ||
NPM_TOKEN: 'arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token' | ||
docker#v3.8.0: | ||
volumes: | ||
- /workdir/node_modules | ||
- /workdir/lib | ||
environment: | ||
- NPM_TOKEN | ||
seek-oss/docker-ecr-cache#v1.9.0: | ||
build-args: | ||
- NPM_TOKEN | ||
cache-on: | ||
- package.json | ||
- yarn.lock | ||
|
||
steps: | ||
- label: ':yarn: :eslint: Lint and :jest: unit test' | ||
<<: *dev-agent | ||
plugins: | ||
<<: *plugins | ||
key: test | ||
command: | ||
- echo "--- Running yarn lint" | ||
- yarn lint | ||
- echo "--- Running yarn test :jest:" | ||
- yarn test | ||
|
||
- label: 'CDK Deploy Staging :shipit:' | ||
<<: *dev-agent | ||
plugins: | ||
<<: *plugins | ||
depends_on: | ||
- test | ||
command: | ||
- echo "--- Running CDK deploy to staging" | ||
- yarn deploy:dev | ||
concurrency: 1 | ||
concurrency_group: '<%- repoName %>/deploy/dev' | ||
|
||
- label: 'CDK Deploy Production :shipit:' | ||
branches: 'master' | ||
<<: *prod-agent | ||
plugins: | ||
<<: *plugins | ||
depends_on: | ||
- test | ||
command: | ||
- echo "--- Running CDK deploy to production" | ||
- yarn deploy:prod | ||
concurrency: 1 | ||
concurrency_group: '<%- repoName %>/deploy/prod' |
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,22 @@ | ||
--- | ||
# https://codex.ssod.skinfra.xyz/docs | ||
|
||
components: | ||
'<%- repoName %>': | ||
# TODO: supply system catalog information | ||
# dependencies: | ||
# - type: api | ||
# key: SEEK-Jobs/??? | ||
# - type: datastore | ||
# arn: arn:aws:dynamodb:us-east-1:123456789012:table/??? | ||
# - type: datastore | ||
# key: infrastructure/??? | ||
deploy_target: Worker | ||
# is_production_system: true | ||
primary_technologies: | ||
- AWS CDK | ||
- AWS Lambda | ||
- Buildkite | ||
- skuba | ||
- TypeScript | ||
# scope: APAC |
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 @@ | ||
14 |
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,30 @@ | ||
# Docker image history includes ARG values, so never target this stage directly | ||
FROM node:14-alpine AS unsafe-dev-deps | ||
|
||
WORKDIR /workdir | ||
|
||
COPY package.json yarn.lock ./ | ||
|
||
ARG NPM_READ_TOKEN | ||
|
||
RUN \ | ||
echo '//registry.npmjs.org/:_authToken=${NPM_READ_TOKEN}' > .npmrc && \ | ||
yarn install --frozen-lockfile --ignore-optional --non-interactive && \ | ||
yarn package && \ | ||
rm .npmrc | ||
|
||
### | ||
|
||
FROM node:14-alpine AS dev-deps | ||
|
||
WORKDIR /workdir | ||
|
||
COPY --from=unsafe-dev-deps /workdir . | ||
|
||
### | ||
|
||
FROM dev-deps AS build | ||
|
||
COPY . . | ||
|
||
RUN yarn build |
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 @@ | ||
{ | ||
"app": "npx ts-node infra/index.ts", | ||
"context": { | ||
"@aws-cdk/core:enableStackNameDuplicates": "true", | ||
"global": { | ||
"appName": "<%- serviceName %>" | ||
}, | ||
"dev": { | ||
"workerLambda": { | ||
"reservedConcurrency": 1, | ||
"environment": { | ||
"SOMETHING": "dev" | ||
} | ||
} | ||
}, | ||
"prod": { | ||
"workerLambda": { | ||
"reservedConcurrency": 2, | ||
"environment": { | ||
"SOMETHING": "prod" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.