Skip to content

Commit

Permalink
Feat/datadog apm (#466)
Browse files Browse the repository at this point in the history
* build(deps): add dd-trace

* feat: use dd-trace

* ci: update ci

* fix: move dd-trace to top of file

* ci: test sed command

* fix(ci): add ebextensions to zip command

we need to explicitly provide the folder path in order for ebextensions to be zipped.
the injection step has been shifted infront so that the deploy folder will have the key.
this also reverts the sed command change which doesn't work on bash

* Fix: rebase errors

Co-authored-by: Preston Lim <prestonlimlianjie@gmail.com>
Co-authored-by: seaerchin <jiachin@open.gov.sg>
  • Loading branch information
3 people authored Jul 7, 2022
1 parent 0cfaf72 commit 537f914
Show file tree
Hide file tree
Showing 6 changed files with 568 additions and 95 deletions.
28 changes: 28 additions & 0 deletions .ebextensions/99datadog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .ebextensions/99datadog.config
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: DD_AGENT_MAJOR_VERSION
value: "7"
- namespace: aws:elasticbeanstalk:application:environment
option_name: DD_AGENT_MINOR_VERSION
value: "" # Eg: 34 to install 7.34.x, leave empty to install the latest 7.x

files:
"/etc/datadog-agent/datadog.yaml":
mode: "000640"
owner: root # will be changed to dd-agent after the installation
group: root
content: |
# Add here the Agent configuration
api_key: "@DD_API_KEY"
site: datadoghq.com

"/datadog_install_script.sh":
mode: "000700"
owner: root
group: root
source: https://s3.amazonaws.com/dd-agent/scripts/install_script.sh

container_commands:
05setup_datadog:
command: "DD_API_KEY=unused /datadog_install_script.sh; sed -i 's/ install_script/ ebs_install_script/' /etc/datadog-agent/install_info"
7 changes: 6 additions & 1 deletion .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ export POSTMAN_API_KEY=""
export POSTMAN_SMS_CRED_NAME=""

# Amplify
AWS_REGION="ap-southeast-1"
AWS_REGION="ap-southeast-1"

# DataDog
export DD_ENV="local"
export DD_SERVICE="isomer"
export DD_TAGS="service:isomer"
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ jobs:
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Inject DataDog API key
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
run: sed -i -e "s#@DD_API_KEY#$DD_API_KEY#g" .ebextensions/99datadog.config
- name: Install NPM
run: npm ci
- name: Build application
run: npm run build
- name: Zip application
run: zip -r "deploy.zip" * .platform -x .env-example .gitignore package-lock.json
run: zip -r "deploy.zip" * .platform .ebextensions -x .env-example .gitignore package-lock.json
- name: Get timestamp
shell: bash
run: echo "##[set-output name=timestamp;]$(env TZ=Asia/Singapore date '+%Y%m%d%H%M%S')"
Expand Down
Loading

0 comments on commit 537f914

Please sign in to comment.