From 192dc770dd57a613bc31734287d07fab8d8c051a Mon Sep 17 00:00:00 2001 From: rikuke <33894149+rikuke@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:31:34 +0200 Subject: [PATCH] feat: Hl 1573 maintenance improvements (#3650) * fix: OSerror in Sentry * feat: add support for vscode dev container * feat: set calculator constants from env variables --- backend/benefit/.prod/uwsgi.ini | 6 ++++++ backend/benefit/calculator/rules.py | 8 ++++---- backend/benefit/helsinkibenefit/settings.py | 8 ++++++++ frontend/Dockerfile-localdevelopment | 5 ++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/backend/benefit/.prod/uwsgi.ini b/backend/benefit/.prod/uwsgi.ini index 2b207ef5f1..c0127b2cc0 100644 --- a/backend/benefit/.prod/uwsgi.ini +++ b/backend/benefit/.prod/uwsgi.ini @@ -18,3 +18,9 @@ logger-req = stdio log-format = "remote_addr":"%(addr)", "x_forwarded_for":"%(var.HTTP_X_FORWARDED_FOR)", "request_id":"%(var.HTTP_X_REQUEST_ID)", "remote_user":"%(user)", "bytes_sent":%(size), "request_time":%(secs), "status":%(status), "host":"%(json_host)", "request_proto":"%(proto)", "path":"%(json_uri)", "request_length":%(cl), "http_referer":"%(referer)", "http_user_agent":"%(uagent)" log-req-encoder = format {"time":"${strftime:%%Y:%%m:%%d %%H:%%M:%%S}", "source":"uwsgi-req", ${msg}} log-req-encoder = nl + +# Suppress errors about clients closing sockets, happens with nginx as the ingress when +# http pipes are closed before workers has had the time to serve content to the pipe +ignore-sigpipe = true +ignore-write-errors = true +disable-write-exception = true \ No newline at end of file diff --git a/backend/benefit/calculator/rules.py b/backend/benefit/calculator/rules.py index 9b99b60865..a0f278ebb6 100644 --- a/backend/benefit/calculator/rules.py +++ b/backend/benefit/calculator/rules.py @@ -284,10 +284,10 @@ class SalaryBenefitCalculator2023(HelsinkiBenefitCalculator): """ # The maximum amount of pay subsidy depends on the pay subsidy percent in the pay subsidy decision. - PAY_SUBSIDY_MAX_FOR_100_PERCENT = 2020 - PAY_SUBSIDY_MAX_FOR_70_PERCENT = 1770 - PAY_SUBSIDY_MAX_FOR_50_PERCENT = 1260 - SALARY_BENEFIT_MAX = 800 + PAY_SUBSIDY_MAX_FOR_100_PERCENT = settings.PAY_SUBSIDY_MAX_FOR_100_PERCENT + PAY_SUBSIDY_MAX_FOR_70_PERCENT = settings.PAY_SUBSIDY_MAX_FOR_70_PERCENT + PAY_SUBSIDY_MAX_FOR_50_PERCENT = settings.PAY_SUBSIDY_MAX_FOR_50_PERCENT + SALARY_BENEFIT_MAX = settings.SALARY_BENEFIT_MAX SALARY_BENEFIT_NEW_MAX = settings.SALARY_BENEFIT_NEW_MAX @property diff --git a/backend/benefit/helsinkibenefit/settings.py b/backend/benefit/helsinkibenefit/settings.py index 6f674f5022..5192edf905 100644 --- a/backend/benefit/helsinkibenefit/settings.py +++ b/backend/benefit/helsinkibenefit/settings.py @@ -181,6 +181,10 @@ SALARY_BENEFIT_NEW_MAX=(int, 1500), INSTALMENT_THRESHOLD=(int, 9600), FIRST_INSTALMENT_LIMIT=(int, 9000), + PAY_SUBSIDY_MAX_FOR_100_PERCENT=(int, 2020), + PAY_SUBSIDY_MAX_FOR_70_PERCENT=(int, 1770), + PAY_SUBSIDY_MAX_FOR_50_PERCENT=(int, 1260), + SALARY_BENEFIT_MAX=(int, 800), ) if os.path.exists(env_file): env.read_env(env_file) @@ -572,3 +576,7 @@ SALARY_BENEFIT_NEW_MAX = env.int("SALARY_BENEFIT_NEW_MAX") INSTALMENT_THRESHOLD = env.int("INSTALMENT_THRESHOLD") FIRST_INSTALMENT_LIMIT = env.int("FIRST_INSTALMENT_LIMIT") +PAY_SUBSIDY_MAX_FOR_100_PERCENT = env.int("PAY_SUBSIDY_MAX_FOR_100_PERCENT") +PAY_SUBSIDY_MAX_FOR_70_PERCENT = env.int("PAY_SUBSIDY_MAX_FOR_70_PERCENT") +PAY_SUBSIDY_MAX_FOR_50_PERCENT = env.int("PAY_SUBSIDY_MAX_FOR_50_PERCENT") +SALARY_BENEFIT_MAX = env.int("SALARY_BENEFIT_MAX") diff --git a/frontend/Dockerfile-localdevelopment b/frontend/Dockerfile-localdevelopment index bc5df314d1..841a0564cf 100644 --- a/frontend/Dockerfile-localdevelopment +++ b/frontend/Dockerfile-localdevelopment @@ -5,7 +5,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18-minimal AS distbase USER root # Install ca-certificates so that Sentry can upload source maps -RUN microdnf update -y && microdnf install -y ca-certificates && microdnf clean all +RUN microdnf update -y && microdnf install -y ca-certificates gzip && microdnf clean all # Install yarn RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo @@ -49,6 +49,9 @@ RUN mkdir -p $PROJECT/$FOLDER/.next \ FROM appbase AS development # ============================= +# Create the directory with correct permissions for VSCode server +RUN mkdir -p /opt/app-root/src/.vscode-server && chown -R default:default /opt/app-root/src + # Copy all files COPY --chown=default:default . .