Skip to content

Commit

Permalink
Merge pull request #28 from MichiBaum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MichiBaum authored Jun 7, 2024
2 parents 26e1f56 + 011ef02 commit c29735b
Show file tree
Hide file tree
Showing 90 changed files with 14,119 additions and 392 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SPRING_ACTIVE_PROFILES=prod

USERMANAGEMENT_DB_PASSWORD=PleaseChangeMe
USERMANAGEMENT_DB=usermanagement

AUTHENTICATION_DB_PASSWORD=PleaseChangeMe
AUTHENTICATION_DB=authentication
AUTHENTICATION_DB=authentication
Empty file added .env.override
Empty file.
7 changes: 5 additions & 2 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Update contributors in README.md

on: [push, pull_request]
on:
push:
branches:
- master

jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: Automate contrib in readme
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.0.2
uses: akhilmhdh/contributors-readme-action@v2.3.8
with:
collaborators: all
commit_message: updated contributors in readme
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Publish

on:
pull_request:
push:
branches:
- master

Expand All @@ -10,19 +10,28 @@ jobs:
name: 'Build, upload docker containers and deploy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
java-version: '21'

- name: Set up node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Angular install
run: npm --prefix ./website install ./website

- name: Angular build
run: npm run --prefix website build-production

- name: Generate Javadoc
run: mvn javadoc:aggregate

- name: Maven Clean install
# Windows: ./mvnw clean install "-DdockerHub.username=${{secrets.DOCKER_USERNAME}}" "-DdockerHub.password=${{secrets.DOCKER_PASSWORD}}"
run: mvn clean install -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}

- name: Build & Publish docker images
run: mvn spring-boot:build-image --projects ./gateway-service,./admin-service,./javadoc-service,./registry-service,./usermanagement-service,./authentication-service -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}
- name: Maven package
# Windows: ./mvnw compile jib:build "-DdockerHub.username=${{secrets.DOCKER_USERNAME}}" "-DdockerHub.password=${{secrets.DOCKER_PASSWORD}}"
run: mvn package -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}
15 changes: 9 additions & 6 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v2

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Maven clean install
run: mvn clean install -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}
java-version: '21'

- name: Maven clean compile
run: mvn clean compile -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}} -DdockerHub.publish=false

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ There are microservices build with spring, spring cloud and so forth.
There are these microservices:
- [Admin Service](./admin-service/README.md)
- [Authentication Service](./authentication-service/README.md)
- [Gateway Service](./gateway-service/README.md)
- [Javadoc Service](./javadoc-service/README.md)
- [Registry Service](./registry-service/README.md)
- [Usermanagement Service](./usermanagement-service/README.md)
- [Website Service](./website-service/README.md)

## Release

Expand All @@ -41,6 +43,24 @@ Build docker images:

mvnw spring-boot:build-image --projects ./admin-service,./javadoc-service,./registry-service -DdockerHub.username=YourDockerHubUsername -DdockerHub.password=YourDockerHubPassword

### Container

#### Up

docker compose up --build -d

#### Down

docker compose down

#### Logs

# Follow
docker compose logs -f

# Single container
docker compose logs ´name´

### Change HOSTS file

#### Windows
Expand All @@ -54,6 +74,7 @@ In *C:\Windows\System32\drivers\etc* find file *hosts* and add those lines:
127.0.0.1 javadoc.michibaum.ch
127.0.0.1 usermanagement.michibaum.ch
127.0.0.1 authentication.michibaum.ch
127.0.0.1 michibaum.ch

#### Linux

Expand Down
31 changes: 1 addition & 30 deletions admin-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
!**/src/test/**/target/
57 changes: 28 additions & 29 deletions admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<parent>
<groupId>com.michibaum</groupId>
<artifactId>microservice</artifactId>
<version>1.0.0-TEST-4</version>
<version>1.0.0-TEST-8</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>admin-service</artifactId>
<name>admin-service</name>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
Expand All @@ -32,11 +32,6 @@
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
Expand All @@ -63,39 +58,43 @@

<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<additionalProperties>
<time>${maven.build.timestamp}</time>
</additionalProperties>
<excludeDevtools>true</excludeDevtools>
<optimizedLaunch>true</optimizedLaunch>
<image>
<from>
<image>eclipse-temurin:21-jre</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
</auth>
</from>
<to>
<!--suppress UnresolvedMavenProperty -->
<name>registry.hub.docker.com/${dockerHub.username}/${project.artifactId}:${project.version}</name>
<publish>true</publish>
</image>
<docker>
<publishRegistry>
<image>docker.io/${dockerHub.username}/${project.artifactId}</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
<url>${dockerHub.url}</url>
</publishRegistry>
</docker>
</auth>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build-info</goal>
<goal>build-image</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.michibaum.admin_service

import org.springframework.boot.autoconfigure.SpringBootApplication
import de.codecentric.boot.admin.server.config.EnableAdminServer
import org.springframework.boot.Banner
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
import org.springframework.scheduling.annotation.EnableScheduling
import org.springframework.boot.runApplication
Expand All @@ -13,5 +14,7 @@ import org.springframework.boot.runApplication
class AdminServiceApplication

fun main(args: Array<String>) {
runApplication<AdminServiceApplication>(*args)
runApplication<AdminServiceApplication>(*args){
setBannerMode(Banner.Mode.OFF)
}
}
6 changes: 6 additions & 0 deletions admin-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ spring:
eureka:
instance:
prefer-ip-address: true
client:
enabled: true
fetch-registry: true
register-with-eureka: true
refresh:
enable: true

management:
endpoints:
Expand Down
18 changes: 18 additions & 0 deletions admin-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%throwable
</Pattern>
</layout>
</appender>

<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>

</configuration>
Empty file.
8 changes: 4 additions & 4 deletions authentication-library/pom.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>microservice</artifactId>
<groupId>com.michibaum</groupId>
<version>1.0.0-TEST-4</version>
<version>1.0.0-TEST-8</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>authentication-library</artifactId>
<name>authentication-library</name>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
Expand Down
4 changes: 4 additions & 0 deletions authentication-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
Loading

0 comments on commit c29735b

Please sign in to comment.