Skip to content

Commit

Permalink
Upgrade Rebuild on ECS (#1858)
Browse files Browse the repository at this point in the history
* Upgrade Rebuild on ECS 
* Create cloudformation template for resources
* Create Pipeline Configs
* Add string replacement function for environment.*.ts files
* Update package-lock.json to include replace-in-file package.
* Create new Dockerfile for cl builds.
* creating beanstalk config so current build:prod command continues to work
* add configurations to serve and e2e commands
---------

Co-authored-by: danoswaltCL <[email protected]>
  • Loading branch information
shpwe and danoswaltCL authored Aug 27, 2024
1 parent 4d6668e commit 889fed0
Show file tree
Hide file tree
Showing 15 changed files with 1,023 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.dccache
node_modules
.vscode
setup_upgrade.sh
85 changes: 85 additions & 0 deletions .jenkins/projectBuilder.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
projectBuilderV5 (
buildAgent:[
image: "467155500999.dkr.ecr.us-east-1.amazonaws.com/jenkins-agent:default",
cpu: 2048,
memory: 4096
],

projects: [
"upgrade-service":[
artifactType: "ecr",
projectDir: "backend",
runInProjectDir: true,
versioning: "calendar",
appInfrastructure: [
[file: "cloudformation/backend/app-infrastructure.yml"]
],
s3Context: [
glob: "backend/**/*,types/**/*,*.json"
],
fileFilter: [
include: ["types/.*","cloudformation/backend/app-infrastructure.yml"]
],
dockerConfig: [
dockerFile: "backend/cl.Dockerfile",
requiresCodeArtifactToken: true,
]
],
"upgrade":[
artifactType: 'codeartifact',
projectDir: 'frontend',
runInProjectDir: true,
artifactDir: 'dist/upgrade',
versioning: 'calendar',
oneArtifactPerEnvironment: true,
buildScripts: [
[
script: 'npm ci --no-audit',
githubCheck: '${projectName} npm ci --no-audit',
log: '${projectName}-npm-ci.log'
],
[
script: 'npm run build:project',
log: '${projectName}-build.log',
githubCheck: '${projectName}-build'
]
],
envVars: [
API_BASE_URL: '@vault(secret/configs/upgrade/${environment}/API_BASE_URL)',
BASE_HREF_PREFIX: '@vault(secret/configs/upgrade/${environment}/BASE_HREF_PREFIX)',
GOOGLE_CLIENT_ID: '@vault(secret/configs/upgrade/${environment}/GOOGLE_CLIENT_ID)',
],
]
],
deployments: [
UpgradeService: [
projects: ["upgrade-service"],
automated: [
[
type: "defaultBranch",
environment: "qa"
]
],
jobs: [
[
job: "Upgrade-Service-Deploy",
type: "bluegreen"
]
]
],
Upgrade: [
projects: ["upgrade"],
automated: [
[
type: "defaultBranch",
environment: "qa"
]
],
jobs: [
[
job: "Upgrade-Frontend-Deploy"
]
]
],
]
)
30 changes: 30 additions & 0 deletions backend/cl.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG IMAGE_REPO

FROM ${IMAGE_REPO}node:18-alpine3.16 AS build
WORKDIR /usr/src/app
COPY . .
RUN ls
RUN npm ci --no-audit
WORKDIR /usr/src/app/types
RUN npm ci --no-audit
RUN cp -R . ../backend/packages/Upgrade/types
# ARG CODEARTIFACT_AUTH_TOKEN
# ARG CODEARTIFACT_REGISTRY="//cli-467155500999.d.codeartifact.us-east-1.amazonaws.com/npm/cli-npm-artifacts/"
# RUN npm config set '${CODEARTIFACT_REGISTRY}:_authToken=${CODEARTIFACT_AUTH_TOKEN}'
WORKDIR /usr/src/app/backend/packages/Upgrade
RUN npm ci --no-audit

WORKDIR /usr/src/app/backend/
RUN npm ci --no-audit
RUN ["npm", "run", "build:upgrade"]

FROM ${IMAGE_REPO}node:18-alpine3.16

ENV NEW_RELIC_NO_CONFIG_FILE=true
ENV NR_NATIVE_METRICS_NO_BUILD=true
ENV NODE_OPTIONS=--max_old_space_size=4096

WORKDIR /usr/src/app
COPY --from=build /usr/src/app/backend ./
EXPOSE 3030
CMD ["npm", "run", "--silent", "production:upgrade"]
Loading

0 comments on commit 889fed0

Please sign in to comment.