Skip to content

Commit

Permalink
hotfix - increasing CPU and Memory request in Production backend. Rev…
Browse files Browse the repository at this point in the history
…erted change to frontend cpu/memory requirements. Changed logging for printPdf to aid debugging
  • Loading branch information
SoLetsDev committed Oct 26, 2023
1 parent ace5e0d commit 644475a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-to-openshift-backend-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ env:
MIN_REPLICAS: "3"
MAX_REPLICAS: "5"
MIN_CPU: "50m"
MAX_CPU: "100m"
MAX_CPU: "250m"
MIN_MEM: "200Mi"
MAX_MEM: "250Mi"
MAX_MEM: "700Mi"
# SITE_URL should have no scheme or port. It will be prepended with https://
HOST_ROUTE: ${{ secrets.SITE_URL }}
CA_CERT: ${{ secrets.CA_CERT }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-to-openshift-frontend-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ env:
MIN_REPLICAS: "3"
MAX_REPLICAS: "5"
MIN_CPU: "50m"
MAX_CPU: "250m"
MAX_CPU: "100m"
MIN_MEM: "200Mi"
MAX_MEM: "700Mi"
MAX_MEM: "250Mi"
# SITE_URL should have no scheme or port. It will be prepended with https://
HOST_ROUTE: ${{ secrets.SITE_URL }}
CA_CERT: ${{ secrets.CA_CERT }}
Expand Down
14 changes: 7 additions & 7 deletions backend/src/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ async function submitApplication(req, res) {
async function printPdf(req, numOfRetries = 0) {
let url = `${req.headers.referer}/printable`;

log.verbose('printPdf :: user is',req.session?.passport?.user?.displayName);
log.info('printPdf :: user is',req.session?.passport?.user?.displayName);
log.verbose('printPdf :: correlationId is', req.session.correlationID);
log.verbose('printPdf :: applicationId is', req.params.applicationId);
log.info('printPdf :: applicationId is', req.params.applicationId);
log.verbose('printPdf :: url path is', url);

const browser = await puppeteer.launch({
Expand All @@ -451,7 +451,7 @@ async function printPdf(req, numOfRetries = 0) {
}); //to debug locally add {headless: false, devtools: true} in options <-make sure they are boolean and not string

try {
log.verbose('printPdf :: starting new page');
log.info('printPdf :: starting new page');
const page = await browser.newPage();

await page.setRequestInterception(true);
Expand All @@ -463,14 +463,14 @@ async function printPdf(req, numOfRetries = 0) {
request.continue({ headers });
});

log.verbose('printPdf :: starting page load');
log.info('printPdf :: starting page load');
await page.goto(url, {waitUntil: 'networkidle0'});
await page.waitForSelector('#signatureTextField', {visible: true});
log.verbose('printPdf :: page loaded starting pdf creation');
log.info('printPdf :: page loaded starting pdf creation');
const pdfBuffer = await page.pdf({displayHeaderFooter: false, printBackground: true, timeout: 300000, width: 1280});
log.verbose('printPdf :: pdf buffer created starting compression');
log.info('printPdf :: pdf buffer created starting compression');
const compressedPdfBuffer = await compress(pdfBuffer, {gsModulePath: process.env.GHOSTSCRIPT_PATH}); //this is set in dockerfile to fix ghostscript error on deploy
log.verbose('printPdf :: compression completed for applicationId', req.params.applicationId);
log.info('printPdf :: compression completed for applicationId', req.params.applicationId);
await browser.close();

let payload;
Expand Down

0 comments on commit 644475a

Please sign in to comment.