Compare commits
12 Commits
fe76e786e9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
54cc7a711a
|
|||
|
d71dcc3b18
|
|||
|
fe854136ae
|
|||
|
|
329b82232f | ||
|
|
040e14153d | ||
|
|
d1da8a0cb1 | ||
|
|
867e36b913 | ||
|
|
e81ed33d74 | ||
|
1a9f9999af
|
|||
|
358b06b323
|
|||
|
b523a2fd61
|
|||
|
c30129cd97
|
45
.gitea/workflows/docker.yml
Normal file
45
.gitea/workflows/docker.yml
Normal 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 .
|
||||
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
@@ -1,11 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
39
.github/workflows/deploy-hetzner.yaml
vendored
39
.github/workflows/deploy-hetzner.yaml
vendored
@@ -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
|
||||
@@ -11,9 +11,11 @@ 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
|
||||
|
||||
# Build the production package
|
||||
RUN ./gradlew clean build -x test
|
||||
|
||||
@@ -24,7 +26,8 @@ RUN useradd -m app
|
||||
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
|
||||
|
||||
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"]
|
||||
|
||||
22
Makefile
22
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
|
||||
|
||||
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": 5000,
|
||||
"attempts": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
45
build.gradle
45
build.gradle
@@ -1,13 +1,12 @@
|
||||
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 'idea'
|
||||
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 {
|
||||
@@ -26,34 +25,34 @@ repositories {
|
||||
}
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "2023.0.3")
|
||||
set('springCloudVersion', "2024.0.0")
|
||||
set('springModulithVersion', "1.2.1")
|
||||
set('springCloudGCPVersion', "5.4.1")
|
||||
set('springCloudGCPVersion', "5.9.0")
|
||||
}
|
||||
|
||||
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.41.2'
|
||||
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-webmvc-ui:2.6.0'
|
||||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.6.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'
|
||||
|
||||
19
src/main/resources/css/404.css
Normal file
19
src/main/resources/css/404.css
Normal file
@@ -0,0 +1,19 @@
|
||||
body {
|
||||
height: 100vh;
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
transition: background-color 1s;
|
||||
}
|
||||
|
||||
canvas {
|
||||
margin-top: -5em;
|
||||
margin-bottom: -3em;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.rive-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Rive Hello World</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center">
|
||||
<canvas id="canvas" width="400" height="400"></canvas>
|
||||
</div>
|
||||
<script src="https://unpkg.com/@rive-app/canvas@2.20.0"></script>
|
||||
<script>
|
||||
const r = new rive.Rive({
|
||||
src: "https://cdn.rive.app/animations/vehicles.riv",
|
||||
canvas: document.getElementById("canvas"),
|
||||
autoplay: true,
|
||||
// artboard: "Arboard", // Optional. If not supplied the default is selected
|
||||
stateMachines: "bumpy",
|
||||
onLoad: () => {
|
||||
// Ensure the drawing surface matches the canvas size and device pixel ratio
|
||||
r.resizeDrawingSurfaceToCanvas();
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/main/resources/static/404.riv
Normal file
BIN
src/main/resources/static/404.riv
Normal file
Binary file not shown.
30
src/main/resources/static/error/404.html
Normal file
30
src/main/resources/static/error/404.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>404</title>
|
||||
<link href="/css/404.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body style="background-color: #EB3A60;">
|
||||
<div style="text-align: center">
|
||||
<canvas id="rive-canvas" style="width: 100%; height: 100%; margin: auto; display: block;"></canvas>
|
||||
</div>
|
||||
<script src="https://unpkg.com/@rive-app/canvas@2.20.0"></script>
|
||||
<script>
|
||||
const r = new rive.Rive({
|
||||
src: "https://cdn.rive.app/animations/vehicles.riv",
|
||||
// OR the path to a discoverable and public Rive asset
|
||||
// src: '/public/example.riv',
|
||||
canvas: document.getElementById("rive-canvas"),
|
||||
autoplay: true,
|
||||
// artboard: "Arboard", // Optional. If not supplied the default is selected
|
||||
stateMachines: "bumpy",
|
||||
onLoad: () => {
|
||||
r.resizeDrawingSurfaceToCanvas();
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user