From 49446fdbe9f36e92b541c235ea77f6f05a8367a4 Mon Sep 17 00:00:00 2001 From: dandds Date: Thu, 9 Jan 2020 11:36:00 -0500 Subject: [PATCH 01/39] uWSGI plugin config changes. uWGI was generating warnings about being unable to find plugin files we specify. To fix this, I've added uwsgi-python3 to the list of Alpine packages we install in the container specified the plugins directory in the uWSGI config. The updated uWSGI ConfigMap has been applied to the staging cluster, which eliminated the warning about the logfile plugin. The remaining warning about the python3 plugin will be eliminated once the new container built by this branch is deployed. --- Dockerfile | 3 ++- deploy/azure/uwsgi-config.yml | 1 + uwsgi.ini | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1785b5d8..6f29d300 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,7 +73,8 @@ RUN apk update && \ postgresql-client \ postgresql-dev \ postgresql-libs \ - uwsgi-logfile + uwsgi-logfile \ + uwsgi-python3 COPY --from=builder /install/.venv/ ./.venv/ COPY --from=builder /install/alembic/ ./alembic/ diff --git a/deploy/azure/uwsgi-config.yml b/deploy/azure/uwsgi-config.yml index 553ea973..0c239637 100644 --- a/deploy/azure/uwsgi-config.yml +++ b/deploy/azure/uwsgi-config.yml @@ -10,6 +10,7 @@ data: callable = app module = app socket = /var/run/uwsgi/uwsgi.socket + plugins-dir = /usr/lib/uwsgi plugin = python3 plugin = logfile virtualenv = /opt/atat/atst/.venv diff --git a/uwsgi.ini b/uwsgi.ini index e1b9f912..9e0467be 100644 --- a/uwsgi.ini +++ b/uwsgi.ini @@ -2,6 +2,7 @@ callable = app module = app socket = /var/run/uwsgi/uwsgi.socket +plugins-dir = /usr/lib/uwsgi plugin = python3 plugin = logfile virtualenv = /opt/atat/atst/.venv From 1fa5de6f90f90b8cc94976ec540a7346c1a4ef0a Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:21:13 -0500 Subject: [PATCH 02/39] Add a configuration to totally disable the mailer --- atst/app.py | 3 ++- config/base.ini | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/atst/app.py b/atst/app.py index e9daabd6..d73188cf 100644 --- a/atst/app.py +++ b/atst/app.py @@ -159,6 +159,7 @@ def map_config(config): "ENV": config["default"]["ENVIRONMENT"], "BROKER_URL": config["default"]["REDIS_URI"], "DEBUG": config["default"].getboolean("DEBUG"), + "DEBUG_MAILER": config["default"].getboolean("DEBUG_MAILER"), "SQLALCHEMY_ECHO": config["default"].getboolean("SQLALCHEMY_ECHO"), "PORT": int(config["default"]["PORT"]), "SQLALCHEMY_DATABASE_URI": config["default"]["DATABASE_URI"], @@ -289,7 +290,7 @@ def make_crl_validator(app): def make_mailer(app): - if app.config["DEBUG"]: + if app.config["DEBUG"] or app.config["DEBUG_MAILER"]: mailer_connection = mailer.RedisConnection(app.redis) else: mailer_connection = mailer.SMTPConnection( diff --git a/config/base.ini b/config/base.ini index 9233ef21..1df7f47a 100644 --- a/config/base.ini +++ b/config/base.ini @@ -15,6 +15,7 @@ CRL_FAIL_OPEN = false CRL_STORAGE_CONTAINER = crls CSP=mock DEBUG = true +DEBUG_MAILER = false DISABLE_CRL_CHECK = false ENVIRONMENT = dev LIMIT_CONCURRENT_SESSIONS = false From e6078cbe4a5610775e8112076e6d7aa322731bf3 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:41:56 -0500 Subject: [PATCH 03/39] pipenv --py reports a big scary error on the first run. Silence stderr --- script/include/setup_functions.inc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/include/setup_functions.inc.sh b/script/include/setup_functions.inc.sh index 92c5dfa5..7f0512a7 100644 --- a/script/include/setup_functions.inc.sh +++ b/script/include/setup_functions.inc.sh @@ -22,7 +22,7 @@ check_for_existing_virtual_environment() { local target_python_version_regex="^Python ${python_version}" # Check for existing venv, and if one exists, save the Python version string - existing_venv_version=$($(pipenv --py) --version) + existing_venv_version=$($(pipenv --py 2> /dev/null) --version) if [ "$?" = "0" ]; then # Existing venv; see if the Python version matches if [[ "${existing_venv_version}" =~ ${target_python_version_regex} ]]; then From 741636f00a05d8554d3eb2c6c497dd6020eff782 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:42:12 -0500 Subject: [PATCH 04/39] This was erroring if the uploads directory already existed --- script/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/setup b/script/setup index 2e2dbcc6..a79c7be4 100755 --- a/script/setup +++ b/script/setup @@ -6,7 +6,7 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh # create upload directory for app -mkdir uploads | true +mkdir -p uploads # Enable database resetting RESET_DB="true" From d595ef60d34b08004885cb6de8f83e59efa7de51 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:46:03 -0500 Subject: [PATCH 05/39] Also supress the --version error --- script/include/setup_functions.inc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/include/setup_functions.inc.sh b/script/include/setup_functions.inc.sh index 7f0512a7..97ab9e4b 100644 --- a/script/include/setup_functions.inc.sh +++ b/script/include/setup_functions.inc.sh @@ -22,7 +22,7 @@ check_for_existing_virtual_environment() { local target_python_version_regex="^Python ${python_version}" # Check for existing venv, and if one exists, save the Python version string - existing_venv_version=$($(pipenv --py 2> /dev/null) --version) + existing_venv_version=$($(pipenv --py 2> /dev/null) --version 2> /dev/null) if [ "$?" = "0" ]; then # Existing venv; see if the Python version matches if [[ "${existing_venv_version}" =~ ${target_python_version_regex} ]]; then From b059605b37ed4027980e4b27f4585c85b53b46ab Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:52:18 -0500 Subject: [PATCH 06/39] Dropdb has a handy argument for conditionally dropping a database --- script/include/helper_functions.inc.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script/include/helper_functions.inc.sh b/script/include/helper_functions.inc.sh index 0df1323a..9f5de990 100644 --- a/script/include/helper_functions.inc.sh +++ b/script/include/helper_functions.inc.sh @@ -40,9 +40,7 @@ reset_db() { local database_name="${1}" # If the DB exists, drop it - set +e - dropdb "${database_name}" - set -e + dropdb --if-exists "${database_name}" # Create a fresh DB createdb "${database_name}" From 477afbe075670181f33732dbf7bac063b188257d Mon Sep 17 00:00:00 2001 From: graham-dds Date: Wed, 15 Jan 2020 15:02:07 -0500 Subject: [PATCH 07/39] use v-text for Vue validaitonError s --- templates/components/clin_dollar_amount.html | 2 +- templates/components/clin_fields.html | 2 +- templates/components/multi_checkbox_input.html | 2 +- templates/components/options_input.html | 2 +- templates/components/text_input.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/components/clin_dollar_amount.html b/templates/components/clin_dollar_amount.html index c39d3ef6..43973cc3 100644 --- a/templates/components/clin_dollar_amount.html +++ b/templates/components/clin_dollar_amount.html @@ -57,7 +57,7 @@ {{ "forms.task_order.clin_funding_errors.obligated_amount_error" | translate }}