diff --git a/config/actuator-dev.yml b/config/actuator-dev.yml new file mode 100644 index 00000000..23c24f8a --- /dev/null +++ b/config/actuator-dev.yml @@ -0,0 +1,8 @@ +management: + endpoint: + health: + show-details: always + endpoints: + web: + exposure: + include: health,info,refresh \ No newline at end of file diff --git a/config/feign-dev.yml b/config/feign-dev.yml new file mode 100644 index 00000000..030c57a8 --- /dev/null +++ b/config/feign-dev.yml @@ -0,0 +1,18 @@ +feign: + hystrix: + enabled: true + client: + config: + default: + connectTimeout: 10000 + readTimeout: 10000 + +hystrix: + command: + default: + execution: + timeout: + enabled: true + isolation: + thread: + timeoutInMilliseconds: 12000 \ No newline at end of file diff --git a/config/jdbc-dev.yml b/config/jdbc-dev.yml new file mode 100644 index 00000000..d26d748c --- /dev/null +++ b/config/jdbc-dev.yml @@ -0,0 +1,11 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/sonic?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&autoReconnect=true&serverTimezone=GMT%2b8 + username: root + password: Sonic!@#123 + jpa: + open-in-view: true + hibernate: + ddl-auto: update + show-sql: true \ No newline at end of file diff --git a/config/knife4j-dev.yml b/config/knife4j-dev.yml new file mode 100644 index 00000000..75998326 --- /dev/null +++ b/config/knife4j-dev.yml @@ -0,0 +1,8 @@ +knife4j: + enable: true + setting: + enableHost: true + enableHostText: "http://localhost:8094" + enableFooter: false + enableFooterCustom: true + footerCustomContent: MIT License | Copyright 2021 - [ZhouYiXun/sonic-server](https://github.com/ZhouYixun/sonic-server/blob/main/LICENSE) \ No newline at end of file diff --git a/config/logging-dev.yml b/config/logging-dev.yml new file mode 100644 index 00000000..14818251 --- /dev/null +++ b/config/logging-dev.yml @@ -0,0 +1,7 @@ +logging: + file: + name: logs/${spring.application.name}.log + logback: + rollingpolicy: + clean-history-on-start: true + max-history: 3 \ No newline at end of file diff --git a/config/rabbitmq-dev.yml b/config/rabbitmq-dev.yml new file mode 100644 index 00000000..02f2a3b9 --- /dev/null +++ b/config/rabbitmq-dev.yml @@ -0,0 +1,7 @@ +spring: + rabbitmq: + host: localhost + port: 5672 + username: guest + password: guest + virtual-host: sonic \ No newline at end of file diff --git a/config/redis-dev.yml b/config/redis-dev.yml new file mode 100644 index 00000000..77af3c0e --- /dev/null +++ b/config/redis-dev.yml @@ -0,0 +1,5 @@ +spring: + redis: + database: 0 + host: 127.0.0.1 + port: 6379 \ No newline at end of file diff --git a/config/sonic-server-bus-dev.yml b/config/sonic-server-bus-dev.yml new file mode 100644 index 00000000..dec293d6 --- /dev/null +++ b/config/sonic-server-bus-dev.yml @@ -0,0 +1,11 @@ +server: + port: 0 + +management: + endpoint: + health: + show-details: always + endpoints: + web: + exposure: + include: health,info,bus-refresh \ No newline at end of file diff --git a/config/sonic-server-controller-dev.yml b/config/sonic-server-controller-dev.yml new file mode 100644 index 00000000..814b1d52 --- /dev/null +++ b/config/sonic-server-controller-dev.yml @@ -0,0 +1,16 @@ +server: + port: 0 + +spring: + data: + redis: + repositories: + enabled: false + +robot: + client: + host: "http://localhost:3000" + img: + success: "" + warning: "" + error: "" \ No newline at end of file diff --git a/config/sonic-server-folder-dev.yml b/config/sonic-server-folder-dev.yml new file mode 100644 index 00000000..a4f4843a --- /dev/null +++ b/config/sonic-server-folder-dev.yml @@ -0,0 +1,11 @@ +server: + port: 0 + +spring: + servlet: + multipart: + maxFileSize: -1 + maxRequestSize: -1 + +gateway: + host: "http://localhost:8094" \ No newline at end of file diff --git a/config/sonic-server-gateway-dev.yml b/config/sonic-server-gateway-dev.yml new file mode 100644 index 00000000..f06df4ae --- /dev/null +++ b/config/sonic-server-gateway-dev.yml @@ -0,0 +1,31 @@ +server: + port: 8094 + +filter: + white-list: /users/login,/users/register,/swagger-resources,/v2/api-docs,/folder/upload,/folder/recordFiles,/keepFiles/,/imageFiles/,/recordFiles/,/logFiles/ + resetToken: true + +spring: + cloud: + gateway: + routes: + - id: controller + uri: lb://sonic-server-controller + predicates: Path=/api/controller/** + filters: + - StripPrefix=2 + - id: folder + uri: lb://sonic-server-folder + predicates: Path=/api/folder/** + filters: + - StripPrefix=2 + - id: task + uri: lb://sonic-server-task + predicates: Path=/api/task/** + filters: + - StripPrefix=2 + - id: transport + uri: lb://sonic-server-transport + predicates: Path=/api/transport/** + filters: + - StripPrefix=2 \ No newline at end of file diff --git a/config/sonic-server-task-dev.yml b/config/sonic-server-task-dev.yml new file mode 100644 index 00000000..40714e9f --- /dev/null +++ b/config/sonic-server-task-dev.yml @@ -0,0 +1,27 @@ +server: + port: 0 + +spring: + datasource: + initialization-mode: always + quartz: + properties: + org: + quartz: + scheduler: + instanceName: SonicQuartz + instanceId: AUTO + jobStore: + isClustered: true + job-store-type: jdbc + jdbc: + initialize-schema: never + +sonic: + jobs: + fileCron: 0 0 12 * * ? + resultCron: 0 0 12 * * ? + dayReportCron: 0 0 10 * * ? + weekReportCron: 0 0 10 ? * Mon + filesKeepDay: 60 + resultsKeepDay: 60 diff --git a/config/sonic-server-transport-dev.yml b/config/sonic-server-transport-dev.yml new file mode 100644 index 00000000..4bc6e17f --- /dev/null +++ b/config/sonic-server-transport-dev.yml @@ -0,0 +1,16 @@ +server: + port: 0 + +spring: + rabbitmq: + listener: + simple: + acknowledge-mode: manual + retry: + enabled: true + max-attempts: 5 + max-interval: 10000 + initial-interval: 10000 + default-requeue-rejected: true + publisher-confirm-type: correlated + publisher-returns: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 68e9d620..7dd533a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,51 +1,28 @@ version: '3' -#you can add this for log debugging for every container. -#volumes: -# - /home/sonic/logs/:/logs/ services: sonic-server-eureka: image: "zhouyixun/sonic-server-eureka:v1.0.0" hostname: sonic-server-eureka environment: - EUREKA_HOST=sonic-server-eureka + volumes: + - ./logs/:/logs/ networks: - sonic-network ports: - "9090:9090" - deploy: - replicas: 1 - placement: - constraints: - - node.role == manager - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-bus: - image: "zhouyixun/sonic-server-bus:v1.0.0" + image: "zhouyixun/sonic-server-bus:v1.0.1" environment: - PROFILE=prod - - CONFIG_TYPE=git - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network + volumes: + - ./config:/config + - ./logs/:/logs/ depends_on: - sonic-server-eureka - deploy: - replicas: 1 - placement: - constraints: - - node.role == manager - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-gateway: image: "zhouyixun/sonic-server-gateway:v1.0.0" environment: @@ -53,23 +30,13 @@ services: - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network + volumes: + - ./logs/:/logs/ depends_on: - sonic-server-bus - sonic-server-eureka ports: - "8094:8094" - deploy: - replicas: 1 - placement: - constraints: - - node.role == manager - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-controller: image: "zhouyixun/sonic-server-controller:v1.0.0" environment: @@ -77,22 +44,12 @@ services: - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network + volumes: + - ./logs/:/logs/ depends_on: - sonic-server-bus - sonic-server-eureka - sonic-server-gateway - deploy: - replicas: 2 - placement: - constraints: - - node.role == worker - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-folder: image: "zhouyixun/sonic-server-folder:v1.0.0" environment: @@ -100,26 +57,15 @@ services: - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network - # volumes: - # - /home/sonic/keepFiles/:/keepFiles/ - # - /home/sonic/imageFiles/:/imageFiles/ - # - /home/sonic/recordFiles/:/recordFiles/ + volumes: + - ./keepFiles/:/keepFiles/ + - ./imageFiles/:/imageFiles/ + - ./recordFiles/:/recordFiles/ + - ./logs/:/logs/ depends_on: - sonic-server-bus - sonic-server-eureka - sonic-server-gateway - deploy: - replicas: 1 - placement: - constraints: - - node.role == manager - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-task: image: "zhouyixun/sonic-server-task:v1.0.0" environment: @@ -127,22 +73,12 @@ services: - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network + volumes: + - ./logs/:/logs/ depends_on: - sonic-server-bus - sonic-server-eureka - sonic-server-gateway - deploy: - replicas: 1 - placement: - constraints: - - node.role == worker - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 sonic-server-transport: image: "zhouyixun/sonic-server-transport:v1.0.0" environment: @@ -150,23 +86,13 @@ services: - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ networks: - sonic-network + volumes: + - ./logs/:/logs/ depends_on: - sonic-server-bus - sonic-server-eureka - sonic-server-gateway - deploy: - replicas: 1 - placement: - constraints: - - node.role == worker - update_config: - parallelism: 1 - delay: 2s - restart_policy: - condition: on-failure - delay: 20s - max_attempts: 6 networks: sonic-network: - driver: overlay \ No newline at end of file + driver: bridge \ No newline at end of file diff --git a/sonic-server-bus/src/main/resources/bootstrap.yml b/sonic-server-bus/src/main/resources/bootstrap.yml index 660b48aa..eeb01007 100644 --- a/sonic-server-bus/src/main/resources/bootstrap.yml +++ b/sonic-server-bus/src/main/resources/bootstrap.yml @@ -11,13 +11,13 @@ spring: server: composite: - type: ${CONFIG_TYPE:native} - uri: ${GIT_URL:git@github.com:ZhouYixun/sonic-server-config-yml.git} - ignore-local-ssh-settings: true - search-paths: /config - private-key: | - -----BEGIN RSA PRIVATE KEY----- - ${GIT_KEY:xxx} - -----END RSA PRIVATE KEY----- +# uri: ${GIT_URL:git@github.com:ZhouYixun/sonic-server-config-yml.git} +# ignore-local-ssh-settings: true +# search-paths: /config +# private-key: | +# -----BEGIN RSA PRIVATE KEY----- +# ${GIT_KEY:xxx} +# -----END RSA PRIVATE KEY----- bootstrap: true eureka: diff --git a/swarm.yml b/swarm.yml new file mode 100644 index 00000000..c4a9c07b --- /dev/null +++ b/swarm.yml @@ -0,0 +1,182 @@ +version: '3' +services: + sonic-server-eureka: + image: "zhouyixun/sonic-server-eureka:v1.0.0" + hostname: sonic-server-eureka + environment: + - EUREKA_HOST=sonic-server-eureka + networks: + - sonic-network + volumes: + - ./logs/:/logs/ + ports: + - "9090:9090" + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-bus: + image: "zhouyixun/sonic-server-bus:v1.0.1" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./config:/config + - ./logs/:/logs/ + depends_on: + - sonic-server-eureka + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-gateway: + image: "zhouyixun/sonic-server-gateway:v1.0.0" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./logs/:/logs/ + depends_on: + - sonic-server-bus + - sonic-server-eureka + ports: + - "8094:8094" + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-controller: + image: "zhouyixun/sonic-server-controller:v1.0.0" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./logs/:/logs/ + depends_on: + - sonic-server-bus + - sonic-server-eureka + - sonic-server-gateway + deploy: + replicas: 2 + placement: + constraints: + - node.role == worker + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-folder: + image: "zhouyixun/sonic-server-folder:v1.0.0" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./keepFiles/:/keepFiles/ + - ./imageFiles/:/imageFiles/ + - ./recordFiles/:/recordFiles/ + - ./logs/:/logs/ + depends_on: + - sonic-server-bus + - sonic-server-eureka + - sonic-server-gateway + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-task: + image: "zhouyixun/sonic-server-task:v1.0.0" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./logs/:/logs/ + depends_on: + - sonic-server-bus + - sonic-server-eureka + - sonic-server-gateway + deploy: + replicas: 1 + placement: + constraints: + - node.role == worker + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + sonic-server-transport: + image: "zhouyixun/sonic-server-transport:v1.0.0" + environment: + - PROFILE=prod + - EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/ + networks: + - sonic-network + volumes: + - ./logs/:/logs/ + depends_on: + - sonic-server-bus + - sonic-server-eureka + - sonic-server-gateway + deploy: + replicas: 1 + placement: + constraints: + - node.role == worker + update_config: + parallelism: 1 + delay: 2s + restart_policy: + condition: on-failure + delay: 20s + max_attempts: 6 + +networks: + sonic-network: + driver: overlay \ No newline at end of file