210 lines
5.8 KiB
Markdown
210 lines
5.8 KiB
Markdown
# Office Test Environment
|
||
|
||
> [!info] Key Takeaways
|
||
> - **Environment**: Chengdu Airport office test environment with 3-server Docker Swarm cluster
|
||
> - **Architecture**: Microservices architecture using Spring Cloud Gateway, Eureka service registry, and Kafka messaging
|
||
> - **Servers**: hz015 (swarm leader), hz016 (swarm worker), hz018 (database server)
|
||
> - **Core Services**: adminapi (management), gatewayapi (API gateway), msgexchangeapi (message processing), kafkawsproxyapi (WebSocket proxy)
|
||
> - **Infrastructure**: MySQL + Oracle dual databases, Redis cluster, Elasticsearch, Kafka, monitoring via Grafana/Prometheus
|
||
> - **Repository**: [app-stack on local Gitea](https://gitea.int.it2000.com.cn/cdia/app-stack)
|
||
|
||
## Server Infrastructure
|
||
|
||
| server name | ip address | components |
|
||
| ----------------------- | -------------- | ------------------- |
|
||
| hz015.int.it2000.com.cn | 10.100.100.181 | docker swarm leader |
|
||
| hz016.int.it2000.com.cn | 10.100.100.182 | docker swarm worker |
|
||
| hz018.int.it2000.com.cn | 10.100.100.184 | database |
|
||
|
||
|
||
## Component
|
||
- 基础设施
|
||
- 数据库
|
||
- oracle
|
||
- mysql
|
||
- redis
|
||
- elastic search
|
||
- 消息服务
|
||
- apache zookeeper
|
||
- apache kafka
|
||
- 应用程序注册
|
||
- eureka
|
||
- 网关
|
||
- spring cloud
|
||
- 监控服务
|
||
- 日志集中
|
||
- logstash
|
||
- grafana
|
||
- promethues
|
||
- 管理工具
|
||
- portainer
|
||
- kafka
|
||
- 应用程序
|
||
- adminapi - 管理接口
|
||
- kafkawsproxyapi - kafka消息websocket代理
|
||
- msgexchangeapi - 消息处理
|
||
- servicecenter - eureka消息注册
|
||
- sysapi
|
||
|
||
## Deployment
|
||
|
||
### App Stack
|
||
[local git](https://gitea.int.it2000.com.cn/cdia/app-stack)
|
||
|
||
- adminapi (管理程序)
|
||
2 个数据库配置,一个mysql, 一个oracle
|
||
|
||
```yaml
|
||
spring:
|
||
jpa:
|
||
show-sql: true
|
||
datasource:
|
||
primary:
|
||
username: root
|
||
password: admingzzn
|
||
url: >-
|
||
jdbc:mysql://hz018.int.it2000.com.cn:3306/cdairport?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&autoReconnect=true
|
||
max-active: 30
|
||
test-on-borrow: true
|
||
validation-query: SELECT 1
|
||
initialSize: 5
|
||
min-idle: 1
|
||
max-wait: 60000
|
||
time-between-eviction-runs-millis: 60000
|
||
min-evictable-idle-time-millis: 300000
|
||
test-while-idle: true
|
||
test-on-return: true
|
||
pool-prepared-statements: false
|
||
max-pool-prepared-statement-per-connection-size: 20
|
||
secondary:
|
||
username: omms
|
||
password: omms
|
||
url: 'jdbc:oracle:thin:@hz018.int.it2000.com.cn:1521/orcl'
|
||
driver: oracle.jdbc.driver.OracleDriver
|
||
max-active: 30
|
||
test-on-borrow: true
|
||
validation-query: SELECT 1 FROM dual
|
||
initial-size: 10
|
||
min-idle: 1
|
||
max-wait: 60000
|
||
time-between-eviction-runs-millis: 60000
|
||
min-evictable-idle-time-millis: 300000
|
||
test-while-idle: true
|
||
test-on-return: true
|
||
pool-prepared-statements: false
|
||
max-pool-prepared-statement-per-connection-size: 20
|
||
eureka:
|
||
client:
|
||
service-url:
|
||
defaultZone: 'http://hz015.int.it2000.com.cn:94/eureka/'
|
||
instance:
|
||
prefer-ip-address: false
|
||
hostName: adminapi
|
||
sysApi:
|
||
host: hz015.int.it2000.com.cn
|
||
port: 80
|
||
schema: http
|
||
baseUrl: '${sysApi.schema}://SYSAPI'
|
||
getOpLogSwitchByLevleAndNameUrl: '${sysApi.baseUrl}/oplog/getOpLogSwitch/{level}/{name}'
|
||
logstash:
|
||
host: 'hz015.int.it2000.com.cn:5000'
|
||
elasticsearch:
|
||
ip: hz016.int.it2000.com.cn
|
||
port: 9300
|
||
pool: 5
|
||
cluster:
|
||
name: docker-cluster
|
||
nodes: 'hz016.int.it2000.com.cn:9300'
|
||
maxSize: 10000
|
||
|
||
```
|
||
|
||
gatewayapi (api gateway)
|
||
|
||
```yaml
|
||
spring:
|
||
application:
|
||
name: gatewayapi
|
||
redis:
|
||
cluster:
|
||
nodes:
|
||
- 'hz018.int.it2000.com.cn:7000'
|
||
- 'hz018.int.it2000.com.cn:7001'
|
||
- 'hz018.int.it2000.com.cn:7002'
|
||
- 'hz018.int.it2000.com.cn:7003'
|
||
- 'hz018.int.it2000.com.cn:7004'
|
||
- 'hz018.int.it2000.com.cn:7005'
|
||
pool:
|
||
max-idle: 10
|
||
min-idle: 0
|
||
max-active: 200
|
||
max-wait: -1
|
||
timeout: 1000
|
||
cloud:
|
||
gateway:
|
||
default-filters:
|
||
- PermissionCheckFilter
|
||
routes:
|
||
- id: host_adminapi
|
||
uri: 'lb://ADMINAPI'
|
||
predicates:
|
||
- Path=/adminapi/**
|
||
filters:
|
||
- StripPrefix=1
|
||
- id: host_sysapi
|
||
uri: 'lb://SYSAPI'
|
||
predicates:
|
||
- Path=/sysapi/**
|
||
filters:
|
||
- StripPrefix=1
|
||
- id: host_msgexchangeapi
|
||
uri: 'lb://MSGEXCHANGEAPI'
|
||
predicates:
|
||
- Path=/msgexchangeapi/**
|
||
filters:
|
||
- StripPrefix=1
|
||
- id: host_kafkawsproxyapi
|
||
uri: 'lb://KAFKAWSPROXYAPI'
|
||
predicates:
|
||
- Path=/v2/broker
|
||
- id: host_adminweb
|
||
uri: 'http://10.100.100.181:96'
|
||
predicates:
|
||
- Path=/adminweb/**
|
||
filters:
|
||
- StripPrefix=1
|
||
- id: host_redirect
|
||
uri: 'http://10.100.100.181/adminweb/'
|
||
predicates:
|
||
- Path=/
|
||
filters:
|
||
- 'RedirectTo=302, http://10.100.100.181/adminweb/'
|
||
gateway:
|
||
loginUrl: '/adminweb/#/login'
|
||
sysApi:
|
||
schema: http
|
||
baseUrl: '${sysApi.schema}://SYSAPI'
|
||
getUserByLoginName: '${sysApi.baseUrl}/setting/user/detail/{loginName}'
|
||
publicurlsServiceUrl: '${sysApi.baseUrl}/setting/permission/publicurls'
|
||
privateurlsServiceUrl: '${sysApi.baseUrl}/setting/permission/privateurls/{uid}'
|
||
getOpLogSwitchByLevleAndNameUrl: '${sysApi.baseUrl}/oplog/getOpLogSwitch/{level}/{name}'
|
||
eureka:
|
||
client:
|
||
service-url:
|
||
defaultZone: 'http://hz015.int.it2000.com.cn:94/eureka/'
|
||
instance:
|
||
prefer-ip-address: false
|
||
hostName: gatewayapi
|
||
logstash:
|
||
host: 'hz015.int.it2000.com.cn:5000'
|
||
elasticsearch:
|
||
ip: hz016.int.it2000.com.cn
|
||
port: 9300
|
||
pool: 5
|
||
password: changeme
|
||
username: elastic
|
||
cluster:
|
||
name: docker-cluster
|
||
nodes: 'hz016.int.it2000.com.cn:9300'
|
||
|
||
``` |