version: "3"
services:
halo:
build: .
restart: on-failure:3
networks:
- halo_network
volumes:
- ./halo2:/root/.halo2
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
ports:
- "8090:8090"
command:
- --spring.r2dbc.url=r2dbc:pool:mysql://127.0.0.1:3306/halo2
- --spring.r2dbc.username=root
- --spring.r2dbc.password=123456789
- --spring.sql.init.platform=mysql
- --halo.external-url=https://xxx.xxxxx.xxx
- --server.port=8090
- --halo.cache.page.disabled=false
environment:
- TZ=Asia/Shanghai
- SPRING_PROFILES_ACTIVE=my,mysql
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./certificate:/certificate
depends_on:
- halo
networks:
- halo_network
networks:
halo_network:
driver: bridge
如上配置,总共2个服务,一个halo,一个是nginx,还有个mysql是跑在了宿主机的3306端口,
目前不知道halo怎么才能访问宿主机的3306 ,我写127.0.0.1或者云服务器的内网ip都是无法访问的
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /127.0.0.1:3306
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused