From fa9187108f315438ff6db33e56fe64dd3a3be1fd Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Tue, 19 Sep 2023 09:14:18 +0200 Subject: [PATCH] Add support for enabling tracing for single app servers --- ansible/_set_up_directories.yml | 1 - ansible/deploy.yml | 11 +++++++++++ ansible/inventories/prod.yml | 10 +++++----- greenweb/settings/production.py | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ansible/_set_up_directories.yml b/ansible/_set_up_directories.yml index 0dcdb2f2..46376084 100644 --- a/ansible/_set_up_directories.yml +++ b/ansible/_set_up_directories.yml @@ -16,7 +16,6 @@ owner: deploy group: deploy become: true - when: update_dotenv is true - name: Link .env to shared directory ansible.builtin.file: diff --git a/ansible/deploy.yml b/ansible/deploy.yml index 4461bc17..10b92a10 100644 --- a/ansible/deploy.yml +++ b/ansible/deploy.yml @@ -56,6 +56,17 @@ ansible.builtin.include_tasks: "_assemble_deploy_assets.yml" when: compile_assets is true + - name: Template .env file to shared directory + ansible.builtin.template: + src: "templates/dotenv.j2" + dest: "{{ project_root }}/shared/.env" + mode: "0755" + owner: deploy + group: deploy + become: true + when: update_dotenv is true + tags: [dotenv] + - name: Set up process management with supervisor ansible.builtin.include_tasks: "_set_up_process_mgmt.yml" tags: diff --git a/ansible/inventories/prod.yml b/ansible/inventories/prod.yml index 1395b14c..2fe3cba0 100644 --- a/ansible/inventories/prod.yml +++ b/ansible/inventories/prod.yml @@ -5,24 +5,24 @@ all: internal_ip: "10.0.0.5" dramatiq_threads: 2 dramatiq_processes: 3 - sentry_trace_rate: 0 + sentry_sample_rate: 0 app2.thegreenwebfoundation.org: internal_ip: "10.0.0.4" dramatiq_threads: 2 dramatiq_processes: 3 - sentry_trace_rate: 0 + sentry_sample_rate: 0 # TODO: once we have update the worker process names we can use app3 for serving production traffic # letting us decommission some of the older app servers app3.thegreenwebfoundation.org: internal_ip: "10.0.0.6" dramatiq_threads: 1 dramatiq_processes: 1 - sentry_trace_rate: 1 + sentry_sample_rate: 1 app4.thegreenwebfoundation.org: internal_ip: "10.0.0.7" dramatiq_threads: 2 dramatiq_processes: 3 - sentry_trace_rate: 0 + sentry_sample_rate: 0 vars: tgwf_stage: "prod" @@ -33,7 +33,7 @@ all: supervisor_user: "deploy" supervisor_gunicorn_app: "web_{{ tgwf_stage }}" supervisor_worker_job: "worker_{{ tgwf_stage }}" - port: 9000 + gunicorn_port: 9000 # you can set child groups too children: diff --git a/greenweb/settings/production.py b/greenweb/settings/production.py index 9c43a682..fe21d73c 100644 --- a/greenweb/settings/production.py +++ b/greenweb/settings/production.py @@ -54,7 +54,7 @@ # set our identifying credentials dsn=sentry_dsn, # Set traces_sample_rate. - traces_sample_rate=sentry_sample_rate, + traces_sample_rate=float(sentry_sample_rate), # activate the django specific integrations for sentry integrations=[DjangoIntegration()], # We assume that is a user is logged in, we want to be able