From 30c67c37a2a9e78c6ba802fe62bbcd674793b1aa Mon Sep 17 00:00:00 2001 From: Chris Pappas Date: Tue, 25 Jun 2024 16:12:41 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20allow=20apps=20provisioned=20with=20edx?= =?UTF-8?q?=5Fdjango=5Fservice=20to=20override=20COMM=E2=80=A6=20(#49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: allow apps provisioned with edx_django_service to override COMMON_ENABLE_NEWRELIC_APP * chore: bool flip everything * chore: simplify some variables --- playbooks/roles/ecommerce/defaults/main.yml | 1 + playbooks/roles/ecommerce/meta/main.yml | 1 + playbooks/roles/edx_django_service/defaults/main.yml | 1 + .../roles/edx_django_service/templates/edx/app/app/app.sh.j2 | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/ecommerce/defaults/main.yml b/playbooks/roles/ecommerce/defaults/main.yml index 91217930af2..edf7b862c96 100644 --- a/playbooks/roles/ecommerce/defaults/main.yml +++ b/playbooks/roles/ecommerce/defaults/main.yml @@ -310,6 +310,7 @@ ECOMMERCE_ENABLE_ADMIN_URLS_RESTRICTION: false ECOMMERCE_ADMIN_URLS: - admin +ECOMMERCE_ENABLE_NEWRELIC_APP: true ECOMMERCE_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false # Python 3 conversion diff --git a/playbooks/roles/ecommerce/meta/main.yml b/playbooks/roles/ecommerce/meta/main.yml index 504deab4ce5..46f74f57eb0 100644 --- a/playbooks/roles/ecommerce/meta/main.yml +++ b/playbooks/roles/ecommerce/meta/main.yml @@ -63,6 +63,7 @@ dependencies: - payment - \.well-known/apple-developer-merchantid-domain-association edx_django_service_automated_users: '{{ ECOMMERCE_AUTOMATED_USERS }}' + edx_django_service_enable_newrelic_app: '{{ ECOMMERCE_ENABLE_NEWRELIC_APP }}' edx_django_service_enable_newrelic_distributed_tracing: '{{ ECOMMERCE_ENABLE_NEWRELIC_DISTRIBUTED_TRACING }}' edx_django_service_decrypt_config_enabled: '{{ ECOMMERCE_DECRYPT_CONFIG_ENABLED }}' edx_django_service_copy_config_enabled: '{{ ECOMMERCE_COPY_CONFIG_ENABLED }}' diff --git a/playbooks/roles/edx_django_service/defaults/main.yml b/playbooks/roles/edx_django_service/defaults/main.yml index dc2e1a51a50..1ce2519c1a3 100644 --- a/playbooks/roles/edx_django_service/defaults/main.yml +++ b/playbooks/roles/edx_django_service/defaults/main.yml @@ -102,6 +102,7 @@ edx_django_service_basic_auth_exempted_paths_extra: [] edx_django_service_basic_auth_exempted_paths: '{{ edx_django_service_basic_auth_exempted_paths_default + edx_django_service_basic_auth_exempted_paths_extra }}' edx_django_service_newrelic_appname: '{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-{{ edx_django_service_name }}' +edx_django_service_enable_newrelic_app: '{{ COMMON_ENABLE_NEWRELIC_APP }}' edx_django_service_enable_newrelic_distributed_tracing: false edx_django_datadog_service: 'edx-{{ edx_django_service_name }}' edx_django_service_datadog_enable: '{{ COMMON_ENABLE_DATADOG and (COMMON_ENABLE_DATADOG_APP or edx_django_service_name in COMMON_ENABLE_DATADOG_APP_SERVICES) }}' diff --git a/playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2 b/playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2 index 96a36b6ab6a..fd10b96f03b 100644 --- a/playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2 +++ b/playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2 @@ -6,7 +6,7 @@ {% set executable = edx_django_service_venv_bin + '/gunicorn' %} -{% if COMMON_ENABLE_NEWRELIC_APP %} +{% if edx_django_service_enable_newrelic_app %} {% set executable = edx_django_service_venv_bin + '/newrelic-admin run-program ' + executable %} export NEW_RELIC_DISTRIBUTED_TRACING_ENABLED="{{ edx_django_service_enable_newrelic_distributed_tracing }}" @@ -53,7 +53,7 @@ exec docker run \ --name {{ edx_django_service_name }} \ --mount type=bind,src={{ edx_django_service_app_config_file }},dst={{ edx_django_service_app_config_file }} \ --publish 127.0.0.1:{{ edx_django_service_gunicorn_port }}:{{ edx_django_service_gunicorn_port }}/tcp \ -{% if COMMON_ENABLE_NEWRELIC_APP %} +{% if edx_django_service_enable_newrelic_app %} --env NEW_RELIC_DISTRIBUTED_TRACING_ENABLED \ --env NEW_RELIC_APP_NAME \ --env NEW_RELIC_PROCESS_HOST_DISPLAY_NAME \