Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/profiling-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
doorgame:
needs: detect-changes
if: needs.detect-changes.outputs.doorgame == 'true' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/test-gradle-smoke.yml
uses: ./.github/workflows/test-spring-boot-smoke.yml
with:
service-path: workshop/profiling/doorgame
port: 9090
java-version: '21'
smoke-path: /new-game
6 changes: 3 additions & 3 deletions .github/workflows/test-spring-boot-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:

- name: Smoke test - root endpoint
run: |
response=$(curl -sf http://localhost:${{ inputs.port }}/)
echo "GET / → $response"
[ "$response" = "Hello" ] || (echo "Expected 'Hello', got '$response'" && exit 1)
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:${{ inputs.port }}/)
echo "GET / → HTTP $status"
[ "$status" = "200" ] || (echo "Expected HTTP 200, got $status" && exit 1)

- name: Smoke test - test endpoint
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ workshop/aws/ec2/*.csv
local-hosting/multipass/terraform.tfvars
local-hosting/multipass/ubuntu-cloudinit.yml
workshop/aws/ec2/terraform.tfvars copy.template
workshop/profiling/doorgame/*
workshop/profiling/doorgame/target/*
content/en/ninja-workshops/8-advanced-otel/otelcol_darwin_arm64_splunk
content/en/ninja-workshops/8-advanced-otel/otelcol-contrib
workshop/ninja/advanced otel/gateway/otelcol_darwin_arm64_splunk
Expand Down
18 changes: 18 additions & 0 deletions workshop/profiling/doorgame/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.1
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
65 changes: 52 additions & 13 deletions workshop/profiling/doorgame/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,58 @@
FROM gradle:8.14.2-jdk21-jammy AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
#RUN gradle build --no-daemon
RUN ./gradlew shadowJar
FROM eclipse-temurin:21-jdk-alpine as builder

FROM eclipse-temurin:21-jre-jammy as final
ENV BUILD_HOME=/workspace/app
ENV ARTIFACTS=${BUILD_HOME}/target/dependency
ENV USR=svc
ENV GRP=svc
ENV UID=5001
ENV GID=5001

EXPOSE 9090
RUN addgroup --gid ${GID} -S ${GRP} \
&& adduser --disabled-password --gecos "" --ingroup ${GRP} --uid ${UID} --system ${USR}
RUN mkdir -p ${BUILD_HOME} /home/${USR} \
&& chown ${USR}:${GRP} -R ${BUILD_HOME} /home/${USR}
USER ${USR}

WORKDIR ${BUILD_HOME}/

COPY --chown=${USR}:${GRP} mvnw .
COPY --chown=${USR}:${GRP} .mvn .mvn
COPY --chown=${USR}:${GRP} pom.xml .
COPY --chown=${USR}:${GRP} src src

RUN ./mvnw clean install -DskipTests
RUN mkdir -p ${ARTIFACTS} && (cd ${ARTIFACTS}; find .. -type f -name "*.jar" -exec jar -xf {} \;)

FROM eclipse-temurin:21-jre-alpine

RUN mkdir /app
ENV USR=svc
ENV GRP=svc
ENV UID=5001
ENV GID=5001
ENV APP_HOME=/app
ENV APP_NAME=com.splunk.profiling.workshop.ServiceMain

COPY --from=build /home/gradle/src/build/libs/*.jar /app/profiling-workshop-all.jar
RUN addgroup --gid ${GID} -S ${GRP} \
&& adduser --disabled-password --gecos "" --ingroup ${GRP} --no-create-home --uid ${UID} --system ${USR}
RUN mkdir -p ${APP_HOME} && chown ${USR}:${GRP} -R ${APP_HOME}

# Adds the latest version of the Splunk Java agent
ADD https://github.com/signalfx/splunk-otel-java/releases/latest/download/splunk-otel-javaagent.jar .
# Download agent as root so we can set ownership; ADD from URL doesn't support --chown
RUN apk add --no-cache curl && \
curl -fsSL -o ${APP_HOME}/splunk-otel-javaagent.jar \
https://github.com/signalfx/splunk-otel-java/releases/latest/download/splunk-otel-javaagent.jar && \
chown ${USR}:${GRP} ${APP_HOME}/splunk-otel-javaagent.jar && \
apk del curl

USER ${USR}
WORKDIR ${APP_HOME}

COPY --chown=${USR}:${GRP} --from=builder /workspace/app/target/dependency/BOOT-INF/lib /app/lib
COPY --chown=${USR}:${GRP} --from=builder /workspace/app/target/dependency/META-INF /app/META-INF
COPY --chown=${USR}:${GRP} --from=builder /workspace/app/target/dependency/BOOT-INF/classes /app

EXPOSE 9090

# Modifies the entry point
ENTRYPOINT ["java","-javaagent:splunk-otel-javaagent.jar","-jar","/app/profiling-workshop-all.jar"]
ENTRYPOINT java \
-javaagent:${APP_HOME}/splunk-otel-javaagent.jar \
-Dotel.java.global-autoconfigure.enabled=true \
-cp ${APP_HOME}:${APP_HOME}/lib/* "${APP_NAME}"
42 changes: 0 additions & 42 deletions workshop/profiling/doorgame/build.gradle.kts

This file was deleted.

Binary file not shown.

This file was deleted.

Loading
Loading