diff --git a/.github/readme.md b/.github/readme.md index fabe09a84..0f0056249 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -20,4 +20,5 @@ After the release is deployed on Prod ## Update frontend/package.json * version -TBV \ No newline at end of file + + diff --git a/README.md b/README.md index e05c7acc3..c6a689b58 100644 --- a/README.md +++ b/README.md @@ -120,3 +120,4 @@ This is a list that was created on 2023-02-01 with all Zelda Devs to provide alt - New learning and applying it to our work - Innovation work + diff --git a/openshift-v4/templates/celery/Dockerfile b/openshift-v4/templates/celery/Dockerfile new file mode 100644 index 000000000..b303b6d63 --- /dev/null +++ b/openshift-v4/templates/celery/Dockerfile @@ -0,0 +1,14 @@ +FROM artifacts.developer.gov.bc.ca/docker-remote/python:3.9.15 +RUN apt-get update \ + && apt-get install -y git \ + && apt-get install -y supervisor +WORKDIR /app/tfrs +COPY . . +COPY ./security-scan/scan-handler/celery.conf /etc/supervisor/conf.d +RUN pip install --upgrade pip \ + && pip install -r backend/requirements.txt \ + && chgrp -R root /var/log/supervisor \ + && chmod -R g+w /var/log/supervisor \ + && chmod -R g+w /run || : \ + && chmod -R g+w /app +CMD ["supervisord"] \ No newline at end of file diff --git a/openshift-v4/templates/celery/celery-bc-docker.yaml b/openshift-v4/templates/celery/celery-bc-docker.yaml new file mode 100644 index 000000000..55919621f --- /dev/null +++ b/openshift-v4/templates/celery/celery-bc-docker.yaml @@ -0,0 +1,89 @@ +--- +kind: Template +apiVersion: template.openshift.io/v1 +metadata: + name: celery-bc + creationTimestamp: +parameters: + - name: NAME + displayName: + description: the module name entered when run yo bcdk:pipeline, which is tfrs + required: true + - name: SUFFIX + displayName: + description: sample is -pr-0 + required: true + - name: VERSION + displayName: + description: image tag name for output + required: true + - name: GIT_URL + displayName: + description: tfrs repo + required: true + - name: GIT_REF + displayName: + description: tfrs repo ref + required: true +objects: + - apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + annotations: + description: Keeps track of changes in the celery image + labels: + shared: "true" + creationTimestamp: null + name: ${NAME}-celery + spec: + lookupPolicy: + local: false + status: + dockerImageRepository: "" + - kind: BuildConfig + apiVersion: build.openshift.io/v1 + metadata: + name: ${NAME}-celery${SUFFIX} + creationTimestamp: + spec: + triggers: [] + runPolicy: Serial + source: + git: + uri: ${GIT_URL} + ref: ${GIT_REF} + type: Git + strategy: + type: Docker + dockerStrategy: + dockerfilePath: openshift-v4/templates/celery/Dockerfile + noCache: true + env: + - name: ARTIFACTORY_USER + valueFrom: + secretKeyRef: + name: artifacts-default-cgcynz + key: username + - name: ARTIFACTORY_PASSWORD + valueFrom: + secretKeyRef: + name: artifacts-default-cgcynz + key: password + forcePull: true + output: + to: + kind: ImageStreamTag + name: ${NAME}-celery:${VERSION} + resources: + limits: + cpu: 1500m + memory: 1300Mi + requests: + cpu: 750m + memory: 650Mi + postCommit: {} + nodeSelector: + successfulBuildsHistoryLimit: 5 + failedBuildsHistoryLimit: 5 + status: + lastVersion: 0 diff --git a/openshift-v4/templates/celery/celery.conf b/openshift-v4/templates/celery/celery.conf new file mode 100644 index 000000000..ac4932ea4 --- /dev/null +++ b/openshift-v4/templates/celery/celery.conf @@ -0,0 +1,21 @@ +[supervisord] +nodaemon=true + +[group:server] +programs=celerybeat,celeryworker + +[program:celerybeat] +command=celery -A tfrs beat --loglevel=INFO +startsecs=5 +redirect_stderr=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +directory=/app/tfrs/backend + +[program:celeryworker] +command=celery -A tfrs worker --loglevel=INFO -E +startsecs=5 +redirect_stderr=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +directory=/app/tfrs/backend diff --git a/openshift-v4/templates/scan-handler/Dockerfile b/openshift-v4/templates/scan-handler/Dockerfile new file mode 100644 index 000000000..c57fb5c7b --- /dev/null +++ b/openshift-v4/templates/scan-handler/Dockerfile @@ -0,0 +1,14 @@ +FROM artifacts.developer.gov.bc.ca/docker-remote/python:3.9.15 +RUN apt-get update \ + && apt-get install -y git \ + && apt-get install -y supervisor +WORKDIR /app/tfrs +COPY . . +COPY security-scan/scan-handler/scan-handler.conf /etc/supervisor/conf.d +RUN pip install --upgrade pip \ + && pip install -r backend/requirements.txt \ + && chgrp -R root /var/log/supervisor \ + && chmod -R g+w /var/log/supervisor \ + && chmod -R g+w /run || : \ + && chmod -R g+w /app +CMD ["supervisord"] \ No newline at end of file diff --git a/openshift-v4/templates/scan-handler/scan-handler-bc-docker.yaml b/openshift-v4/templates/scan-handler/scan-handler-bc-docker.yaml new file mode 100644 index 000000000..d25dc1e1d --- /dev/null +++ b/openshift-v4/templates/scan-handler/scan-handler-bc-docker.yaml @@ -0,0 +1,89 @@ +--- +kind: Template +apiVersion: template.openshift.io/v1 +metadata: + name: scan-handler-bc + creationTimestamp: +parameters: +- name: NAME + displayName: + description: the module name entered when run yo bcdk:pipeline, which is tfrs + required: true +- name: SUFFIX + displayName: + description: sample is -pr-0 + required: true +- name: VERSION + displayName: + description: image tag name for output + required: true +- name: GIT_URL + displayName: + description: tfrs repo + required: true +- name: GIT_REF + displayName: + description: tfrs repo ref + required: true +objects: +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + annotations: + description: Keeps track of changes in the celery image + labels: + shared: "true" + creationTimestamp: null + name: ${NAME}-scan-handler + spec: + lookupPolicy: + local: false + status: + dockerImageRepository: "" +- kind: BuildConfig + apiVersion: build.openshift.io/v1 + metadata: + name: ${NAME}-scan-handler${SUFFIX} + creationTimestamp: + spec: + triggers: [] + runPolicy: Serial + source: + type: Git + git: + uri: ${GIT_URL} + ref: ${GIT_REF} + strategy: + type: Docker + dockerStrategy: + dockerfilePath: openshift-v4/templates/scan-handler/Dockerfile + noCache: true + env: + - name: ARTIFACTORY_USER + valueFrom: + secretKeyRef: + name: artifacts-default-cgcynz + key: username + - name: ARTIFACTORY_PASSWORD + valueFrom: + secretKeyRef: + name: artifacts-default-cgcynz + key: password + forcePull: true + output: + to: + kind: ImageStreamTag + name: ${NAME}-scan-handler:${VERSION} + resources: + limits: + cpu: 1500m + memory: 1300Mi + requests: + cpu: 750m + memory: 650Mi + postCommit: {} + nodeSelector: + successfulBuildsHistoryLimit: 5 + failedBuildsHistoryLimit: 5 + status: + lastVersion: 0