Compare commits

...

12 Commits

Author SHA1 Message Date
ef6ef15e92 add actions
All checks were successful
Build and Push Multi-Arch Docker Image / build-and-push (push) Successful in 13m8s
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2025-12-16 10:58:35 +01:00
f86b2792ef optimize setup
Some checks failed
deploy to hetzner / deploy (push) Failing after 11m28s
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2025-08-23 00:09:16 +02:00
feb96d32b6 fix dependencies
Some checks failed
deploy to hetzner / deploy (push) Failing after 11m11s
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-12-12 00:22:26 +01:00
462aa6f87a add OpenTelemetry
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-12-12 00:18:41 +01:00
dependabot[bot]
34ccb3ae66 Bump io.sentry.jvm.gradle from 4.12.0 to 4.14.1
Bumps [io.sentry.jvm.gradle](https://github.com/getsentry/sentry-android-gradle-plugin) from 4.12.0 to 4.14.1.
- [Release notes](https://github.com/getsentry/sentry-android-gradle-plugin/releases)
- [Changelog](https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-android-gradle-plugin/compare/4.12.0...4.14.1)

---
updated-dependencies:
- dependency-name: io.sentry.jvm.gradle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 00:14:10 +01:00
dependabot[bot]
c55bf79909 Bump org.springframework.boot from 3.3.5 to 3.4.0
Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 3.3.5 to 3.4.0.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.5...v3.4.0)

---
updated-dependencies:
- dependency-name: org.springframework.boot
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 00:13:56 +01:00
dependabot[bot]
508af76753 Bump org.springframework.boot from 3.3.4 to 3.3.5
Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 3.3.4 to 3.3.5.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.4...v3.3.5)

---
updated-dependencies:
- dependency-name: org.springframework.boot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-31 23:38:58 +01:00
dependabot[bot]
17748de229 Bump io.sentry.jvm.gradle from 4.11.0 to 4.12.0
Bumps [io.sentry.jvm.gradle](https://github.com/getsentry/sentry-android-gradle-plugin) from 4.11.0 to 4.12.0.
- [Release notes](https://github.com/getsentry/sentry-android-gradle-plugin/releases)
- [Changelog](https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-android-gradle-plugin/compare/4.11.0...4.12.0)

---
updated-dependencies:
- dependency-name: io.sentry.jvm.gradle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-31 23:38:52 +01:00
cb144cf874 update Dockerfile
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-10-16 21:45:03 +02:00
34dd6323ef add health check into docker container
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-10-15 09:54:58 +02:00
4ddcabd6c9 new config
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-10-14 22:15:05 +02:00
e50fd5af74 fix dockerfile
Signed-off-by: Peter Siegmund <developer@mars3142.org>
2024-10-13 00:51:31 +02:00
8 changed files with 79 additions and 77 deletions

View File

@@ -0,0 +1,45 @@
name: Build and Push Multi-Arch Docker Image
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set Registry Domain
run: |
REGISTRY_DOMAIN=$(echo "${{ github.server_url }}" | sed 's|https://||' | sed 's|http://||')
echo "REGISTRY_DOMAIN=$REGISTRY_DOMAIN" >> $GITHUB_ENV
- name: Login to Gitea Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY_DOMAIN }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract Version
run: |
VERSION=$(grep "^version = " build.gradle | sed "s/version = '//" | sed "s/'//")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo $VERSION | cut -d. -f1,2)" >> $GITHUB_ENV
- name: Build and Push Multi-Arch Image
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:latest \
-t ${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.MAJOR }} \
-t ${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.MAJOR_MINOR }} \
-t ${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.VERSION }} \
--push .

View File

@@ -1,11 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -1,39 +0,0 @@
---
name: 'deploy to hetzner'
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Build with Gradle (no Testing)
run: ./gradlew clean build -x test
- name: Push to dokku
timeout-minutes: 20
uses: dokku/github-action@v1
with:
branch: main
git_remote_url: ${{ secrets.HETZNER_GIT_URI }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
git_push_flags: --force

View File

@@ -9,12 +9,12 @@ WORKDIR /usr/src/app/
RUN chown app:app /usr/src/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 ./gradlew ./build.gradle ./settings.gradle ./
COPY --chown=app ./src ./src
# Copy all needed project files to a folder
COPY --chown=app:app ./src ./src
RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
# Build the production package
RUN ./gradlew clean build -x test
@@ -26,6 +26,9 @@ RUN useradd -m 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/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar
HEALTHCHECK CMD curl --fail http://localhost:8761/actuator/health/liveness || exit 1
EXPOSE 8761
CMD ["java", "-jar", "/usr/app/eureka.jar"]

17
Makefile Normal file
View 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

View File

@@ -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
}
]
}
}

View File

@@ -1,12 +1,11 @@
plugins {
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.sentry.jvm.gradle" version "4.11.0"
}
group = 'dev.mars3142.fhq'
version = '0.0.1-SNAPSHOT'
version = '0.1.0-SNAPSHOT'
java {
toolchain {
@@ -19,14 +18,14 @@ repositories {
}
ext {
set('springCloudVersion', "2023.0.3")
set('springCloudVersion', "2024.0.0")
}
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'
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'
}

View File

@@ -37,10 +37,12 @@ spring:
name: eureka-service
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
datacenter: hel1-dc2
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
datacenter: rpi5-1
environment: production
instance:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}