我想将 traefik 用于 Espocrm docker-compose.yml 文件,我尝试了一些方法,但没有成功,有人可以帮我解决这种情况。我使用 traefik 是因为易于配置和使用 ssl,但我认为 Espocrm docker-compose.yml 文件出了点问题。
我将在下面添加我的 docker-compose.yml 文件。
version: '3.8'
services:
mysql:
image: mysql:8
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: espocrm
MYSQL_USER: espocrm
MYSQL_PASSWORD: database_password
command: --default-authentication-plugin=mysql_native_password
networks:
- espocrm
volumes:
- /storage/espocrm/mysql:/var/lib/mysql
labels:
- "traefik.enable=false"
espocrm:
image: espocrm/espocrm
container_name: espocrm
environment:
ESPOCRM_DATABASE_HOST: mysql
ESPOCRM_DATABASE_USER: espocrm
ESPOCRM_DATABASE_PASSWORD: database_password
ESPOCRM_ADMIN_USERNAME: admin
ESPOCRM_ADMIN_PASSWORD: password
ESPOCRM_SITE_URL: "https://espocrm.mydomain.com"
networks:
- espocrm
- proxy
volumes:
- /storage/espocrm:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.http.routers.espocrm.rule=Host(`espocrm.mydomain.com`)"
- "traefik.http.services.espocrm.loadbalancer.server.port=8080"
- "traefik.http.routers.espocrm.entrypoints=websecure"
- "traefik.http.routers.espocrm.tls=true"
- "traefik.http.routers.espocrm.tls.certresolver=cloudflare"
- "traefik.http.routers.espocrm.tls.domains[0].main=espocrm.mydomain.com"
restart: always
expose:
- 8080
espocrm-daemon:
image: espocrm/espocrm
container_name: espocrm-daemon
networks:
- espocrm
volumes:
- /storage/espocrm:/var/www/html
restart: always
entrypoint: docker-daemon.sh
espocrm-websocket:
image: espocrm/espocrm
container_name: espocrm-websocket
environment:
ESPOCRM_CONFIG_USE_WEB_SOCKET: "true"
ESPOCRM_CONFIG_WEB_SOCKET_URL: "ws://espocrm.mydomain.com"
ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN: "tcp://*:7777"
ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN: "tcp://espocrm-websocket:7777"
volumes:
- /storage/espocrm:/var/www/html
networks:
- espocrm
restart: always
entrypoint: docker-websocket.sh
expose:
- 8081
- 7777
networks:
espocrm:
driver: bridge
proxy:
external:
name: "traefik_proxy"
volumes:
mysql:
espocrm: