Skip to content

Commit bf9ded8

Browse files
authored
[TRAIN-3215] Creates puppeteer release workflow, sets default env vars, QoL updates
2 parents b0b3d8a + 5336222 commit bf9ded8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6446
-8912
lines changed

.env.template

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,68 @@
1-
DD_API_KEY=
2-
DD_APP_KEY=
3-
# this is used specifically for datadog-ci
4-
DATADOG_API_KEY=
5-
DD_ENV=storedog-local
6-
DD_HOSTNAME=storedog-local-host
1+
# =============================================
2+
# Datadog API Keys and Configuration
3+
# =============================================
4+
DD_API_KEY= # Required for Datadog Agent and APM
5+
DD_APP_KEY= # Required for Datadog API access
6+
DATADOG_API_KEY= # Used specifically for datadog-ci
7+
NEXT_PUBLIC_DD_APPLICATION_ID= # Required for RUM in frontend service
8+
NEXT_PUBLIC_DD_CLIENT_TOKEN= # Required for RUM in frontend service
79

8-
# for puppeteer
9-
STOREDOG_URL=http://nginx:80
10+
# =============================================
11+
# Environment and Host Configuration
12+
# =============================================
13+
DD_ENV=development # usually set to some form of identifier of what the course/lab is (such as `dd101-sre`)
14+
DD_HOSTNAME=development-host # usually set to the DD_ENV with `-host` appended
15+
NEXT_PUBLIC_DD_ENV=development # Required for RUM in frontend service
16+
NEXT_PUBLIC_DD_SITE=datadoghq.com # Required for RUM in frontend service
1017

11-
# for spree, discounts, ads-python (if used), and dbm (if used)
12-
POSTGRES_USER=postgres
13-
POSTGRES_PASSWORD=postgres
14-
15-
# set versions of specific services (these are used in the `docker-compose.yml` file)
16-
# use NEXT_PUBLIC_* for frontend service to expose to the web browser
17-
NEXT_PUBLIC_DD_VERSION_FRONTEND=1.0.0
18-
# use for worker service too, since they use the same image
19-
DD_VERSION_BACKEND=1.0.0
18+
# =============================================
19+
# Service Versions
20+
# Follow Storedog releases except Redis (https://github.com/DataDog/storedog/releases)
21+
# =============================================
22+
NEXT_PUBLIC_DD_VERSION_FRONTEND=1.0.0 # use NEXT_PUBLIC_* to expose var to store frontend
23+
DD_VERSION_BACKEND=1.0.0 # Use for worker service as well, since they use the same Docker image
2024
DD_VERSION_DBM=1.0.0
2125
DD_VERSION_ADS=1.0.0
2226
DD_VERSION_DISCOUNTS=1.0.0
27+
DD_VERSION_POSTGRES=1.0.0
28+
DD_VERSION_NGINX=1.0.0
29+
DD_VERSION_REDIS=6.2
2330

24-
# NEXT_PUBLIC_* are exposed to the web browser and the server #
25-
# these are also used in `docker-compose.yml`
31+
# =============================================
32+
# Database Configuration (used in backend, worker, discounts, and dbm services)
33+
# =============================================
34+
POSTGRES_USER=postgres
35+
POSTGRES_PASSWORD=postgres
36+
DB_HOST=postgres
37+
DB_PORT=5432
38+
DB_POOL=25 # Database connection pool size set in backend service (default: 25)
39+
MAX_THREADS=5 # Maximum number of concurrent threads set in backend service (default: 5)
2640

27-
# used in server-side fetch calls in frontend service, note the use of full domains
28-
NEXT_PUBLIC_FRONTEND_API_ROUTE=http://nginx:80
29-
NEXT_PUBLIC_SPREE_API_HOST=http://nginx/services/backend
41+
# =============================================
42+
# Frontend Service Configuration
43+
# =============================================
44+
FRONTEND_COMMAND='npm run dev' # Command to run the frontend service (default: 'npm run dev', use 'npm run prod' for production)
45+
NEXT_PUBLIC_DD_SERVICE_FRONTEND=store-frontend # Service name for frontend service in Datadog
46+
NEXT_PUBLIC_FRONTEND_API_ROUTE=http://service-proxy:80 # base url for next.js API routes (default: 'http://service-proxy:80')
47+
NEXT_PUBLIC_SPREE_API_HOST=http://service-proxy/services/backend # base url for backend service (default: 'http://service-proxy/services/backend')
48+
NEXT_PUBLIC_SPREE_CLIENT_HOST=/services/backend # base url for backend service (default: '/services/backend')
49+
NEXT_PUBLIC_SPREE_IMAGE_HOST=/services/backend # base url for backend service (default: '/services/backend')
50+
NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN=service-proxy # allowed image domain for backend service (default: 'service-proxy')
51+
NEXT_PUBLIC_ADS_ROUTE=/services/ads # base url for ads service (default: '/services/ads')
52+
NEXT_PUBLIC_DISCOUNTS_ROUTE=/services/discounts # base url for discounts service (default: '/services/discounts')
53+
NEXT_PUBLIC_DBM_ROUTE=/services/dbm # base url for dbm service (default: '/services/dbm')
3054

31-
# for all client-side spree fetch calls from frontend service
32-
NEXT_PUBLIC_SPREE_CLIENT_HOST=/services/backend
33-
NEXT_PUBLIC_SPREE_IMAGE_HOST=/services/backend
34-
# configured in the next.config.js file to allow for image loading from the spree service
35-
NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN=nginx
55+
# =============================================
56+
# Backend Service Configuration
57+
# =============================================
58+
RAILS_ENV=production
59+
REDIS_URL=redis://redis:6379/0
60+
DISABLE_SPRING=1
3661

37-
# called in client-side fetch calls from frontend service (no need to include the domain)
38-
NEXT_PUBLIC_ADS_ROUTE=/services/ads
39-
NEXT_PUBLIC_DISCOUNTS_ROUTE=/services/discounts
40-
NEXT_PUBLIC_DBM_ROUTE=/services/dbm
62+
# =============================================
63+
# Puppeteer Configuration
64+
# =============================================
65+
STOREDOG_URL=http://service-proxy:80 # base url for storedog service (default: 'http://service-proxy:80')
66+
PUPPETEER_TIMEOUT=30000 # timeout for puppeteer (default: 30000)
4167

42-
# used in frontend service app.tsx file for RUM config
43-
NEXT_PUBLIC_DD_APPLICATION_ID=
44-
NEXT_PUBLIC_DD_CLIENT_TOKEN=
45-
NEXT_PUBLIC_DD_SITE=datadoghq.com
46-
NEXT_PUBLIC_DD_SERVICE_FRONTEND=store-frontend
47-
NEXT_PUBLIC_DD_ENV=storedog-local
48-
# see version in NEXT_PUBLIC_DD_VERSION_FRONTEND above
68+
SKIP_SESSION_CLOSE= # skip session close for puppeteer (default: ''). note that the current puppeteer script doesn't make use of this environment variable but can easily be updated to do so

.github/workflows/ads-java.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions: {}
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
paths:
99
- services/ads/java/**
1010
workflow_dispatch:
@@ -14,34 +14,34 @@ defaults:
1414
working-directory: ads
1515

1616
jobs:
17-
1817
build:
19-
2018
runs-on: ubuntu-latest
2119
permissions:
2220
packages: write
2321
contents: read
2422

2523
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v4
28-
29-
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
31-
32-
- name: Login to GHCR
33-
id: login-ghcr
34-
uses: docker/login-action@v3
35-
with:
36-
registry: ghcr.io
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Build and push
41-
uses: docker/build-push-action@v5
42-
with:
43-
context: ./services/ads/java
44-
platforms: linux/amd64,linux/arm64
45-
push: true
46-
tags: ghcr.io/datadog/storedog/ads-java:latest
47-
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Login to GHCR
31+
id: login-ghcr
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: ./services/ads/java
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ghcr.io/datadog/storedog/ads-java:latest
45+
build-args: |
46+
DD_GIT_REPOSITORY_URL=${{ github.repository }}
47+
DD_GIT_COMMIT_SHA=${{ github.sha }}

.github/workflows/backend.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions: {}
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
paths:
99
- services/backend/**
1010
workflow_dispatch:
@@ -14,34 +14,34 @@ defaults:
1414
working-directory: backend
1515

1616
jobs:
17-
1817
build:
19-
2018
runs-on: ubuntu-latest
2119
permissions:
2220
packages: write
2321
contents: read
2422

2523
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v4
28-
29-
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
31-
32-
- name: Login to GHCR
33-
id: login-ghcr
34-
uses: docker/login-action@v3
35-
with:
36-
registry: ghcr.io
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Build and push
41-
uses: docker/build-push-action@v5
42-
with:
43-
context: ./services/backend
44-
platforms: linux/amd64,linux/arm64
45-
push: true
46-
tags: ghcr.io/datadog/storedog/backend:latest
47-
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Login to GHCR
31+
id: login-ghcr
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: ./services/backend
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ghcr.io/datadog/storedog/backend:latest
45+
build-args: |
46+
DD_GIT_REPOSITORY_URL=${{ github.repository }}
47+
DD_GIT_COMMIT_SHA=${{ github.sha }}

.github/workflows/discounts.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions: {}
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
paths:
99
- services/discounts/**
1010
workflow_dispatch:
@@ -14,33 +14,34 @@ defaults:
1414
working-directory: discounts
1515

1616
jobs:
17-
1817
build:
19-
2018
runs-on: ubuntu-latest
2119
permissions:
2220
packages: write
2321
contents: read
2422

2523
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v4
28-
29-
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
31-
32-
- name: Login to GHCR
33-
id: login-ghcr
34-
uses: docker/login-action@v3
35-
with:
36-
registry: ghcr.io
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Build and push
41-
uses: docker/build-push-action@v5
42-
with:
43-
context: ./services/discounts
44-
platforms: linux/amd64,linux/arm64
45-
push: true
46-
tags: ghcr.io/datadog/storedog/discounts:latest
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Login to GHCR
31+
id: login-ghcr
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: ./services/discounts
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ghcr.io/datadog/storedog/discounts:latest
45+
build-args: |
46+
DD_GIT_REPOSITORY_URL=${{ github.repository }}
47+
DD_GIT_COMMIT_SHA=${{ github.sha }}

.github/workflows/frontend.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions: {}
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
paths:
99
- services/frontend/**
1010
workflow_dispatch:
@@ -14,34 +14,34 @@ defaults:
1414
working-directory: frontend
1515

1616
jobs:
17-
1817
build:
19-
2018
runs-on: ubuntu-latest
2119
permissions:
2220
packages: write
2321
contents: read
2422

2523
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v3
28-
29-
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
31-
32-
- name: Login to GHCR
33-
id: login-ghcr
34-
uses: docker/login-action@v3
35-
with:
36-
registry: ghcr.io
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Build and push
41-
uses: docker/build-push-action@v5
42-
with:
43-
context: ./services/frontend
44-
platforms: linux/arm64, linux/amd64
45-
push: true
46-
tags: ghcr.io/datadog/storedog/frontend:latest
47-
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Login to GHCR
31+
id: login-ghcr
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: ./services/frontend
42+
platforms: linux/arm64, linux/amd64
43+
push: true
44+
tags: ghcr.io/datadog/storedog/frontend:latest
45+
build-args: |
46+
DD_GIT_REPOSITORY_URL=${{ github.server_url }}/${{ github.repository }}
47+
DD_GIT_COMMIT_SHA=${{ github.sha }}

0 commit comments

Comments
 (0)