Compare commits
20 Commits
2bcc2ec23f
...
0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| f49530653b | |||
| 25e70ddf68 | |||
| 4fca98dc72 | |||
| c453411444 | |||
| 85e4a2b125 | |||
| ece3e1d697 | |||
| d39b5e875c | |||
| 12f6733b48 | |||
|
|
e12e8067ce | ||
|
|
0b624f1562 | ||
| 76cfaecdda | |||
| 82cdca6f0a | |||
| 4fbee3852a | |||
| bed8a2e0f5 | |||
| 197e40dfd5 | |||
| 01aa12e8a2 | |||
| 6d806fbc20 | |||
| 77073ddba6 | |||
| 96b9989a2a | |||
| 38bb0f131c |
@@ -15,32 +15,40 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# 2. Set up Java and Maven
|
||||
- name: Set up JDK
|
||||
- name: Set up JDK (Eclipse Temurin)
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "17"
|
||||
cache: maven
|
||||
|
||||
- name: Verify Maven installation
|
||||
# 3. Verify Maven installation
|
||||
- name: Install Maven
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y maven
|
||||
mvn -version
|
||||
|
||||
# 3. Build the Spring Boot application
|
||||
# 4. Build the Spring Boot application
|
||||
- name: Build Spring Boot Application
|
||||
run: |
|
||||
mvn clean package -DskipTests
|
||||
|
||||
# 4. Set up Docker
|
||||
# 5. Set up Docker
|
||||
- name: Set up Docker
|
||||
run: |
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
# 5. Build the Docker image using docker-compose
|
||||
# 6. Build the Docker image
|
||||
- name: Build and Package Docker Image
|
||||
run: |
|
||||
docker-compose build
|
||||
docker build -t tea.zendric.de/cedric/xpensely-server:latest .
|
||||
|
||||
# 6. Start the application with dependencies
|
||||
- name: Start the Docker Compose Application
|
||||
# 7. Docker login
|
||||
- name: Login to Docker Registry
|
||||
run: |
|
||||
docker-compose up -d
|
||||
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
|
||||
|
||||
62
.gitea/workflows/tag_release.yml
Normal file
62
.gitea/workflows/tag_release.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
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=${GITEA_REF#refs/tags/}
|
||||
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,46 +0,0 @@
|
||||
name: Build and Deploy Spring Boot Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
# 1. Checkout the code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# 2. Set up Java and Maven
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: "17"
|
||||
|
||||
- name: Verify Maven installation
|
||||
run: |
|
||||
mvn -version
|
||||
|
||||
# 3. Build the Spring Boot application
|
||||
- name: Build Spring Boot Application
|
||||
run: |
|
||||
mvn clean package -DskipTests
|
||||
|
||||
# 4. Set up Docker
|
||||
- name: Set up Docker
|
||||
run: |
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
# 5. Build the Docker image using docker-compose
|
||||
- name: Build and Package Docker Image
|
||||
run: |
|
||||
docker-compose build
|
||||
|
||||
# 6. Start the application with dependencies
|
||||
- name: Start the Docker Compose Application
|
||||
run: |
|
||||
docker-compose up -d
|
||||
@@ -1,30 +1,42 @@
|
||||
version: "3"
|
||||
|
||||
version: "3.8"
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: XpenselyServer
|
||||
xpensely-server:
|
||||
image: tea.zendric.de/cedric/xpensely-server:latest
|
||||
container_name: xpensely-server
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- 3636:8080
|
||||
environment:
|
||||
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
||||
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
||||
DB_PORT: 5432
|
||||
DB_CONTAINER: ${DB_P_CONTAINER}
|
||||
DB_PORT: 5434
|
||||
DB_NAME: ${DB_P_NAME}
|
||||
DB_USERNAME: ${DB_USERNAME}
|
||||
DB_PASSWORD: ${DB_PASSWORD}
|
||||
depends_on:
|
||||
- postgresdb
|
||||
|
||||
postgresdb:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- xpensely-network
|
||||
postgresdb:
|
||||
image: postgres:14
|
||||
container_name: postgresdb
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- 5434:5432
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_P_NAME}
|
||||
POSTGRES_USER: ${DB_USERNAME}
|
||||
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>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.cdimascio</groupId>
|
||||
<artifactId>dotenv-java</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
|
||||
@@ -4,20 +4,11 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import io.github.cdimascio.dotenv.Dotenv;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class XpenselyServerApplication {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
# 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.password=${DB_PASSWORD}
|
||||
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