Compare commits
11 Commits
4558d2de25
...
main
Author | SHA1 | Date | |
---|---|---|---|
f86b2792ef
|
|||
feb96d32b6
|
|||
462aa6f87a | |||
|
34ccb3ae66 | ||
|
c55bf79909 | ||
|
508af76753 | ||
|
17748de229 | ||
cb144cf874
|
|||
34dd6323ef
|
|||
4ddcabd6c9
|
|||
e50fd5af74
|
@@ -9,12 +9,12 @@ WORKDIR /usr/src/app/
|
|||||||
RUN chown app:app /usr/src/app/
|
RUN chown app:app /usr/src/app/
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
|
# Copy all needed project files to a folder
|
||||||
COPY --chown=app ./gradle/ ./gradle
|
COPY --chown=app ./gradle/ ./gradle
|
||||||
COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./
|
COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./
|
||||||
|
COPY --chown=app ./src ./src
|
||||||
|
|
||||||
# Copy all needed project files to a folder
|
RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
|
||||||
COPY --chown=app:app ./src ./src
|
|
||||||
|
|
||||||
# Build the production package
|
# Build the production package
|
||||||
RUN ./gradlew clean build -x test
|
RUN ./gradlew clean build -x test
|
||||||
@@ -26,6 +26,9 @@ RUN useradd -m app
|
|||||||
USER app
|
USER app
|
||||||
|
|
||||||
COPY --chown=app --from=build /usr/src/app/build/libs/*-SNAPSHOT.jar /usr/app/eureka.jar
|
COPY --chown=app --from=build /usr/src/app/build/libs/*-SNAPSHOT.jar /usr/app/eureka.jar
|
||||||
|
COPY --chown=app --from=build /usr/src/app/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar
|
||||||
|
|
||||||
|
HEALTHCHECK CMD curl --fail http://localhost:8761/actuator/health/liveness || exit 1
|
||||||
|
|
||||||
EXPOSE 8761
|
EXPOSE 8761
|
||||||
CMD ["java", "-jar", "/usr/app/eureka.jar"]
|
CMD ["java", "-jar", "/usr/app/eureka.jar"]
|
||||||
|
17
Makefile
Normal file
17
Makefile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
REMOTE_HOST = mars3142@172.16.20.1
|
||||||
|
PROJECT_NAME = firmware-hq
|
||||||
|
SERVICE_NAME = eureka-service
|
||||||
|
RASPI_PATH = /mnt/data/${PROJECT_NAME}
|
||||||
|
|
||||||
|
install: build deploy import
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
.PHONY: build deploy import
|
14
app.json
14
app.json
@@ -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": 8761,
|
|
||||||
"attempts": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
11
build.gradle
11
build.gradle
@@ -1,8 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.springframework.boot' version '3.3.4'
|
id 'org.springframework.boot' version '3.4.0'
|
||||||
id 'io.spring.dependency-management' version '1.1.6'
|
id 'io.spring.dependency-management' version '1.1.6'
|
||||||
id "io.sentry.jvm.gradle" version "4.11.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'dev.mars3142.fhq'
|
group = 'dev.mars3142.fhq'
|
||||||
@@ -19,14 +18,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
set('springCloudVersion', "2023.0.3")
|
set('springCloudVersion', "2024.0.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
|
|
||||||
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
||||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||||
|
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
|
||||||
|
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
eureka-service-arm64.tar
Normal file
BIN
eureka-service-arm64.tar
Normal file
Binary file not shown.
@@ -37,10 +37,12 @@ spring:
|
|||||||
name: eureka-service
|
name: eureka-service
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: localhost
|
||||||
client:
|
client:
|
||||||
registerWithEureka: false
|
registerWithEureka: false
|
||||||
fetchRegistry: false
|
fetchRegistry: false
|
||||||
datacenter: hel1-dc2
|
serviceUrl:
|
||||||
|
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
|
||||||
|
datacenter: rpi5-1
|
||||||
environment: production
|
environment: production
|
||||||
instance:
|
|
||||||
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
|
|
||||||
|
Reference in New Issue
Block a user