diff --git a/server/.github/workflows/postman.yml b/.github/workflows/postman.yml similarity index 75% rename from server/.github/workflows/postman.yml rename to .github/workflows/postman.yml index 660db18..b57b382 100644 --- a/server/.github/workflows/postman.yml +++ b/.github/workflows/postman.yml @@ -28,15 +28,15 @@ jobs: - name: Run Docker Compose uses: hoverkraft-tech/compose-action@v2.0.1 with: - compose-file: "./postman-docker-compose.yml" + compose-file: "./registry-server-runner/postman-docker-compose.yml" action: "up" - name: Run Application With Postman Tests run: | - docker compose -f postman-docker-compose.yml up --build --exit-code-from newman + docker compose -f ./registry-server-runner/postman-docker-compose.yml up --build --exit-code-from newman - name: Clean up containers uses: hoverkraft-tech/compose-action@v2.0.1 with: - compose-file: "./postman-docker-compose.yml" + compose-file: "./registry-server-runner/postman-docker-compose.yml" action: "down" diff --git a/pom.xml b/pom.xml index 6d02a17..80620be 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ server-bom server + registry-server-runner diff --git a/server/Dockerfile b/registry-server-runner/Dockerfile similarity index 74% rename from server/Dockerfile rename to registry-server-runner/Dockerfile index 6835a57..075133d 100644 --- a/server/Dockerfile +++ b/registry-server-runner/Dockerfile @@ -1,6 +1,6 @@ FROM openjdk:23-jdk-slim RUN apt-get update && apt-get install -y curl -ARG JAR_FILE=target/*.jar +ARG JAR_FILE=./registry-server-runner/target/*.jar COPY ${JAR_FILE} app.jar EXPOSE 9095 ENTRYPOINT ["java", "-jar", "/app.jar"] diff --git a/registry-server-runner/pom.xml b/registry-server-runner/pom.xml new file mode 100644 index 0000000..91d4e67 --- /dev/null +++ b/registry-server-runner/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.michael + service-container-parent + 1.0.0 + + + registry-server-runner + + + 23 + 23 + UTF-8 + + + + + + com.michael + service-container-parent + 1.0.0 + pom + import + + + + + + + com.michael + service-container-server + 1.0.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 3.4.5 + + + + repackage + + + + + + + + \ No newline at end of file diff --git a/server/postman-docker-compose.yml b/registry-server-runner/postman-docker-compose.yml similarity index 89% rename from server/postman-docker-compose.yml rename to registry-server-runner/postman-docker-compose.yml index e29d0b4..24f6181 100644 --- a/server/postman-docker-compose.yml +++ b/registry-server-runner/postman-docker-compose.yml @@ -46,7 +46,7 @@ services: - spring.profiles.active=automation build: context: .. - dockerfile: ../Dockerfile + dockerfile: ./registry-server-runner/Dockerfile ports: - "9095:9095" networks: @@ -66,8 +66,8 @@ services: newman: image: postman/newman:alpine volumes: - - ./postman/environment/env.json:/etc/newman/environment.json - - ./postman/collection/collection.json:/etc/newman/collection.json + - ../registry-server-runner/postman/environment/env.json:/etc/newman/environment.json + - ../registry-server-runner/postman/collection/collection.json:/etc/newman/collection.json networks: - app-network depends_on: diff --git a/server/postman/collection/collection.json b/registry-server-runner/postman/collection/collection.json similarity index 100% rename from server/postman/collection/collection.json rename to registry-server-runner/postman/collection/collection.json diff --git a/server/postman/environment/env.json b/registry-server-runner/postman/environment/env.json similarity index 100% rename from server/postman/environment/env.json rename to registry-server-runner/postman/environment/env.json diff --git a/registry-server-runner/src/main/java/com/michael/container/Runner.java b/registry-server-runner/src/main/java/com/michael/container/Runner.java new file mode 100644 index 0000000..889a12d --- /dev/null +++ b/registry-server-runner/src/main/java/com/michael/container/Runner.java @@ -0,0 +1,12 @@ +package com.michael.container; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Runner { + + public static void main(String[] args) { + SpringApplication.run(Runner.class); + } +} diff --git a/registry-server-runner/src/main/resources/application.properties b/registry-server-runner/src/main/resources/application.properties new file mode 100644 index 0000000..0200aa8 --- /dev/null +++ b/registry-server-runner/src/main/resources/application.properties @@ -0,0 +1,6 @@ +service.registry.enabled=true +server.port=9095 +server.servlet.context-path=/service-registry/api/v2 +spring.redis.host=${REDIS_HOST} +spring.redis.port=${REDIS_PORT} +etcd.leader.key=/leader \ No newline at end of file diff --git a/server/standalone-docker-compose.yml b/registry-server-runner/standalone-docker-compose.yml similarity index 96% rename from server/standalone-docker-compose.yml rename to registry-server-runner/standalone-docker-compose.yml index 9bc728b..1d49d1d 100644 --- a/server/standalone-docker-compose.yml +++ b/registry-server-runner/standalone-docker-compose.yml @@ -49,7 +49,7 @@ services: - REDIS_PORT=6379 build: context: .. - dockerfile: ../Dockerfile + dockerfile: ./registry-server-runner/Dockerfile depends_on: redis: condition: service_healthy diff --git a/server/src/main/java/com/michael/container/RegistryRunner.java b/server/src/main/java/com/michael/container/RegistryRunner.java deleted file mode 100644 index 427d0fc..0000000 --- a/server/src/main/java/com/michael/container/RegistryRunner.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.michael.container; - -// @SpringBootApplication -// public class RegistryRunner { -// -// public static void main(String[] args) { -// SpringApplication.run(RegistryRunner.class); -// } -// } diff --git a/server/src/main/java/com/michael/container/auto/ScanPackages.java b/server/src/main/java/com/michael/container/auto/ScanPackages.java index 89cdea6..3efb2af 100644 --- a/server/src/main/java/com/michael/container/auto/ScanPackages.java +++ b/server/src/main/java/com/michael/container/auto/ScanPackages.java @@ -3,10 +3,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; @ComponentScan("com.michael.container") @Configuration -@ConditionalOnProperty(value = "service.registry.enabled", havingValue = "true", matchIfMissing = true) -@EnableRedisRepositories(basePackages = "com.michael.container") +@ConditionalOnProperty(value = "service.registry.enabled", havingValue = "true") public class ScanPackages {} diff --git a/server/src/main/java/com/michael/container/config/RedisConfiguration.java b/server/src/main/java/com/michael/container/config/RedisConfiguration.java index d1cf13e..ec052e2 100644 --- a/server/src/main/java/com/michael/container/config/RedisConfiguration.java +++ b/server/src/main/java/com/michael/container/config/RedisConfiguration.java @@ -17,10 +17,12 @@ import org.springframework.data.redis.listener.ChannelTopic; import org.springframework.data.redis.listener.PatternTopic; import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration +@EnableRedisRepositories(basePackages = "com.michael.container") public class RedisConfiguration { @Bean public RedisConnectionFactory redisConnectionFactory( diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties index 662385c..b3da2ef 100644 --- a/server/src/main/resources/application.properties +++ b/server/src/main/resources/application.properties @@ -1,8 +1,3 @@ -server.port=9095 -server.servlet.context-path=/service-registry/api/v2 - etcd.urls=${ETCD_URLS} -etcd.leader.key=/leader - spring.redis.host=${REDIS_HOST} spring.redis.port=${REDIS_PORT} \ No newline at end of file diff --git a/server/src/test/java/com/michael/container/RegistryRunner.java b/server/src/test/java/com/michael/container/RegistryRunner.java new file mode 100644 index 0000000..e5596c3 --- /dev/null +++ b/server/src/test/java/com/michael/container/RegistryRunner.java @@ -0,0 +1,11 @@ +package com.michael.container; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class RegistryRunner { + public static void main(String[] args) { + SpringApplication.run(RegistryRunner.class); + } +}