Skip to content

Commit

Permalink
Adding Datadog Agent and tracing to gobble
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Dec 12, 2023
1 parent 74a6b78 commit 20f8f2b
Show file tree
Hide file tree
Showing 5 changed files with 424 additions and 21 deletions.
7 changes: 7 additions & 0 deletions devops/deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export AWS_PAGER=""

STACK_NAME="gobble"

# Ensure required secrets are set
if [[ -z "$DD_API_KEY" ]]; then
echo "Must provide DD_API_KEY in environment to deploy" 1>&2
exit 1
fi

echo "Deploying Gobble..."
echo "View stack log here: https://$AWS_REGION.console.aws.amazon.com/cloudformation/home?region=$AWS_REGION"

Expand All @@ -21,4 +27,5 @@ INSTANCE_HOSTNAME=$(aws cloudformation describe-stacks --stack-name $STACK_NAME

# Run the playbook! :-)
export ANSIBLE_HOST_KEY_CHECKING=False # If it's a new host, ssh known_hosts not having the key fingerprint will cause an error. Silence it
ansible-galaxy collection install datadog.dd
ansible-playbook -v -i $INSTANCE_HOSTNAME, -u ubuntu --private-key ~/.ssh/transitmatters-gobble.pem playbook.yml
11 changes: 10 additions & 1 deletion devops/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
- name: install poetry
shell: curl -sSL https://install.python-poetry.org | python3 -

- name: Install the Datadog Agent
import_role:
name: datadog.dd.agent

- name: copy config file
copy:
src: local.json
Expand All @@ -39,4 +43,9 @@
ansible.builtin.cron:
name: upload todays events to s3
minute: "0, 30"
job: "cd /home/ubuntu/gobble && poetry run python3 src/s3_upload.py"
job: "cd /home/ubuntu/gobble && poetry run ddtrace-run python3 src/s3_upload.py"

vars:
datadog_api_key: "{{ lookup('env', 'DD_API_KEY') }}"
datadog_site: "datadoghq.com"
datadog_apm_instrumentation_enabled: "all"
2 changes: 1 addition & 1 deletion devops/systemd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Type=simple
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu/gobble
ExecStart=/home/ubuntu/.local/bin/poetry run python3 src/gobble.py
ExecStart=/home/ubuntu/.local/bin/poetry run ddtrace-run python3 src/gobble.py
Restart=on-failure
RestartSec=5s

Expand Down
Loading

0 comments on commit 20f8f2b

Please sign in to comment.