Skip to content

Commit

Permalink
Merge pull request #458 from bcgov/derek-route-annotations
Browse files Browse the repository at this point in the history
adding in rate limit annotations to backend.dc.yaml
  • Loading branch information
roblo-cgi authored Oct 26, 2023
2 parents 8c774d1 + 644475a commit 8cee4d6
Show file tree
Hide file tree
Showing 4 changed files with 15 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
4 changes: 4 additions & 0 deletions tools/openshift/backend.dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ objects:
kind: Route
metadata:
annotations:
haproxy.router.openshift.io/rate-limit-connections: 'true'
haproxy.router.openshift.io/rate-limit-connections.concurrent-tcp: '10'
haproxy.router.openshift.io/rate-limit-connections.rate-http: '50'
haproxy.router.openshift.io/timeout: 120s
openshift.io/host.generated: 'true'
labels:
app: "${APP_NAME}-${BRANCH}"
Expand Down

0 comments on commit 8cee4d6

Please sign in to comment.