diff --git a/LCU.WebApps.Collections.RepoClient/.dockerignore b/LCU.WebApps.Collections.RepoClient/.dockerignore new file mode 100644 index 0000000..cb295ae --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/.dockerignore @@ -0,0 +1,8 @@ +node_modules +build +.git +.gitignore +npm-debug.log +coverage +azdo_pipelines +kustomize diff --git a/LCU.WebApps.Collections.RepoClient/Dockerfile b/LCU.WebApps.Collections.RepoClient/Dockerfile new file mode 100644 index 0000000..3b67b1c --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/Dockerfile @@ -0,0 +1,28 @@ +FROM node:14-bullseye-slim AS build + +WORKDIR /app + +COPY package.json package-lock.json ./ + +ARG PAT=vvqu3q252m5kqwptu4tavha4ghk4svhmwsahb2kvlu22ogiegt6q +RUN TOKEN="$(printf "%s" "${PAT}" | base64 | tr -d '\n')" && \ + printf "registry=https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/npm/registry/\n" > .npmrc && \ + printf "always-auth=true\n" >> .npmrc && \ + printf "//landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/npm/registry/:username=azdo\n" >> .npmrc && \ + printf "//landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/npm/registry/:_password=%s\n" "${TOKEN}" >> .npmrc && \ + printf "//landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/npm/registry/:email=build@landmarkcu.com\n" >> .npmrc + +RUN npm ci --unsafe-perm + +COPY . ./ + +RUN npm run build + +FROM nginx:1.27-alpine + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/build /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-k8s-pipeline.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-k8s-pipeline.yaml new file mode 100644 index 0000000..230de27 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-k8s-pipeline.yaml @@ -0,0 +1,53 @@ +parameters: +- name: target_environment + displayName: Target Environment + type: string + default: qa + values: + - qa + - uat + - prd + +- name: k8s_namespace + displayName: K8s Namespace to deploy to + type: string + default: landmarkcu + values: + - landmarkcu + +variables: +- template: ./config-files/${{ parameters.target_environment }}-pvars.yaml +- name: source_branch_name + value: $[replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), '/', '-')] +- name: docker_container_repository_name + value: landmarkcu/lcu.webapps.collections.repoclient-repoclient + +resources: + repositories: + - repository: azdo_pipeline_templates + type: git + name: Infrastructure Platform/azdo-pipeline-templates + ref: main + +stages: +- template: docker-build-push.yaml@azdo_pipeline_templates + parameters: + azdo_agent_pool: $(pvar_azdo_agent_pool) + docker_registry_service_connection: $(pvar_docker_registry_service_connection) + docker_container_repository_name: $(docker_container_repository_name) + dockerfile_path: ./Dockerfile + docker_image_tags: | + build-$(Build.BuildId) + $(source_branch_name) + +- template: k8s-deploy.yaml@azdo_pipeline_templates + parameters: + dependsOn: CI + condition: or(eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'master')) + azdo_agent_pool: $(pvar_azdo_agent_pool) + kubectl_version: $(pvar_kubectl_version) + k8s_service_connection: $(pvar_k8s_service_connection) + k8s_namespace: ${{ parameters.k8s_namespace }} + k8s_kustomization_path: ./kustomize/overlays/${{ parameters.target_environment }} + docker_registry_service_connection: $(pvar_docker_registry_service_connection) + docker_image_to_deploy: $(docker_container_repository_name):build-$(Build.BuildId) diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-feature-branches.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-feature-branches.yaml new file mode 100644 index 0000000..0a0bb48 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-feature-branches.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - '*' + exclude: + - 'master' + - 'develop' + +extends: + template: azure-k8s-pipeline.yaml diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-prd.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-prd.yaml new file mode 100644 index 0000000..39d440b --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-prd.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'master' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: prd + k8s_namespace: landmarkcu diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-qa.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-qa.yaml new file mode 100644 index 0000000..30ce939 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-qa.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'develop' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: qa + k8s_namespace: landmarkcu diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-uat.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-uat.yaml new file mode 100644 index 0000000..7225ce2 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/azure-pipelines-uat.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'master' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: uat + k8s_namespace: landmarkcu diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/prd-pvars.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/prd-pvars.yaml new file mode 100644 index 0000000..9b650cd --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/prd-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-prd-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-prd-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/qa-pvars.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/qa-pvars.yaml new file mode 100644 index 0000000..dfc1bfb --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/qa-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-qa-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-qa-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/uat-pvars.yaml b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/uat-pvars.yaml new file mode 100644 index 0000000..10d7ce3 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/azdo_pipelines/config-files/uat-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-uat-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-uat-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/base/Deployment.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/base/Deployment.yaml new file mode 100644 index 0000000..20075ee --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/base/Deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: repo-client +spec: + replicas: 1 + selector: + matchLabels: + app: repo-client + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: repo-client + spec: + containers: + - name: repo-client + image: repo-client + resources: + requests: + cpu: "50m" + memory: "128Mi" + limits: + memory: "256Mi" + ports: + - containerPort: 80 + livenessProbe: + initialDelaySeconds: 5 + periodSeconds: 5 + httpGet: + path: / + port: 80 + readinessProbe: + initialDelaySeconds: 5 + periodSeconds: 5 + httpGet: + path: / + port: 80 diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/base/Service.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/base/Service.yaml new file mode 100644 index 0000000..7ce4a2e --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/base/Service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: repo-client +spec: + selector: + app: repo-client + ports: + - port: 80 + targetPort: 80 diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/base/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..f17985f --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/base/kustomization.yaml @@ -0,0 +1,8 @@ +resources: + - Deployment.yaml + - Service.yaml + - virtual-service.yaml + +images: +- name: repo-client + newName: landmarkcu/lcu.webapps.collections.repoclient-repoclient diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/base/virtual-service.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/base/virtual-service.yaml new file mode 100644 index 0000000..5247a5d --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/base/virtual-service.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: repo-client +spec: + hosts: [] + gateways: + - istio-system/ingress-gateway + http: + - name: repo-client + match: + - uri: + prefix: / + route: + - destination: + host: repo-client + port: + number: 80 diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/kustomization.yaml new file mode 100644 index 0000000..25a65b6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - normal diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/kustomization.yaml new file mode 100644 index 0000000..495b5a6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/kustomization.yaml @@ -0,0 +1,7 @@ +resources: + - ../../../base + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/set_virtual_service.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/set_virtual_service.yaml new file mode 100644 index 0000000..163b4b3 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/prd/normal/set_virtual_service.yaml @@ -0,0 +1,7 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: repo-client +spec: + hosts: + - repomanage.lcu-internal.com diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/kustomization.yaml new file mode 100644 index 0000000..25a65b6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - normal diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/kustomization.yaml new file mode 100644 index 0000000..495b5a6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/kustomization.yaml @@ -0,0 +1,7 @@ +resources: + - ../../../base + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/set_virtual_service.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/set_virtual_service.yaml new file mode 100644 index 0000000..4fd4532 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/qa/normal/set_virtual_service.yaml @@ -0,0 +1,7 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: repo-client +spec: + hosts: + - qa-repomanage.lcu-internal.com diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/kustomization.yaml new file mode 100644 index 0000000..25a65b6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - normal diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/kustomization.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/kustomization.yaml new file mode 100644 index 0000000..495b5a6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/kustomization.yaml @@ -0,0 +1,7 @@ +resources: + - ../../../base + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/set_virtual_service.yaml b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/set_virtual_service.yaml new file mode 100644 index 0000000..997affb --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/kustomize/overlays/uat/normal/set_virtual_service.yaml @@ -0,0 +1,7 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: repo-client +spec: + hosts: + - uat-repomanage.lcu-internal.com diff --git a/LCU.WebApps.Collections.RepoClient/nginx.conf b/LCU.WebApps.Collections.RepoClient/nginx.conf new file mode 100644 index 0000000..3aa17e6 --- /dev/null +++ b/LCU.WebApps.Collections.RepoClient/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +}