diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 2b502ea..78521b0 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -16,6 +16,7 @@ spring-cloud-eureka spring-cloud-hystrix-dashboard spring-cloud-config + spring-cloud-gateway diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml new file mode 100644 index 0000000..db532c6 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -0,0 +1,41 @@ + + + + spring-cloud + com.blockchain + 1.0-SNAPSHOT + + 4.0.0 + + spring-cloud-gateway + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.cloud + spring-cloud-starter-gateway + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-cloud/spring-cloud-gateway/src/main/java/com/blockchain/spring/cloud/gateway/GatewayApplication.java b/spring-cloud/spring-cloud-gateway/src/main/java/com/blockchain/spring/cloud/gateway/GatewayApplication.java new file mode 100644 index 0000000..cb2c46f --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/java/com/blockchain/spring/cloud/gateway/GatewayApplication.java @@ -0,0 +1,14 @@ +package com.blockchain.spring.cloud.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + + +@SpringBootApplication +@EnableEurekaClient +public class GatewayApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class,args); + } +} diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml b/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml new file mode 100644 index 0000000..a78b907 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/application.yml @@ -0,0 +1,82 @@ +server: + port: 8003 +spring: + application: + name: dapp-gateway-server + cloud: + gateway: + routes: + - id: blockchain-server-btc + uri: lb://dapp-btc-server + predicates: + - Path=/btc/** + filters: + - StripPrefix=1 + - id: blockchain-server-cct + uri: lb://dapp-cct-server + predicates: + - Path=/cct/** + filters: + - StripPrefix=1 + - id: blockchain-server-currency + uri: lb://dapp-currency-server + predicates: + - Path=/currency/** + filters: + - StripPrefix=1 + - id: blockchain-server-databot + uri: lb://dapp-databot-server + predicates: + - Path=/databot/** + filters: + - StripPrefix=1 + - id: blockchain-server-eos + uri: lb://dapp-eos-server + predicates: + - Path=/eos/** + filters: + - StripPrefix=1 + - id: blockchain-server-eth + uri: lb://dapp-eth-server + predicates: + - Path=/eth/** + filters: + - StripPrefix=1 + - id: blockchain-server-imjg + uri: lb://dapp-imjg-server + predicates: + - Path=/imjg/** + filters: + - StripPrefix=1 + - id: blockchain-server-otc + uri: lb://dapp-otc-server + predicates: + - Path=/otc/** + filters: + - StripPrefix=1 + - id: blockchain-server-sysconf + uri: lb://dapp-sysconf-server + predicates: + - Path=/sysconf/** + filters: + - StripPrefix=1 + - id: blockchain-server-user + uri: lb://dapp-user-server + predicates: + - Path=/user/** + filters: + - StripPrefix=1 + - id: blockchain-server-yyyf + uri: lb://dapp-yyyf-server + predicates: + - Path=/yyyfuser/** + filters: + - StripPrefix=1 +eureka: + client: + service-url: + defaultZone: http://${eureka-host}:8001/eureka/ + instance: + prefer-ip-address: true + instance-id: ${spring.cloud.client.ip-address}:${server.port} + hostname: ${spring.cloud.client.ip-address}