Skip to content

Commit

Permalink
fix: added gitlab-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
david tjokroaminoto committed Jan 18, 2024
1 parent 16294e5 commit 4cf37a8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include:
- project: "$CI_INCLUDE_PROJECT"
file: "$CI_INCLUDE_FILE"
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"node-cache": "^5.1.2",
"serverless-associate-waf": "^1.2.1",
"serverless-domain-manager": "^7.3.3",
"serverless-iamroles": "^3.2.7",
"yargs": "^17.7.2"
},
"devDependencies": {
Expand Down
29 changes: 15 additions & 14 deletions serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import verify from "@functions/verify";
const STAGE = getArgumentValuesOrDefault({ flag: "stage", defaultValue: "dev" });

const serverlessConfiguration = async (): Promise<AWS> => {
const service = "notarise-verify-api";
const region = "ap-southeast-1";

return {
service,
useDotenv: true,
service: "${env:PROJECT_NAME}-verify-api",
configValidationMode: "error",
plugins: ["serverless-esbuild", "serverless-domain-manager", "serverless-stack-termination-protection", "serverless-associate-waf", "serverless-iamroles", "serverless-offline", "serverless-offline-ssm"],
provider: {
Expand All @@ -18,7 +18,7 @@ const serverlessConfiguration = async (): Promise<AWS> => {
runtime: "nodejs18.x",
memorySize: 256,
timeout: 30,
stackName: 'notarise-${self:provider.stage}-verify-api',
stackName: '${self:custom.project}-${self:provider.stage}-verify-api',
stage: STAGE,
apiGateway: {
minimumCompressionSize: 1024,
Expand All @@ -32,10 +32,10 @@ const serverlessConfiguration = async (): Promise<AWS> => {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1",
NODE_OPTIONS: "--enable-source-maps --stack-trace-limit=1000",
STAGE,
NETWORK_NAME: "${ssm:/notarise/${self:provider.stage}/network-name}",
INFURA_API_KEY: "${ssm:/notarise/${self:provider.stage}/infura-api-key}",
ALCHEMY_API_KEY: "${ssm:/notarise/${self:provider.stage}/alchemy-api-key}",
WHITELISTED_ISSUERS: "${ssm:/notarise/${self:provider.stage}/whitelisted-issuers}",
NETWORK_NAME: "${ssm:/${self:custom.project}/${self:provider.stage}/network-name}",
INFURA_API_KEY: "${ssm:/${self:custom.project}/${self:provider.stage}/infura-api-key}",
ALCHEMY_API_KEY: "${ssm:/${self:custom.project}/${self:provider.stage}/alchemy-api-key}",
WHITELISTED_ISSUERS: "${ssm:/${self:custom.project}/${self:provider.stage}/whitelisted-issuers}",
},
tracing: {
lambda: true,
Expand All @@ -48,14 +48,14 @@ const serverlessConfiguration = async (): Promise<AWS> => {
level: "INFO",
roleManagedExternally: true,
fullExecutionData: true,
role: '${ssm:/notarise/${self:provider.stage}/cloudwatch-log-role-arn}',
role: '${ssm:/${self:custom.project}/${self:provider.stage}/cloudwatch-log-role-arn}',
},
},
deploymentBucket: {
name: '${self:custom.infra.deploymentBucket}',
},
endpointType:
'${ssm:/notarise/${self:provider.stage}/api-gateway-endpoint-type, "REGIONAL"}',
'${ssm:/${self:custom.project}/${self:provider.stage}/api-gateway-endpoint-type, "REGIONAL"}',
iam: {
role: {
name: "${self:provider.stackName}-lambda",
Expand All @@ -74,15 +74,16 @@ const serverlessConfiguration = async (): Promise<AWS> => {
functions: { verify },
package: { individually: true },
custom: {
project: '${env:PROJECT_NAME}',
infra: {
deploymentBucket:
'${ssm:/notarise/${self:provider.stage}/deployment-bucket}',
'${ssm:/${self:custom.project}/${self:provider.stage}/deployment-bucket}',
securityGroupIds:
'${ssm:/notarise/${self:provider.stage}/security-group-ids}',
subnetIds: '${ssm:/notarise/${self:provider.stage}/subnet-ids}',
'${ssm:/${self:custom.project}/${self:provider.stage}/security-group-ids}',
subnetIds: '${ssm:/${self:custom.project}/${self:provider.stage}/subnet-ids}',
},
associateWaf: {
name: "${ssm:/notarise/${self:provider.stage}/wafv2-name}",
name: "${ssm:/${self:custom.project}/${self:provider.stage}/wafv2-name}",
version: 'V2'
},
serverlessTerminationProtection: {
Expand All @@ -105,7 +106,7 @@ const serverlessConfiguration = async (): Promise<AWS> => {
concurrency: 10,
},
customDomain: {
domainName: '${ssm:/notarise/${self:provider.stage}/verify-api-domain-name, ""}',
domainName: '${ssm:/${self:custom.project}/${self:provider.stage}/verify-api-domain-name, ""}',
basePath: "",
createRoute53Record: false,
endpointType: "${self:provider.endpointType}",
Expand Down

0 comments on commit 4cf37a8

Please sign in to comment.