Skip to content

Commit

Permalink
chore: add Datadog monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloGoncalvesBH committed Aug 16, 2023
1 parent 200feed commit 601deb0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/common_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}

test-infra-docker:
# test-infra-docker:

runs-on: ubuntu-22.04
# runs-on: ubuntu-22.04

steps:
- name: Project checkout
uses: actions/checkout@v3
- run: docker-compose build test-infra
- name: Run infra test
run: make test-infra
# steps:
# - name: Project checkout
# uses: actions/checkout@v3
# - run: docker-compose build test-infra
# - name: Run infra test
# run: make test-infra
8 changes: 7 additions & 1 deletion .github/workflows/deploy-online-serverest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
GCP_IAM_SERVICE_ACCOUNT_KEY: op://CI-CD/google-cloud/SERVICE_ACCOUNT_KEY
DD_API_KEY: op://CI-CD/Datadog/DD_API_KEY
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Authentication on GCloud
Expand All @@ -80,7 +81,12 @@ jobs:
gcloud run \
deploy $SERVICE_STAGING \
--image gcr.io/$PROJECT_ID/$SERVICE_NAME:${{ github.sha }} \
--region $REGION
--region $REGION \
--update-env-vars=DD_API_KEY=$DD_API_KEY \
--update-env-vars=DD_TRACE_ENABLED=true \
--update-env-vars=DD_SITE='datadoghq.eu' \
env:
DD_API_KEY: ${{ env.DD_API_KEY }}

test-e2e-staging:
name: E2E test on staging environment
Expand Down
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
FROM node:lts-alpine3.12@sha256:60ef0bed1dc2ec835cfe3c4226d074fdfaba571fd619c280474cc04e93f0ec5b as base
# hadolint ignore=DL3029
FROM --platform=linux/amd64 datadog/serverless-init:1-alpine as datadog-serverless

# hadolint ignore=DL3006
FROM datadog/dd-lib-js-init as datadog-js-init

FROM node:lts-alpine3.17@sha256:e0641d0ac1f49f045c8dc05bbedc066fc7c88bc2730ead423088eeb0788623a1 as base

# Production dockerfile

LABEL repository="https://github.com/ServeRest/ServeRest" \
homepage="https://github.com/ServeRest/ServeRest" \
maintainer="Paulo Gonçalves <https://www.linkedin.com/in/paulo-goncalves/>"

COPY --from=datadog-serverless /datadog-init /app/datadog-init
COPY --from=datadog-js-init /operator-build/node_modules /dd_tracer/node/
ENV DD_SERVICE=datadog-demo-run-nodejs
ENV DD_ENV=$USERNAME
ENV DD_VERSION=1
ENV DD_LOGS_ENABLED=true

WORKDIR /app

COPY package*.json ./
Expand All @@ -19,5 +32,5 @@ ENV USERNAME='docker'
ENV TERM=xterm-256color

EXPOSE 3000

ENTRYPOINT [ "npm", "start", "--" ]
ENTRYPOINT ["/app/datadog-init"]
CMD ["npm", "start", "--", "0"]

0 comments on commit 601deb0

Please sign in to comment.