Skip to content

Commit

Permalink
DOP-4305 merging
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Feb 12, 2024
2 parents c470ed2 + 1a41ce3 commit c000ee1
Show file tree
Hide file tree
Showing 26 changed files with 107 additions and 217 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/deploy-prd-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
# - uses: mr-smithers-excellent/docker-build-push@v5
# name: build and push to ECR Legacy Dotcom
# with:
# image: docs-worker-pool-legacydotcomprd
# tags: latest, ${{ github.sha }}
# registry: ${{ steps.login-ecr.outputs.registry }}
# dockerfile: Dockerfile.legacy
# buildArgs: NPM_EMAIL=${{ secrets.NPM_EMAIL }},NPM_BASE_64_AUTH=${{ secrets.NPM_BASE64_AUTH }}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
# NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- name: Deploy ECS
run: |
cd infrastructure/ecs-main
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/deploy-stg-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- "main"
- "integration"
- "DOP-4306"
concurrency:
group: environment-stg-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -34,7 +35,6 @@ jobs:
npm ci
sls deploy --stage stg
sls deploy --stage dotcomstg
sls deploy --stage legacydotcomstg
- uses: mr-smithers-excellent/docker-build-push@v5
name: build and push to ECR
with:
Expand All @@ -59,19 +59,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
# - uses: mr-smithers-excellent/docker-build-push@v5
# name: build and push to ECR Legacy DOTCOM
# with:
# image: docs-worker-pool-legacydotcomstg
# tags: latest
# registry: ${{ steps.login-ecr.outputs.registry }}
# dockerfile: Dockerfile.legacy
# buildArgs: NPM_EMAIL=${{ secrets.NPM_EMAIL }},NPM_BASE_64_AUTH=${{ secrets.NPM_BASE64_AUTH }}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
# NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- name: Deploy ECS
run: |
cd infrastructure/ecs-main
Expand Down
44 changes: 44 additions & 0 deletions Dockerfile.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Debian Bookworm removes Python 2, and Bullseye exits its support period in 2024.
# The solution is probably to switch to Ubuntu 22.04 at that point, which is supported until 2027.
FROM node:14-bullseye-slim

ARG MUT_VERSION=0.10.6

ENV PATH="${PATH}:/opt/mut"

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
python2.7 \
rsync \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && python2.7 get-pip.py && rm get-pip.py \
&& python2.7 -m pip install --no-cache-dir virtualenv==20.15.1 \
&& virtualenv /venv \
&& /venv/bin/pip install --no-cache-dir -r https://raw.githubusercontent.com/mongodb/docs-tools/master/giza/requirements.txt \
\
&& curl -L -o mut.zip https://github.com/mongodb/mut/releases/download/v${MUT_VERSION}/mut-v${MUT_VERSION}-linux_x86_64.zip \
&& unzip -d /opt/ mut.zip \
&& rm mut.zip \
&& apt-get purge -y --auto-remove unzip

RUN groupadd -r builduser && useradd --no-log-init -ms /bin/bash -r -g builduser builduser
ARG WORK_DIRECTORY=/home/builduser
WORKDIR ${WORK_DIRECTORY}

COPY --chown=builduser:builduser config config/
COPY --chown=builduser:builduser package*.json ./
COPY --chown=builduser:builduser tsconfig*.json ./
COPY --chown=builduser:builduser . ./

USER builduser
RUN curl https://raw.githubusercontent.com/mongodb/docs-worker-pool/meta/makefiles/shared.mk -o shared.mk
RUN npm install
RUN npm run build

RUN mkdir repos && chmod 755 repos
EXPOSE 3000
CMD ["node", "build/app.js"]

6 changes: 2 additions & 4 deletions cdk-infra/utils/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Construct } from 'constructs';
import { getCurrentBranch } from './git';

const snootyEnvs = ['staging', 'production', 'dotcomstg', 'dotcomprd', 'legacydotcomprd', 'legacydotcomstg'] as const;
const autoBuilderEnvs = ['stg', 'prd', 'dev', 'dotcomstg', 'dotcomprd', 'legacydotcomstg', 'legacydotcomprd'] as const;
const snootyEnvs = ['staging', 'production', 'dotcomstg', 'dotcomprd'] as const;
const autoBuilderEnvs = ['stg', 'prd', 'dev', 'dotcomstg', 'dotcomprd'] as const;
const autoBuilderContextVariables = [
'enhanced',
'isFeatureBranch',
Expand All @@ -24,8 +24,6 @@ const autoBuilderToSnootyEnvMap: Record<AutoBuilderEnv, SnootyEnv> = {
prd: 'production',
dotcomprd: 'dotcomprd',
dotcomstg: 'dotcomstg',
legacydotcomstg: 'legacydotcomstg',
legacydotcomprd: 'legacydotcomprd',
};

export function envShortToFullName(env: string): SnootyEnv {
Expand Down
2 changes: 0 additions & 2 deletions cdk-infra/utils/search-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ export function getSearchIndexFolder(env: AutoBuilderEnv): string {
return '';
case 'stg':
case 'dotcomstg':
case 'legacydotcomstg':
return 'preprd';
case 'dotcomprd':
case 'legacydotcomprd':
case 'prd':
return 'prd';
}
Expand Down
2 changes: 0 additions & 2 deletions cdk-infra/utils/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const dashboardUrls: Record<AutoBuilderEnv, string> = {
prd: `https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=`,
dotcomstg: `https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=`,
dotcomprd: `https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=`,
legacydotcomstg: `https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=`,
legacydotcomprd: `https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=`,
dev: `https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=`,
};

Expand Down
4 changes: 0 additions & 4 deletions cdk-infra/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ const hostUrlMap: Record<AutoBuilderEnv, string> = {
dev: 'docs-dev.mongodb.com',
stg: 'mongodbcom-cdn.website.staging.corp.mongodb.com',
dotcomstg: 'mongodbcom-cdn.website.staging.corp.mongodb.com',
legacydotcomstg: 'mongodbcom-cdn.website.staging.corp.mongodb.com',
prd: 'www.mongodb.com',
dotcomprd: 'www.mongodb.com',
legacydotcomprd: 'www.mongodb.com',
};

const urlPrefixMap: Record<AutoBuilderEnv, string> = {
dev: 'docs',
stg: 'docs-qa',
dotcomstg: 'docs-qa',
legacydotcomstg: 'docs-qa',
prd: 'docs',
dotcomprd: 'docs',
legacydotcomprd: 'docs',
};

export const getHostUrl = (env: AutoBuilderEnv): string => hostUrlMap[env];
Expand Down
29 changes: 1 addition & 28 deletions infrastructure/ecs-main/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ custom:
prd: worker-pool-deployment
dotcomstg: worker-pool-deployment
dotcomprd: worker-pool-deployment
legacydotcomstg: worker-pool-deployment
legacydotcomprd: worker-pool-deployment
ecs:
port: '80'
imageUrl: ${self:custom.accountId.${self:provider.stage}}.dkr.ecr.us-east-2.amazonaws.com/${self:service}-${self:provider.stage}:latest
Expand All @@ -49,40 +47,31 @@ custom:
prd: '4096'
dotcomstg: '2048'
dotcomprd: '4096'
legacydotcomstg: '2048'
legacydotcomprd: '4096'
containerMemory:
dev: '8192'
stg: '8192'
prd: '24576'
dotcomstg: '8192'
dotcomprd: '24576'
legacydotcomstg: '8192'
legacydotcomprd: '24576'

desiredCount:
dev: '4'
stg: '4'
prd: '4'
dotcomstg: '4'
dotcomprd: '4'
legacydotcomstg: '4'
legacydotcomprd: '4'
minimumHealthyPercent:
dev: 100
stg: 100
prd: 100
dotcomstg: 100
dotcomprd: 100
legacydotcomstg: 100
legacydotcomprd: 100
maximumPercent:
dev: 200
stg: 200
prd: 200
dotcomstg: 200
dotcomprd: 200
legacydotcomstg: 200
legacydotcomprd: 200
deregistrationDelaySecs: '10'
targetGroupName: docs-worker-pool
accountId:
Expand All @@ -91,8 +80,6 @@ custom:
prd: 216656347858
dotcomstg: 216656347858
dotcomprd: 216656347858
legacydotcomstg: 216656347858
legacydotcomprd: 216656347858

dbUsername: ${ssm:/env/${self:provider.stage}/docs/worker_pool/atlas/username}
dbPassword: ${ssm:/env/${self:provider.stage}/docs/worker_pool/atlas/password}
Expand Down Expand Up @@ -152,25 +139,19 @@ custom:
prd: https://cdnvalidator.devops.prod.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
dotcomstg: https://cdnvalidator.devops.staging.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
dotcomprd: https://cdnvalidator.devops.prod.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
legacydotcomstg: https://cdnvalidator.devops.staging.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
legacydotcomprd: https://cdnvalidator.devops.prod.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
dev: https://cdnvalidator.devops.staging.corp.mongodb.com/api/v1beta1/distributions/${self:custom.distributionName.${self:provider.stage}}/invalidations
distributionName:
stg: mongodbcom-staging-docs
dotcomstg: mongodbcom-staging-docs
legacydotcomstg: mongodbcom-staging-docs
dev: mongodbcom-staging-docs
dotcomprd: mongodbcom-prod-docs
legacydotcomprd: mongodbcom-prod-docs
prd: mongodbcom-prod-docs
env:
stg: "staging"
prd: "production"
dev: "staging"
dotcomstg: "dotcomstg"
dotcomprd: "dotcomprd"
legacydotcomstg: "dotcomstg"
legacydotcomprd: "dotcomprd"
# TODO: When satisfied with manifest generation, remove '-test'
searchIndexBucket: docs-search-indexes-test
# TODO: In future, use duplicate mapping of dotcomstg -> preprd to have
Expand All @@ -181,30 +162,22 @@ custom:
prd: "prd"
dotcomstg: "preprd"
dotcomprd: "prd"
legacydotcomstg: "preprd"
legacydotcomprd: "prd"
site:
host:
dev: "docs-dev.mongodb.com"
stg: "mongodbcom-cdn.website.staging.corp.mongodb.com"
dotcomstg: "mongodbcom-cdn.website.staging.corp.mongodb.com"
legacydotcomstg: "mongodbcom-cdn.website.staging.corp.mongodb.com"
prd: "www.mongodb.com"
dotcomprd: "www.mongodb.com"
legacydotcomprd: "www.mongodb.com"
prefix:
dev: "docs"
stg: "docs-qa"
dotcomstg: "docs-qa"
legacydotcomstg: "docs-qa"
prd: "docs"
dotcomprd: "docs"
legacydotcomprd: "docs"
errorDoc:
dotcomstg: "docs-qa/404/index.html"
dotcomprd: "docs/404/index.html"
legacydotcomstg: "docs-qa/404/index.html"
legacydotcomprd: "docs/404/index.html"

resources:
- ${file(./buckets.yml)}
Expand Down
2 changes: 0 additions & 2 deletions infrastructure/ecs-repo/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ custom:
dev: worker-pool-deployment
dotcomstg: worker-pool-deployment
dotcomprd: worker-pool-deployment
legacydotcomstg: worker-pool-deployment
legacydotcomprd: worker-pool-deployment

resources:
Resources:
Expand Down
8 changes: 0 additions & 8 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ custom:
prd: worker-pool-deployment
dotcomstg: worker-pool-deployment
dotcomprd: worker-pool-deployment
legacydotcomstg: worker-pool-deployment
legacydotcomprd: worker-pool-deployment
searchIndexBucket:
dev: "" # I'm just here so I don't get fined
# TODO: When satisfied with manifest generation, remove the '-test'
dotcomstg: docs-search-indexes-test/preprd
dotcomprd: docs-search-indexes-test/prd
legacydotcomstg: docs-search-indexes-test/preprd
legacydotcomprd: docs-search-indexes-test/prd
fastlyDochubToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/dochub/token}
fastlyDochubServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/dochub/service_id}
fastlyDochubMap: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/dochub_map}
Expand All @@ -51,8 +47,6 @@ custom:
dev: aws.partner/mongodb.com/stitch.trigger/5e00b7afec293c6507679c4d
dotcomstg: aws.partner/mongodb.com/stitch.trigger/5e00b7afec293c6507679c4d
dotcomprd: aws.partner/mongodb.com/stitch.trigger/5e00b7afec293c6507679c4d
legacydotcomstg: aws.partner/mongodb.com/stitch.trigger/5e00b7afec293c6507679c4d
legacydotcomprd: aws.partner/mongodb.com/stitch.trigger/5e00b7afec293c6507679c4d
dochubEventBus: arn:aws:events:${aws:region}:${aws:accountId}:event-bus/${self:custom.docuhubEventSource.${self:provider.stage}}
dbUsername: ${ssm:/env/${self:provider.stage}/docs/worker_pool/atlas/username}
dbPassword: ${ssm:/env/${self:provider.stage}/docs/worker_pool/atlas/password}
Expand All @@ -79,8 +73,6 @@ custom:
prd: https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
dotcomstg: https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
dotcomprd: https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
legacydotcomstg: https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
legacydotcomprd: https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
dev: https://workerpoolstaging-qgeyp.mongodbstitch.com/pages/job.html?collName=${self:custom.jobCollection}&jobId=
env:
stg: "staging"
Expand Down
6 changes: 2 additions & 4 deletions src/commands/src/scripts/local-build/utils/get-env-vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ async function getSecureStrings(
return paramsMap;
}

const snootyEnvs = ['staging', 'production', 'dotcomstg', 'dotcomprd', 'legacydotcomprd', 'legacydotcomstg'] as const;
const autoBuilderEnvs = ['stg', 'prd', 'dev', 'dotcomstg', 'dotcomprd', 'legacydotcomstg', 'legacydotcomprd'] as const;
const snootyEnvs = ['staging', 'production', 'dotcomstg', 'dotcomprd'] as const;
const autoBuilderEnvs = ['stg', 'prd', 'dev', 'dotcomstg', 'dotcomprd'] as const;

type SnootyEnv = (typeof snootyEnvs)[number];
type AutoBuilderEnv = (typeof autoBuilderEnvs)[number];
Expand All @@ -134,8 +134,6 @@ const autoBuilderToSnootyEnvMap: Record<AutoBuilderEnv, SnootyEnv> = {
prd: 'production',
dotcomprd: 'dotcomprd',
dotcomstg: 'dotcomstg',
legacydotcomstg: 'legacydotcomstg',
legacydotcomprd: 'legacydotcomprd',
};

function envShortToFullName(env: string): SnootyEnv {
Expand Down
2 changes: 0 additions & 2 deletions src/entities/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export type Payload = {
primaryAlias: string | null | undefined;
repoBranches: any;
stable: boolean | null | undefined;
isNextGen: boolean | null | undefined;
regression: boolean | null | undefined;
urlSlug: string | null | undefined;
prefix: string;
Expand Down Expand Up @@ -78,7 +77,6 @@ export type EnhancedPayload = {
aliased?: boolean | null;
primaryAlias?: string | null;
stable?: boolean | null;
isNextGen?: boolean | null;
repoBranches?: any;
regression?: boolean | null;
urlSlug?: string | null;
Expand Down
Loading

0 comments on commit c000ee1

Please sign in to comment.