Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Setup deployment microservice #54

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"java.debug.settings.hotCodeReplace": "auto",
"java.configuration.updateBuildConfiguration": "interactive"
"java.configuration.updateBuildConfiguration": "interactive",
"sqltools.connections": [
{
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"driver": "PostgreSQL",
"name": "application-server",
"database": "helios",
"username": "helios",
"password": "helios"
},
{
"previewLimit": 50,
"server": "localhost",
"port": 5433,
"driver": "PostgreSQL",
"name": "deployment-service",
"database": "deployment_service",
"username": "deployment-service",
"password": "helios"
}
]
}
18 changes: 15 additions & 3 deletions compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ services:
- '5432:5432'
volumes:
- db-data:/var/lib/postgresql/data


deployment-postgres:
image: 'postgres:16-alpine'
environment:
POSTGRES_DB: deployment_service
POSTGRES_PASSWORD: helios
POSTGRES_USER: deployment-service
ports:
- '5433:5432'
volumes:
- deployment-service-data:/var/lib/postgresql/data

webhook-listener:
build:
context: server/webhook-listener
Expand All @@ -25,14 +36,14 @@ services:
ports:
- "4222:4222"
- "8222:8222"
command: ["/bin/sh", "-c", "sed 's|{{NATS_AUTH_TOKEN}}|'\"$NATS_AUTH_TOKEN\"'|g' /etc/nats/nats-server.conf.template > /etc/nats/nats-server.conf && exec nats-server --config /etc/nats/nats-server.conf"]
command: [ "/bin/sh", "-c", "sed 's|{{NATS_AUTH_TOKEN}}|'\"$NATS_AUTH_TOKEN\"'|g' /etc/nats/nats-server.conf.template > /etc/nats/nats-server.conf && exec nats-server --config /etc/nats/nats-server.conf" ]
environment:
- NATS_AUTH_TOKEN=5760e8ae09adfb2756f9f8cd5cb2caa704cd3f549eaa9298be843ceb165185d815b81f90c680fa7f626b7cd63abf6ac9
volumes:
- nats-data:/data
- ./config/nats-server.conf:/etc/nats/nats-server.conf.template
healthcheck:
test: ["CMD", "wget", "--spider", "--quiet", "http://localhost:8222/healthz"]
test: [ "CMD", "wget", "--spider", "--quiet", "http://localhost:8222/healthz" ]
interval: 30s
timeout: 10s
retries: 5
Expand All @@ -58,3 +69,4 @@ services:
volumes:
db-data:
nats-data:
deployment-service-data:
3 changes: 3 additions & 0 deletions server/deployment-service/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
37 changes: 37 additions & 0 deletions server/deployment-service/.gitignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussion: can we share some of them in a global .gitignore in the server folder for all microservices? Not sure though, but I do not like the code duplication

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
52 changes: 52 additions & 0 deletions server/deployment-service/build.gradle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proposal: Seems like there are different spacings used in this file. I would propose to use a linter e.g. checkstyle also for the server part (of course in a separate issue)

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.6'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.springdoc.openapi-gradle-plugin' version '1.9.0'
id 'org.openapi.generator' version '6.6.0'
}

group = 'de.tum.cit.aet'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

openApi {
apiDocsUrl = 'http://localhost:8082/v3/api-docs.yaml'
outputDir = file('.')
outputFileName = 'openapi.yaml'
// Set the active profile to 'openapi'
customBootRun {
args.set(["--spring.profiles.active=openapi"])
}
}

tasks.named('test') {
useJUnitPlatform()
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading