Compare commits
25 Commits
49401a8d09
...
0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3db2806a04 | |||
| d26a9bffc5 | |||
| 25e70ddf68 | |||
| 4fca98dc72 | |||
| c453411444 | |||
| 85e4a2b125 | |||
| ece3e1d697 | |||
| d39b5e875c | |||
| 12f6733b48 | |||
|
|
e12e8067ce | ||
|
|
0b624f1562 | ||
| 76cfaecdda | |||
| 82cdca6f0a | |||
| 4fbee3852a | |||
| bed8a2e0f5 | |||
| 197e40dfd5 | |||
| 01aa12e8a2 | |||
| 6d806fbc20 | |||
| 77073ddba6 | |||
| 96b9989a2a | |||
| 38bb0f131c | |||
| 2bcc2ec23f | |||
| 1fd1e8ae75 | |||
| ac804385c9 | |||
| 823b1182be |
54
.gitea/workflows/build.yml
Normal file
54
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
name: Build and Deploy Spring Boot Server
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 1. Checkout the code
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# 2. Set up Java and Maven
|
||||||
|
- name: Set up JDK (Eclipse Temurin)
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: "temurin"
|
||||||
|
java-version: "17"
|
||||||
|
cache: maven
|
||||||
|
|
||||||
|
# 3. Verify Maven installation
|
||||||
|
- name: Install Maven
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y maven
|
||||||
|
mvn -version
|
||||||
|
|
||||||
|
# 4. Build the Spring Boot application
|
||||||
|
- name: Build Spring Boot Application
|
||||||
|
run: |
|
||||||
|
mvn clean package -DskipTests
|
||||||
|
|
||||||
|
# 5. Set up Docker
|
||||||
|
- name: Set up Docker
|
||||||
|
run: |
|
||||||
|
docker --version
|
||||||
|
|
||||||
|
# 6. Build the Docker image
|
||||||
|
- name: Build and Package Docker Image
|
||||||
|
run: |
|
||||||
|
docker build -t tea.zendric.de/cedric/xpensely-server:latest .
|
||||||
|
|
||||||
|
# 7. Docker login
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
||||||
|
# 8. Push Docker image
|
||||||
|
- name: Push the Docker Image to registry
|
||||||
|
run: |
|
||||||
|
docker push tea.zendric.de/cedric/xpensely-server:latest
|
||||||
66
.gitea/workflows/tag_release.yml
Normal file
66
.gitea/workflows/tag_release.yml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
name: Build and Deploy Versioned Spring Boot Server
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*" # Match all tags
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 1. Checkout the code
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# 2. Set up Java and Maven
|
||||||
|
- name: Set up JDK (Eclipse Temurin)
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: "temurin"
|
||||||
|
java-version: "17"
|
||||||
|
cache: maven
|
||||||
|
|
||||||
|
# 3. Verify Maven installation
|
||||||
|
- name: Install Maven
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y maven
|
||||||
|
mvn -version
|
||||||
|
|
||||||
|
# 4. Build the Spring Boot application
|
||||||
|
- name: Build Spring Boot Application
|
||||||
|
run: |
|
||||||
|
mvn clean package -DskipTests
|
||||||
|
|
||||||
|
# 5. Set up Docker
|
||||||
|
- name: Set up Docker
|
||||||
|
run: |
|
||||||
|
docker --version
|
||||||
|
|
||||||
|
# 6. Extract the tag name
|
||||||
|
- name: Extract Tag Version
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
TAG_VERSION=$(echo "${GITHUB_REF}" | sed 's#refs/tags/##')
|
||||||
|
if [ -z "$TAG_VERSION" ]; then
|
||||||
|
echo "Error: TAG_VERSION is empty."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# 7. Build the Docker image with the tag
|
||||||
|
- name: Build and Package Docker Image
|
||||||
|
run: |
|
||||||
|
docker build -t tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }} .
|
||||||
|
|
||||||
|
# 8. Docker login
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin
|
||||||
|
|
||||||
|
# 9. Push the Docker image with the tag
|
||||||
|
- name: Push the Docker Image to registry
|
||||||
|
run: |
|
||||||
|
docker push tea.zendric.de/cedric/xpensely-server:${{ env.TAG_VERSION }}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ gitea.workspace }}
|
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
||||||
@@ -1,30 +1,42 @@
|
|||||||
version: "3"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
xpensely-server:
|
||||||
build:
|
image: tea.zendric.de/cedric/xpensely-server:latest
|
||||||
context: .
|
container_name: xpensely-server
|
||||||
dockerfile: Dockerfile
|
|
||||||
container_name: XpenselyServer
|
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- 3636:8080
|
||||||
environment:
|
environment:
|
||||||
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
||||||
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
||||||
DB_PORT: 5432
|
DB_PORT: 5434
|
||||||
DB_CONTAINER: ${DB_P_CONTAINER}
|
|
||||||
DB_NAME: ${DB_P_NAME}
|
DB_NAME: ${DB_P_NAME}
|
||||||
DB_USERNAME: ${DB_USERNAME}
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
DB_PASSWORD: ${DB_PASSWORD}
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgresdb
|
postgresdb:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- xpensely-network
|
||||||
postgresdb:
|
postgresdb:
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
container_name: postgresdb
|
container_name: postgresdb
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- 5434:5432
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: ${DB_P_NAME}
|
POSTGRES_DB: ${DB_P_NAME}
|
||||||
POSTGRES_USER: ${DB_USERNAME}
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
networks:
|
||||||
|
- xpensely-network
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
volumes:
|
||||||
|
db_data: null
|
||||||
|
networks:
|
||||||
|
xpensely-network: null
|
||||||
|
|||||||
5
pom.xml
5
pom.xml
@@ -50,11 +50,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.cdimascio</groupId>
|
|
||||||
<artifactId>dotenv-java</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
|||||||
@@ -4,20 +4,11 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
import io.github.cdimascio.dotenv.Dotenv;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class XpenselyServerApplication {
|
public class XpenselyServerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Dotenv dotenv = Dotenv.load(); // Loads the .env file
|
|
||||||
System.setProperty("GOOGLE_CLIENT_ID", dotenv.get("GOOGLE_CLIENT_ID"));
|
|
||||||
System.setProperty("GOOGLE_CLIENT_SECRET", dotenv.get("GOOGLE_CLIENT_SECRET"));
|
|
||||||
System.setProperty("DB_USERNAME", dotenv.get("DB_USERNAME"));
|
|
||||||
System.setProperty("DB_PASSWORD", dotenv.get("DB_PASSWORD"));
|
|
||||||
System.setProperty("DB_DEV_CONTAINER", dotenv.get("DB_DEV_CONTAINER"));
|
|
||||||
System.setProperty("DB_DEV_NAME", dotenv.get("DB_DEV_NAME"));
|
|
||||||
SpringApplication.run(XpenselyServerApplication.class, args);
|
SpringApplication.run(XpenselyServerApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ spring.security.oauth2.client.registration.google.client-secret=${GOOGLE_CLIENT_
|
|||||||
spring.security.oauth2.resourceserver.jwt.issuer-uri=https://accounts.google.com
|
spring.security.oauth2.resourceserver.jwt.issuer-uri=https://accounts.google.com
|
||||||
|
|
||||||
# PostgreSQL Configuration
|
# PostgreSQL Configuration
|
||||||
spring.datasource.url=jdbc:postgresql://${DB_DEV_CONTAINER}:5432/${DB_DEV_NAME}
|
spring.datasource.url=jdbc:postgresql://postgresdb:${DB_PORT}/${DB_P_NAME}
|
||||||
spring.datasource.username=${DB_USERNAME}
|
spring.datasource.username=${DB_USERNAME}
|
||||||
spring.datasource.password=${DB_PASSWORD}
|
spring.datasource.password=${DB_PASSWORD}
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|||||||
BIN
src/main/resources/static/xpensely_icon.png
Normal file
BIN
src/main/resources/static/xpensely_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/main/resources/static/xpensely_logo.png
Normal file
BIN
src/main/resources/static/xpensely_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Reference in New Issue
Block a user