Remove Gateway service and configuration

- Delete Gateway module, associated Spring Boot application, and related configuration (`GatewayApplication.java`, `application.yml`, and `pom.xml`).
- Remove Gateway references in `docker-compose.yml`, `.gitlab-ci.yml`, and `backend/pom.xml`.
- Update backend services to directly handle requests under `/api` prefix (e.g., `/api/customers`, `/api/contact`).
- Adjust frontend contact route to connect directly to the server, replacing gateway references with server URLs.
This commit is contained in:
2025-07-15 20:46:43 +02:00
parent c69786d14b
commit c0b3669c30
13 changed files with 13 additions and 177 deletions

View File

@@ -7,7 +7,6 @@ build_backend:
artifacts:
paths:
- backend/common/target/
- backend/gateway/target/
- backend/discovery/target/
- backend/server/target
expire_in: 1 hour
@@ -21,18 +20,6 @@ docker_common:
needs:
- build_backend
docker_gateway:
extends: .docker-build-template
variables:
IMAGE_NAME: gateway
COMMON_IMAGE: "$CI_REGISTRY/$CI_PROJECT_PATH/common"
WORKDIR_PATH: backend
DOCKERFILE_PATH: Dockerfile.app
BUILD_FOLDER: "gateway/target"
MAIN_CLASS: dev.rheinsw.gateway.GatewayApplication
needs:
- build_backend
- docker_common
docker_server:
extends: .docker-build-template

View File

@@ -1,88 +0,0 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.rheinsw</groupId>
<artifactId>backend</artifactId>
<version>1.0.0</version>
</parent>
<groupId>dev.rheinsw.backend</groupId>
<artifactId>gateway</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.2.0</version>
</dependency>
<!-- Tools -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.rheinsw</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -1,15 +0,0 @@
package dev.rheinsw.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Thatsaphorn Atchariyaphap
* @since 04.05.25
*/
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}

View File

@@ -1,19 +0,0 @@
server:
port: 8080
spring:
application:
name: gateway
main:
web-application-type: reactive # Set the application type to reactive
cloud:
gateway:
routes:
- id: server
uri: http://${SERVER_HOST:localhost}:8081
predicates:
- Path=/api/**
filters:
- StripPrefix=1
- PreserveHostHeader

View File

@@ -11,7 +11,6 @@
<modules>
<module>common</module>
<module>gateway</module>
<module>server</module>
</modules>

View File

@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/contact")
@RequestMapping("/api/contact")
public class ContactController {
private static final Logger log = LoggerFactory.getLogger(ContactController.class);

View File

@@ -24,7 +24,7 @@ import java.util.UUID;
* @since 02.07.25
*/
@RestController
@RequestMapping("/customers")
@RequestMapping("/api/customers")
@RequiredArgsConstructor
public class CustomerController extends AbstractController {

View File

@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 04.05.25
*/
@RestController
@RequestMapping("/mail")
@RequestMapping("/api/mail")
@RequiredArgsConstructor
public class MailController {

View File

@@ -23,7 +23,7 @@ import java.util.UUID;
* @since 12.07.25
*/
@RestController
@RequestMapping("/projects")
@RequestMapping("/api/projects")
@RequiredArgsConstructor
public class ProjectController extends AbstractController {

View File

@@ -1,5 +1,5 @@
server:
port: 8081
port: 8080
spring:
application:
@@ -49,4 +49,4 @@ hcaptcha:
logging:
level:
org.hibernate.SQL: ${LOG_SQL_LEVEL}
org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_BINDER_LEVEL}
org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_BINDER_LEVEL}