Skip to content

Commit

Permalink
Merge pull request #131 from MichiBaum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MichiBaum authored Jan 3, 2025
2 parents e3a412d + a4c64db commit fd2bebc
Show file tree
Hide file tree
Showing 272 changed files with 2,909 additions and 2,201 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Pull Request Labeler"
name: Pull Request Labeler
on:
pull_request:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
distribution: 'zulu'
java-version: '21'
cache: 'maven'
# TODO maybe step to use Testcontainers Cloud but github actions env has docker already therefore no explicit docker installation is needed
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
13 changes: 13 additions & 0 deletions .run/All Backend.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All Backend" type="CompoundRunConfigurationType">
<toRun name="Dev Admin-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Authentication-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Chess-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Fitness-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Gateway-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Music-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Registry-Service" type="SpringBootApplicationConfigurationType" />
<toRun name="Dev Usermanagement-Service" type="SpringBootApplicationConfigurationType" />
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion .run/All Project Tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ENTRIES>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="openjdk-21" />
<option name="ALTERNATIVE_JRE_PATH" value="openjdk-23" />
<option name="PACKAGE_NAME" value="com.michibaum" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
Expand Down
2 changes: 1 addition & 1 deletion .run/All UT.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ENTRIES>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="openjdk-21" />
<option name="ALTERNATIVE_JRE_PATH" value="openjdk-23" />
<option name="PACKAGE_NAME" value="com.michibaum" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
Expand Down
21 changes: 21 additions & 0 deletions .run/Dev Admin-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Admin-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="admin-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.admin_service.AdminServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Authentication-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Authentication-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="authentication-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.authentication_service.AuthenticationServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Chess-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Chess-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="chess-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.chess_service.ChessServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Fitness-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Fitness-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="fitness-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.fitness_service.FitnessServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Gateway-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Gateway-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="gateway-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.gatewayservice.GatewayServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Music-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Music-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="music-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.music_service.MusicServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Registry-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Registry-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="registry-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.registry_service.RegistryServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Usermanagement-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Usermanagement-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="usermanagement-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.usermanagement_service.UsermanagementServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
21 changes: 21 additions & 0 deletions .run/Dev Website-Service.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev Website-Service" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<module name="website-service" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.michibaum.websiteservice.WebsiteServiceApplication" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH=".local-env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/Website start.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Website start" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/website/package.json" />
<command value="run" />
<scripts>
<script value="start" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
124 changes: 1 addition & 123 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,130 +47,8 @@ And these databases:
- Chess DB
- Fitness DB

## Actions

### Labeler

There is a github action, witch sets automatic labels on Pull requests.

### OSV Scanner

This scanner scans the dependencies and creates a vulnerability report.

## Maven

### Release plugin

The Maven Release Plugin automates the process of releasing project versions by updating version numbers and creating
tags in the version control system. Use the command `mvn release:update-versions` to update the version information in
your project's `pom.xml` files.

## Docker

### Container

#### Up

```
docker compose up -d
```

#### Down

```
docker compose down
```

#### Logs

```
# Follow
docker compose logs -f
# Single container
docker compose logs ´name´
```

#### Stats

```
docker stats
```

### Docker database backup

Replace 'PASSWORD' with password defined in .env.
Replace path '/data/db-backup' if different location is needed.
```
# Save sql file
docker exec microservices-chess-db-1 mysqldump -u root -pPASSWORD chess > someFilename.sql
# Save gzip
docker exec microservices-chess-db-1 mysqldump -u root -pPASSWORD chess | gzip -c > /data/db-backup/chess_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
# All databases, replace password and save path
docker exec microservices-chess-db-1 mysqldump -u root -pPASSWORD chess | gzip -c > /data/db-backup/chess_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
docker exec microservices-music-db-1 mysqldump -u root -pPASSWORD music | gzip -c > /data/db-backup/music_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
docker exec microservices-fitness-db-1 mysqldump -u root -pPASSWORD fitness | gzip -c > /data/db-backup/fitness_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
docker exec microservices-usermanagement-db-1 mysqldump -u root -pPASSWORD usermanagement | gzip -c > /data/db-backup/usermanagement_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
docker exec microservices-authentication-db-1 mysqldump -u root -pPASSWORD authentication | gzip -c > /data/db-backup/authentication_$(date -d "today" +"%Y-%m-%d_%H-%M").sql.gz
# Add to crontab (escape % with \%)
crontab -e
# List cronjobs
crontab -l
```

### Change HOSTS file (for dev on local machine)
*Remember to take Backup before editing your `hosts` file, mistakes there can block your internet access or cause other network-related issues.*


#### Windows

In *C:\Windows\System32\drivers\etc* find file *hosts* and add those lines:

```
# Microservices
127.0.0.1 chess.michibaum.ch
127.0.0.1 gateway.michibaum.ch
127.0.0.1 registry.michibaum.ch
127.0.0.1 admin.michibaum.ch
127.0.0.1 usermanagement.michibaum.ch
127.0.0.1 authentication.michibaum.ch
127.0.0.1 fitness.michibaum.ch
127.0.0.1 music.michibaum.ch
127.0.0.1 michibaum.ch
```

#### Linux

File: */etc/hosts*


### Scan docker files

```
docker scan YourDockerHubUsername/DockerHubRepository:TagName --dependency-tree
```

## Local dev db

```
docker run --name microservices -e MARIADB_ROOT_PASSWORD=someRootPass -p 3306:3306 -d mariadb:10.11
```

After that create the databases in the container.

```
create schema `authentication-db`;
create schema `chess-db`;
create schema `fitness-db`;
create schema `music-db`;
create schema `usermanagement-db`;
```

The tables are created trough [flyway](https://documentation.red-gate.com/fd/migrations-184127470.html).
All docs can be found [/docs/Writerside/topics](/docs/Writerside/topics/Overview.md)


## License
Expand Down
Loading

0 comments on commit fd2bebc

Please sign in to comment.