From d71dcc3b184cbee9b2260b44d05780d585d06873 Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Sat, 23 Aug 2025 00:08:13 +0200 Subject: [PATCH] optimize setup Signed-off-by: Peter Siegmund --- Dockerfile | 8 ++------ Makefile | 22 ++++++++++++++++++++-- app.json | 14 -------------- build.gradle | 36 ++++++++++++++++++------------------ 4 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 app.json diff --git a/Dockerfile b/Dockerfile index be9d711..6b93a20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ USER app # Copy all needed project files to a folder COPY --chown=app ./gradle/ ./gradle -COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./app.json ./ +COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./ COPY --chown=app ./src ./src RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar @@ -28,10 +28,6 @@ USER app COPY --chown=app --from=build /usr/src/app/build/libs/*-SNAPSHOT.jar /usr/app/edge.jar COPY --chown=app --from=build /usr/src/app/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar -ENV JAVA_TOOL_OPTIONS="-javaagent:/usr/app/opentelemetry-javaagent.jar" -ENV OTEL_SERVICE_NAME="edge-service" -ENV OTEL_EXPORTER_OTLP_ENDPOINT="http://opentelemetry-collector.web:4318" - -HEALTHCHECK CMD curl --fail http://localhost:5000/actuator/health/liveness || exit 1 +HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health/liveness || exit 1 CMD ["java", "-jar", "/usr/app/edge.jar"] diff --git a/Makefile b/Makefile index 387226d..afee04a 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,20 @@ -git_hash: - @git rev-parse --short HEAD +REMOTE_HOST = mars3142@172.16.20.1 +PROJECT_NAME = firmware-hq +SERVICE_NAME = edge-service +RASPI_PATH = /mnt/data/${PROJECT_NAME} + +install: build deploy import cleanup + +build: + docker buildx build --platform linux/arm64 --no-cache -t ${PROJECT_NAME}/${SERVICE_NAME}:latest -o type=docker,dest=./${SERVICE_NAME}-arm64.tar . + +deploy: + scp ./${SERVICE_NAME}-arm64.tar ${REMOTE_HOST}:${RASPI_PATH}/ + +import: + ssh ${REMOTE_HOST} "sudo docker load -i ${RASPI_PATH}/${SERVICE_NAME}-arm64.tar && rm ${RASPI_PATH}/${SERVICE_NAME}-arm64.tar" + +cleanup: + rm -f ${SERVICE_NAME}-arm64.tar + +.PHONY: build deploy import cleanup diff --git a/app.json b/app.json deleted file mode 100644 index ded8ad0..0000000 --- a/app.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "healthchecks": { - "web": [ - { - "type": "readiness", - "name": "web check", - "description": "Checking if the app responds to the /actuator/health/readiness endpoint", - "path": "/actuator/health/readiness", - "port": 5000, - "attempts": 3 - } - ] - } -} diff --git a/build.gradle b/build.gradle index d0f3660..7640923 100644 --- a/build.gradle +++ b/build.gradle @@ -31,28 +31,28 @@ ext { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.modulith:spring-modulith-starter-core' - implementation 'org.springframework.cloud:spring-cloud-starter-gateway' - implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j' - implementation 'com.google.cloud:spring-cloud-gcp-starter' - implementation 'com.google.auth:google-auth-library-oauth2-http' - implementation 'io.grpc:grpc-netty' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' - implementation 'io.netty:netty-all' - implementation 'com.nimbusds:nimbus-jose-jwt:9.47' - implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' - implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' - implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.7.0' - implementation 'org.springdoc:springdoc-openapi-starter-webflux-api:2.7.0' - implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' - implementation 'org.springframework.cloud:spring-cloud-starter-config' - testImplementation 'io.projectreactor:reactor-test' + annotationProcessor 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' + implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' + implementation 'com.google.auth:google-auth-library-oauth2-http' + implementation 'com.google.cloud:spring-cloud-gcp-starter' + implementation 'com.nimbusds:nimbus-jose-jwt:9.47' + implementation 'io.grpc:grpc-netty' + implementation 'io.netty:netty-all' + implementation 'org.springdoc:springdoc-openapi-starter-webflux-api:2.7.0' + implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.7.0' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' + implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j' + implementation 'org.springframework.cloud:spring-cloud-starter-config' + implementation 'org.springframework.cloud:spring-cloud-starter-gateway' + implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' + implementation 'org.springframework.modulith:spring-modulith-starter-core' runtimeOnly 'org.springframework.modulith:spring-modulith-actuator' runtimeOnly 'org.springframework.modulith:spring-modulith-observability' - annotationProcessor 'org.projectlombok:lombok' + testImplementation 'io.projectreactor:reactor-test' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.modulith:spring-modulith-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'