demo01/compose-demo01-jvm.yml

55 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.9'
name: demo01-jvm
services:
demo01-jvm:
image: svn.youshengyun.com:9923/demo01-jvm:1.0
container_name: demo01-jvm
hostname: demo01-jvm
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- y9-share-net
ports:
- "7056:7056"
environment:
server.port: 7056
server.servlet.context-path: '/demo01'
labels:
# 定义demo01-jvm路由entrypoints=web接受http请求
- "traefik.enable=true"
- "traefik.http.routers.demo01-jvm.entrypoints=web"
- "traefik.http.routers.demo01-jvm.rule=PathPrefix(`/demo01`)"
# 定义demo01服务
- "traefik.http.services.demo01.loadbalancer.passHostHeader=true"
- "traefik.http.services.demo01.loadbalancer.server.port=7056"
# 指定路由demo01-jvm的服务为demo01
- "traefik.http.routers.demo01-jvm.service=demo01"
# 默认轮询的方式进行负载session sticky放开下面的注释
#- "traefik.http.services.demo01.loadbalancer.sticky.cookie.name=demo01"
# 定义SSLentrypoints=web-ssl接受https请求路由和服务要重新定义一次
- "traefik.http.routers.demo01-jvm-ssl.tls=true"
- "traefik.http.routers.demo01-jvm-ssl.entrypoints=web-ssl"
- "traefik.http.routers.demo01-jvm-ssl.rule=Host(`www.dingzhaojun.top`) && PathPrefix(`/demo01`)"
- "traefik.http.routers.demo01-jvm-ssl.service=demo01"
# 定义URL重定向中间件switch-domain将http://localhost转换为https://www.dingzhaojun.top
- "traefik.http.middlewares.switch-domain.redirectregex.regex=^http://localhost(.*)"
- "traefik.http.middlewares.switch-domain.redirectregex.replacement=http://www.dingzhaojun.top$$1"
# 定义URL中的scheme、port重定向中间件to-https将http转换为https8081转换为7443但不转换IP地址部分
- "traefik.http.middlewares.to-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.to-https.redirectscheme.permanent=true"
- "traefik.http.middlewares.to-https.redirectscheme.port=7443"
# 设置路由demo01-jib使用的中间件
- "traefik.http.routers.demo01-jib.middlewares=switch-domain"
networks:
y9-share-net:
external: true