diff --git a/backend/dops/.puppeteerrc.cjs b/backend/dops/.puppeteerrc.cjs deleted file mode 100644 index a70210766..000000000 --- a/backend/dops/.puppeteerrc.cjs +++ /dev/null @@ -1,9 +0,0 @@ -const {join} = require('path'); - -/** - * @type {import("puppeteer").Configuration} - */ -module.exports = { - // Changes the cache location for Puppeteer. - cacheDirectory: join(__dirname, '.cache', 'puppeteer'), -}; \ No newline at end of file diff --git a/backend/dops/Dockerfile b/backend/dops/Dockerfile index 2fb54fca4..c5f21e69b 100644 --- a/backend/dops/Dockerfile +++ b/backend/dops/Dockerfile @@ -1,5 +1,32 @@ # Build container -FROM node:18.17.1-alpine AS builder +FROM ubuntu:latest as builder + + +RUN apt-get update +ENV NODE_VERSION=16.14.0 +RUN apt install -y curl +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash +ENV NVM_DIR=/root/.nvm +RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} +RUN chmod -R 777 /root/.nvm/versions/node/v${NODE_VERSION} +RUN echo $PATH +ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" +RUN echo $PATH + +# Install packages, build and keep only prod packages +WORKDIR /app +COPY . ./ +RUN apt-get update -y +RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 \ + libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 \ + libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ + libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 \ + libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 \ + libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \ + fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \ + wget libgbm-dev gnupg gnupg2 gnupg1 # Set the working directory to /app inside the container WORKDIR /app @@ -7,26 +34,26 @@ WORKDIR /app # Copy app files COPY . ./ -# Create and Assign permissions to npm folder -RUN mkdir /.npm && chmod 777 /.npm - -# Install packages, build and keep only prod packages -RUN npm ci -RUN npm run build -RUN npm prune --production - - -# Deployment container -FROM node:18.17.1-alpine -RUN npm cache clean --force +# Install Chrome version 114 +ENV CHROME_VERSION="114.0.5735.133-1" +RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \ + && apt install -y /tmp/chrome.deb \ + && rm /tmp/chrome.deb -# Create and Assign permissions to npm folder -RUN mkdir /.npm && chmod 777 /.npm -RUN mkdir /.cache && chmod 777 /.cache +# Set up directories and adjust permissions +RUN mkdir -p /root/.local/share/fonts \ + && mkdir -p /root/.config/puppeteer \ + && chmod -R 777 /root/.local \ + && chmod -R 777 /root/.config \ + && mkdir -p /.local \ + && chmod -R 777 /.local -# Set the working directory to /app inside the deployment container -WORKDIR /app +RUN npm config set user 0 +RUN npm config set unsafe-perm true +RUN npm ci --only=prod && \ + npm list rimraf && \ + npm run build # Set node to production ENV NODE_ENV production @@ -60,24 +87,8 @@ ENV CDOGS_CLIENT_SECRET ${CDOGS_CLIENT_SECRET} ENV CDOGS_URL ${CDOGS_URL} ENV ACCESS_API_URL ${ACCESS_API_URL} -# Copy production files from build -COPY --from=builder /app/package*.json ./ -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/dist ./dist - -RUN apk add --no-cache \ - chromium \ - nss \ - freetype \ - harfbuzz \ - ca-certificates \ - ttf-freefont - -ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser - # Expose Port EXPOSE 5001 -# Start the app -CMD ["npm", "run", "start:prod"] - +# # Start up command +ENTRYPOINT ["node", "dist/main"] \ No newline at end of file diff --git a/backend/dops/openshift.deploy.yml b/backend/dops/openshift.deploy.yml index 221558b64..9e3aec54d 100644 --- a/backend/dops/openshift.deploy.yml +++ b/backend/dops/openshift.deploy.yml @@ -19,19 +19,19 @@ parameters: - name: DOMAIN value: apps.silver.devops.gov.bc.ca - name: CPU_REQUEST - value: "25m" + value: "1" - name: MEMORY_REQUEST - value: "50Mi" + value: "2Gi" - name: CPU_LIMIT - value: "75m" + value: "2" - name: MEMORY_LIMIT - value: "150Mi" + value: "4Gi" - name: MIN_REPLICAS description: The minimum amount of replicas for the horizontal pod autoscaler. - value: "3" + value: "1" - name: MAX_REPLICAS description: The maximum amount of replicas for the horizontal pod autoscaler. - value: "5" + value: "1" - name: REGISTRY description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) value: ghcr.io @@ -350,7 +350,7 @@ objects: timeoutSeconds: 5 livenessProbe: successThreshold: 1 - failureThreshold: 3 + failureThreshold: 200 httpGet: path: / port: 5001 @@ -358,6 +358,8 @@ objects: initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 5 + securityContext: + allowPrivilegeEscalation: true - apiVersion: v1 kind: Service metadata: diff --git a/backend/dops/package-lock.json b/backend/dops/package-lock.json index 6b04a9406..370e12314 100644 --- a/backend/dops/package-lock.json +++ b/backend/dops/package-lock.json @@ -28,6 +28,9 @@ "@nestjs/swagger": "^7.0.0", "@nestjs/testing": "^9.4.3", "@nestjs/typeorm": "^10.0.0", + "@types/express": "^4.17.17", + "@types/multer": "^1.4.7", + "@types/passport-jwt": "^3.0.8", "cache-manager": "^5.2.3", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", @@ -39,8 +42,9 @@ "passport-jwt": "^4.0.1", "pdf-lib": "^1.17.1", "pg": "^8.11.0", - "puppeteer": "^21.2.1", + "puppeteer": "^20.7.4", "reflect-metadata": "^0.1.13", + "rimraf": "^5.0.1", "rxjs": "^7.8.1", "swagger-ui-express": "^4.6.3", "typeorm": "^0.3.16", @@ -48,11 +52,8 @@ }, "devDependencies": { "@golevelup/ts-jest": "^0.3.7", - "@types/express": "^4.17.17", "@types/jest": "^29.5.2", - "@types/multer": "^1.4.7", "@types/node": "^18.17.0", - "@types/passport-jwt": "^3.0.8", "@types/supertest": "^2.0.12", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", @@ -70,7 +71,6 @@ "jest-sonar-reporter": "^2.0.0", "lint-staged": "^13.2.2", "prettier": "^3.0.0", - "rimraf": "^5.0.1", "source-map-support": "^0.5.21", "supertest": "^6.3.3", "ts-jest": "^29.1.0", @@ -2204,7 +2204,6 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -2221,7 +2220,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, "engines": { "node": ">=12" }, @@ -2233,7 +2231,6 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, "engines": { "node": ">=12" }, @@ -2244,14 +2241,12 @@ "node_modules/@isaacs/cliui/node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -2268,7 +2263,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", - "dev": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -2283,7 +2277,6 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -3269,7 +3262,6 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, "optional": true, "engines": { "node": ">=14" @@ -3332,14 +3324,14 @@ "dev": true }, "node_modules/@puppeteer/browsers": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.7.1.tgz", - "integrity": "sha512-nIb8SOBgDEMFY2iS2MdnUZOg2ikcYchRrBoF+wtdjieRFKR2uGRipHY/oFLo+2N6anDualyClPzGywTHRGrLfw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", + "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", "dependencies": { "debug": "4.3.4", "extract-zip": "2.0.1", "progress": "2.0.3", - "proxy-agent": "6.3.1", + "proxy-agent": "6.3.0", "tar-fs": "3.0.4", "unbzip2-stream": "1.4.3", "yargs": "17.7.1" @@ -3349,6 +3341,14 @@ }, "engines": { "node": ">=16.3.0" + }, + "peerDependencies": { + "typescript": ">= 4.7.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@puppeteer/browsers/node_modules/cliui": { @@ -4179,7 +4179,6 @@ "version": "1.4.7", "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.7.tgz", "integrity": "sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA==", - "dev": true, "dependencies": { "@types/express": "*" } @@ -4198,7 +4197,6 @@ "version": "1.0.12", "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.12.tgz", "integrity": "sha512-QFdJ2TiAEoXfEQSNDISJR1Tm51I78CymqcBa8imbjo6dNNu+l2huDxxbDEIoFIwOSKMkOfHEikyDuZ38WwWsmw==", - "dev": true, "dependencies": { "@types/express": "*" } @@ -4207,7 +4205,6 @@ "version": "3.0.8", "resolved": "https://registry.npmjs.org/@types/passport-jwt/-/passport-jwt-3.0.8.tgz", "integrity": "sha512-VKJZDJUAHFhPHHYvxdqFcc5vlDht8Q2pL1/ePvKAgqRThDaCc84lSYOTQmnx3+JIkDlN+2KfhFhXIzlcVT+Pcw==", - "dev": true, "dependencies": { "@types/express": "*", "@types/jsonwebtoken": "*", @@ -4218,7 +4215,6 @@ "version": "0.2.35", "resolved": "https://registry.npmjs.org/@types/passport-strategy/-/passport-strategy-0.2.35.tgz", "integrity": "sha512-o5D19Jy2XPFoX2rKApykY15et3Apgax00RRLf0RUotPDUsYrQa7x4howLYr9El2mlUApHmCMv5CZ1IXqKFQ2+g==", - "dev": true, "dependencies": { "@types/express": "*", "@types/passport": "*" @@ -4301,9 +4297,9 @@ "dev": true }, "node_modules/@types/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.2.tgz", + "integrity": "sha512-Km7XAtUIduROw7QPgvcft0lIupeG8a8rdKL8RiSyKvlE7dYY31fEn41HVuQsRFDuROA8tA4K2UVL+WdfFmErBA==", "optional": true, "dependencies": { "@types/node": "*" @@ -5466,11 +5462,11 @@ } }, "node_modules/chromium-bidi": { - "version": "0.4.26", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.26.tgz", - "integrity": "sha512-lukBGfogAI4T0y3acc86RaacqgKQve47/8pV2c+Hr1PjcICj2K4OkL3qfX3qrqxxnd4ddurFC0WBA3VCQqYeUQ==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", + "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", "dependencies": { - "mitt": "3.0.1" + "mitt": "3.0.0" }, "peerDependencies": { "devtools-protocol": "*" @@ -5880,9 +5876,9 @@ } }, "node_modules/data-uri-to-buffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-5.0.1.tgz", - "integrity": "sha512-a9l6T1qqDogvvnw0nKlfZzqsyikEBZBClF39V3TFoKhDtGBqHu2HkuomJc02j5zft8zrUaXEuoicLeW54RkzPg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", + "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==", "engines": { "node": ">= 14" } @@ -6164,9 +6160,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1159816", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1159816.tgz", - "integrity": "sha512-2cZlHxC5IlgkIWe2pSDmCrDiTzbSJWywjbDDnupOImEBcG31CQgBLV8wWE+5t+C4rimcjHsbzy7CBzf9oFjboA==" + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" }, "node_modules/dezalgo": { "version": "1.0.4", @@ -6242,8 +6238,7 @@ "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", @@ -7553,7 +7548,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -7569,7 +7563,6 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", - "dev": true, "engines": { "node": ">=14" }, @@ -7768,12 +7761,12 @@ } }, "node_modules/get-uri": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.1.tgz", - "integrity": "sha512-7ZqONUVqaabogsYNWlYj0t3YZaL6dhuEueZXGF+/YVmf6dHmaFg8/6psJKqhx9QykIDKzpGcy2cn4oV4YC7V/Q==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", + "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", "dependencies": { "basic-ftp": "^5.0.2", - "data-uri-to-buffer": "^5.0.1", + "data-uri-to-buffer": "^6.0.0", "debug": "^4.3.4", "fs-extra": "^8.1.0" }, @@ -8690,7 +8683,6 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", - "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -10178,9 +10170,9 @@ } }, "node_modules/mitt": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", - "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.0.tgz", + "integrity": "sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==" }, "node_modules/mkdirp": { "version": "0.5.6", @@ -11205,18 +11197,18 @@ } }, "node_modules/proxy-agent": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", - "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.0", "lru-cache": "^7.14.1", - "pac-proxy-agent": "^7.0.1", + "pac-proxy-agent": "^7.0.0", "proxy-from-env": "^1.1.0", - "socks-proxy-agent": "^8.0.2" + "socks-proxy-agent": "^8.0.1" }, "engines": { "node": ">= 14" @@ -11293,43 +11285,51 @@ } }, "node_modules/puppeteer": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.2.1.tgz", - "integrity": "sha512-bgY/lYBH3rR+m5EP1FxzY2MRMrau7Pyq+N5YlspA63sF+cBkUiTn5WZXwXm7mEHwkkOSVi5LiS74T5QIgrSklg==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.9.0.tgz", + "integrity": "sha512-kAglT4VZ9fWEGg3oLc4/de+JcONuEJhlh3J6f5R1TLkrY/EHHIHxWXDOzXvaxQCtedmyVXBwg8M+P8YCO/wZjw==", "hasInstallScript": true, "dependencies": { - "@puppeteer/browsers": "1.7.1", - "cosmiconfig": "8.3.5", - "puppeteer-core": "21.2.1" + "@puppeteer/browsers": "1.4.6", + "cosmiconfig": "8.2.0", + "puppeteer-core": "20.9.0" }, "engines": { "node": ">=16.3.0" } }, "node_modules/puppeteer-core": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.2.1.tgz", - "integrity": "sha512-+I8EjpWFeeFKScpQiTEnC4jGve2Wr4eA9qUMoa8S317DJPm9h7wzrT4YednZK2TQZMyPtPQ2Disb/Tg02+4Naw==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", + "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", "dependencies": { - "@puppeteer/browsers": "1.7.1", - "chromium-bidi": "0.4.26", + "@puppeteer/browsers": "1.4.6", + "chromium-bidi": "0.4.16", "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1159816", - "ws": "8.14.1" + "devtools-protocol": "0.0.1147663", + "ws": "8.13.0" }, "engines": { "node": ">=16.3.0" + }, + "peerDependencies": { + "typescript": ">= 4.7.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/puppeteer/node_modules/cosmiconfig": { - "version": "8.3.5", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.5.tgz", - "integrity": "sha512-A5Xry3xfS96wy2qbiLkQLAg4JUrR2wvfybxj6yqLmrUfMAvhS3MZxIP2oQn0grgYIvJqzpeTEWu4vK0t+12NNw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", "dependencies": { - "import-fresh": "^3.3.0", + "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", - "parse-json": "^5.2.0", + "parse-json": "^5.0.0", "path-type": "^4.0.0" }, "engines": { @@ -11337,14 +11337,6 @@ }, "funding": { "url": "https://github.com/sponsors/d-fischer" - }, - "peerDependencies": { - "typescript": ">=4.9.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } } }, "node_modules/pure-rand": { @@ -11626,7 +11618,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", - "dev": true, "dependencies": { "glob": "^10.2.5" }, @@ -11644,7 +11635,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -11653,7 +11643,6 @@ "version": "10.2.6", "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz", "integrity": "sha512-U/rnDpXJGF414QQQZv5uVsabTVxMSwzS5CH0p3DRCIV6ownl4f7PzGnkGmvlum2wB+9RlJWJZ6ACU1INnBqiPA==", - "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", @@ -11675,7 +11664,6 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", - "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -11690,7 +11678,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", - "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -12241,7 +12228,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -12255,7 +12241,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -12310,7 +12295,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -13566,7 +13550,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -13598,9 +13581,9 @@ } }, "node_modules/ws": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", - "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "engines": { "node": ">=10.0.0" }, diff --git a/backend/dops/package.json b/backend/dops/package.json index 3f46de1d2..e1e76e529 100644 --- a/backend/dops/package.json +++ b/backend/dops/package.json @@ -60,6 +60,9 @@ "@nestjs/swagger": "^7.0.0", "@nestjs/testing": "^9.4.3", "@nestjs/typeorm": "^10.0.0", + "@types/multer": "^1.4.7", + "@types/express": "^4.17.17", + "@types/passport-jwt": "^3.0.8", "cache-manager": "^5.2.3", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", @@ -71,7 +74,8 @@ "passport-jwt": "^4.0.1", "pdf-lib": "^1.17.1", "pg": "^8.11.0", - "puppeteer": "^21.2.1", + "puppeteer": "^20.7.4", + "rimraf": "^5.0.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", "swagger-ui-express": "^4.6.3", @@ -80,11 +84,8 @@ }, "devDependencies": { "@golevelup/ts-jest": "^0.3.7", - "@types/express": "^4.17.17", "@types/jest": "^29.5.2", - "@types/multer": "^1.4.7", - "@types/node": "^18.17.0", - "@types/passport-jwt": "^3.0.8", + "@types/node": "^18.17.0", "@types/supertest": "^2.0.12", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", @@ -102,7 +103,6 @@ "jest-sonar-reporter": "^2.0.0", "lint-staged": "^13.2.2", "prettier": "^3.0.0", - "rimraf": "^5.0.1", "source-map-support": "^0.5.21", "supertest": "^6.3.3", "ts-jest": "^29.1.0", diff --git a/backend/dops/src/modules/dgen/dgen.service.ts b/backend/dops/src/modules/dgen/dgen.service.ts index 13cb25b19..b478902b4 100644 --- a/backend/dops/src/modules/dgen/dgen.service.ts +++ b/backend/dops/src/modules/dgen/dgen.service.ts @@ -231,18 +231,12 @@ export class DgenService { let browser: Browser; try { const browser = await puppeteer.launch({ + args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-gpu'], + executablePath: '/usr/bin/google-chrome-stable', headless: 'new', - //executablePath: 'usr/bin/chromium-browser', - args: [ - '--no-sandbox', - '--disable-setuid-sandbox', - '--disable-dev-shm-usage', - '--enable-gpu', - // '--no-first-run', - // '--no-zygote', - // '--single-process', - ], - ignoreDefaultArgs: ['--disable-extensions'], + env: { + ELECTRON_DISABLE_SANDBOX: '1', + }, }); const page = await browser.newPage(); await page.setContent(htmlBody);