From 671f75d2f3108f7381f4ef435adcb6199f4a43ff Mon Sep 17 00:00:00 2001 From: seaerchin <44049504+seaerchin@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:03:05 +0800 Subject: [PATCH] feat(deploy): update task defs for prod + staging (#1137) * fix(deploy-staging): update workflow * fix(task-def): update * fix(dpeloy_staging): update * fix(apsppec): add codeploy stuff * fix(task-def): update * fix(task-definition): update volumes path * fix(package): update env var injection * fix(task-def): add missing env vars * empty * fix(ecs): chnage log group * fix(tsk-def): add missing vars * fix(scripts): update env var injetdion * fix(dockerfile): update dockerfile * docs(unliknedpageservice): add a comment to avoid confusing ppl * fix(task-def): update prod values * fix(dockerfile): update key injection * feat(task-def): add env vars * fix(env): update env type injection * feat(task-def): enable init process * fix(task-def): update env vars * refactor(workflows): update ci + staging * feat(env): add workflow + env vasr * build(env-vars): add secrets * fix(task-def): remove comments * fix(task-def): update log groups + env vasr * fix(config): update dd env var to allow vapt value * fix(config): add shortenv * fix(task-def): update log group * fix(task-def): amend log group for vapt * feat(vapt-task-def): add env vars * fix(task-def): update dd env * feat(task-def): add docker labels * fix(task-def): update env vars for task def * fix(dockerfile): set git profile * feat(vapt): add ssh key for vapt * fix(task-def): update task def for vapt site creation form * feat(email): add iac email router * fix(task-def): update task role * fix(server): middlewareorder * fix(minor-fixes): fix header + vapt workflow name * fix(email): fix for missing creatorid * fix(vapt): update task def * fix(task-def): update for staging n prod * fix(deployvapt): remove deploy from staging * fix(usersservice): add phone # if email ends with cure53.de * feat(vapt): add volt.cure53.de * refactor(iac): remove rourtes * fix(task-def): remove env from vapt * fix(vapt): delete vapt related stuff for ez merge * fix(pasckage): remove vapt related commands --- .aws/deploy/backend-task-definition.prod.json | 5 +++++ .aws/deploy/backend-task-definition.staging.json | 7 ++++++- Dockerfile | 4 ++++ package.json | 2 +- src/config/config.ts | 12 +++++++++++- src/services/identity/SitesService.ts | 1 + src/services/identity/UsersService.ts | 1 + 7 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.aws/deploy/backend-task-definition.prod.json b/.aws/deploy/backend-task-definition.prod.json index 3be62b171..cecbdcc55 100644 --- a/.aws/deploy/backend-task-definition.prod.json +++ b/.aws/deploy/backend-task-definition.prod.json @@ -241,6 +241,11 @@ "value": "" } ], + "dockerLabels": { + "com.datadoghq.tags.env": "prod", + "com.datadoghq.tags.service": "isomer", + "com.datadoghq.tags.version": "7" + }, "mountPoints": [], "volumesFrom": [], "secrets": [], diff --git a/.aws/deploy/backend-task-definition.staging.json b/.aws/deploy/backend-task-definition.staging.json index b58fc2b05..030f68e41 100644 --- a/.aws/deploy/backend-task-definition.staging.json +++ b/.aws/deploy/backend-task-definition.staging.json @@ -223,7 +223,7 @@ }, { "name": "DD_ENV", - "value": "prod" + "value": "staging" }, { "name": "DD_SERVICE", @@ -250,6 +250,11 @@ "value": "" } ], + "dockerLabels": { + "com.datadoghq.tags.env": "staging", + "com.datadoghq.tags.service": "isomer", + "com.datadoghq.tags.version": "7" + }, "mountPoints": [], "volumesFrom": [], "secrets": [], diff --git a/Dockerfile b/Dockerfile index 940385586..2da4bd204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,10 @@ RUN npm ci RUN rm -rf /var/cache/apk/* RUN git config --system --add safe.directory '*' +RUN echo "[user]" > /root/.gitconfig +RUN echo " name = Isomer Admin" >> /root/.gitconfig +RUN echo " email = admin@isomer.gov.sg" >> /root/.gitconfig + EXPOSE "8081" CMD ["bash", "-c", "chmod +x ./scripts/02_fetch_ssh_keys.sh && bash ./scripts/02_fetch_ssh_keys.sh & npm run start:ecs"] diff --git a/package.json b/package.json index 8583c3364..8482aff9f 100644 --- a/package.json +++ b/package.json @@ -174,4 +174,4 @@ "engines": { "node": ">=16.0.0" } -} +} \ No newline at end of file diff --git a/src/config/config.ts b/src/config/config.ts index 4cd28e1b0..7d8f91c84 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -258,7 +258,17 @@ const config = convict({ dataDog: { env: { doc: "The DataDog environment", - format: ["development", "local", "staging", "production"], + format: [ + "development", + "local", + "staging", + "vapt", + "uat", + "production", + "prod", + "stg", + "dev", + ], env: "DD_ENV", default: "local", }, diff --git a/src/services/identity/SitesService.ts b/src/services/identity/SitesService.ts index 094fb3727..2ee7322a6 100644 --- a/src/services/identity/SitesService.ts +++ b/src/services/identity/SitesService.ts @@ -442,6 +442,7 @@ class SitesService { createParams: Partial & { name: Site["name"] creator: Site["creator"] + creatorId: Site["creatorId"] } ) { return this.siteRepository.create(createParams) diff --git a/src/services/identity/UsersService.ts b/src/services/identity/UsersService.ts index c7e9685bb..228f46f40 100644 --- a/src/services/identity/UsersService.ts +++ b/src/services/identity/UsersService.ts @@ -161,6 +161,7 @@ class UsersService { transaction, }) user.lastLoggedIn = new Date() + return user.save({ transaction }) }) }