Skip to content

Commit 96ba159

Browse files
authored
build and push clients (#43)
* adjust tasks * add GHA * deploy-dice tasks * WORK_DIR * 81 * 82
1 parent ba6dc2c commit 96ba159

File tree

13 files changed

+313
-64
lines changed

13 files changed

+313
-64
lines changed

.github/workflows/dice-go.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build and push dice-go
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "src/dice-go/**"
9+
10+
jobs:
11+
# test locally with: `act -s GITHUB_TOKEN=$(gh auth token) --env github.actor=$USER`
12+
# get 'act': https://nektosact.com/installation/index.html
13+
build-and-push-dice-go:
14+
name: Build and Push
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- name: Install Task
21+
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
22+
with:
23+
version: 3.x
24+
repo-token: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Checkout Code
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
- name: Build image
28+
run: task clients:build-dice-go
29+
- name: Login to GitHub Container Registry
30+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
31+
- name: Push to registry
32+
run: task clients:push-dice-go

.github/workflows/dice-java.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build and push dice-java
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "src/dice-java/**"
9+
10+
jobs:
11+
# test locally with: `act -s GITHUB_TOKEN=$(gh auth token) --env github.actor=$USER`
12+
# get 'act': https://nektosact.com/installation/index.html
13+
build-and-push-dice-java:
14+
name: Build and Push
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- name: Install Task
21+
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
22+
with:
23+
version: 3.x
24+
repo-token: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Checkout Code
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
- name: Build image
28+
run: task clients:build-dice-java
29+
- name: Login to GitHub Container Registry
30+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
31+
- name: Push to registry
32+
run: task clients:push-dice-java

.github/workflows/recommendation.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Recommendation
1+
name: build and push recommendation
22

33
on:
44
push:
@@ -24,9 +24,9 @@ jobs:
2424
repo-token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Checkout Code
2626
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27-
- name: Build `recommendation` image
28-
run: task recommendation:build
27+
- name: Build image
28+
run: task clients:build-recommendation
2929
- name: Login to GitHub Container Registry
3030
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
31-
- name: Push `recommendation` to registry
32-
run: task recommendation:push
31+
- name: Push to registry
32+
run: task clients:push-recommendation

kubectl/dice-go.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: dice-go
5+
namespace: otel-demo
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: dice-go
11+
template:
12+
metadata:
13+
labels:
14+
app: dice-go
15+
spec:
16+
containers:
17+
- name: dice-go
18+
image: ghcr.io/apeirora/audit-log-poc-for-otel/dice-go:latest
19+
imagePullPolicy: IfNotPresent
20+
env:
21+
- name: REST_PORT
22+
value: "8081"
23+
- name: OTEL_EXPORTER_OTLP_ENDPOINT_GRPC
24+
value: "http://otel-collector:4317"
25+
- name: OTEL_EXPORTER_OTLP_ENDPOINT_HTTP
26+
value: "http://otel-collector:4318"
27+
ports:
28+
- containerPort: 8081
29+
---
30+
apiVersion: v1
31+
kind: Service
32+
metadata:
33+
name: dice-go
34+
namespace: otel-demo
35+
spec:
36+
selector:
37+
app: dice-go
38+
ports:
39+
- protocol: TCP
40+
port: 8081
41+
targetPort: 8081
42+
nodePort: 30381
43+
type: NodePort

kubectl/dice-java.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: dice-java
5+
namespace: otel-demo
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: dice-java
11+
template:
12+
metadata:
13+
labels:
14+
app: dice-java
15+
spec:
16+
containers:
17+
- name: dice-java
18+
image: ghcr.io/apeirora/audit-log-poc-for-otel/dice-java:latest
19+
imagePullPolicy: IfNotPresent
20+
env:
21+
- name: REST_PORT
22+
value: "8082"
23+
- name: OTEL_EXPORTER_OTLP_ENDPOINT_GRPC
24+
value: "http://otel-collector:4317"
25+
- name: OTEL_EXPORTER_OTLP_ENDPOINT_HTTP
26+
value: "http://otel-collector:4318"
27+
ports:
28+
- containerPort: 8082
29+
---
30+
apiVersion: v1
31+
kind: Service
32+
metadata:
33+
name: dice-java
34+
namespace: otel-demo
35+
spec:
36+
selector:
37+
app: dice-java
38+
ports:
39+
- protocol: TCP
40+
port: 8082
41+
targetPort: 8082
42+
nodePort: 30382
43+
type: NodePort

src/dice-go/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags "-s -w" -o dice-go
1212
# --- Run Stage ---
1313
FROM gcr.io/distroless/static-debian12:nonroot
1414

15-
ARG REST_PORT=8080
15+
ARG REST_PORT=8081
1616
ENV REST_PORT=${REST_PORT}
1717

1818
LABEL org.opencontainers.image.source=https://github.com/apeirora/audit-log-poc-for-otel

src/dice-go/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func run() (err error) {
6565

6666
// Start HTTP server.
6767
srv := &http.Server{
68-
Addr: ":8081",
68+
Addr: "0.0.0.0:8081",
6969
BaseContext: func(_ net.Listener) context.Context { return ctx },
7070
ReadTimeout: time.Second,
7171
WriteTimeout: 10 * time.Second,

src/dice-java/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN mvn package -DskipTests
1313
# --- Run Stage ---
1414
FROM sapmachine:24-jre-alpine
1515

16-
ARG REST_PORT=8080
16+
ARG REST_PORT=8082
1717
ENV REST_PORT=${REST_PORT}
1818

1919
LABEL org.opencontainers.image.source=https://github.com/apeirora/audit-log-poc-for-otel

src/dice-java/src/main/resources/application.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ spring:
22
application:
33
name: demo
44
server:
5+
address: 0.0.0.0
56
port: 8082
67

78
management:
89
metrics:
910
export:
1011
enabled: false
1112
otlp:
12-
endpoint: http://172.19.0.2:31002
13+
endpoint: http://172.19.0.2:30318
1314
otlp:
1415
metrics:
1516
export:
@@ -18,6 +19,6 @@ management:
1819
otel:
1920
exporter:
2021
otlp:
21-
endpoint: http://172.19.0.2:31002
22+
endpoint: http://172.19.0.2:30318
2223
logs:
23-
endpoint: http://172.19.0.2:31002/v1/logs
24+
endpoint: http://172.19.0.2:30318/v1/logs

taskfile.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ includes:
2121
desc: Port-forward the otel-demo frontend-proxy service to localhost:8080.
2222
taskfile: ./tasks/otel.yaml
2323

24-
recommendation:
25-
desc: Builds the image of the recommendation service.
26-
taskfile: ./tasks/recommendation.yaml
24+
clients:
25+
desc: Builds the OTel clients - services in different languages.
26+
taskfile: ./tasks/clients.yaml
2727

2828
go:
2929
desc: Build the go application.

0 commit comments

Comments
 (0)