我希望通过使用 FrankenPHP 来升级我们当前的 Laravel 应用程序,以提升其性能。但是当我尝试部署到我们的临时环境时遇到问题,因此我尝试尽可能地克隆该设置。
我们的部署设置使用 nomad 和 traefik,因此我尝试在本地设置 traefik 以更好地了解该问题。
每当我加载应用程序时,我都会收到 500 错误,但我在任何日志中都没有收到任何错误,所以我在让它正常工作方面是盲目的。
如果我将其作为 http 设置运行,则没有问题。
这是我用于所有事情的设置。
作曲家.yml
networks:
web:
external: true
services:
traefik:
image: traefik:v2.4
container_name: traefik
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
networks:
- web
ports:
- 80:80
- 8080:8080
- 443:443
volumes:
- ./docker/traefik/static.yml:/etc/traefik/traefik.yml:ro
- ./docker/traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
- ./ssl:/var/traefik2/tls:ro
- /var/run/docker.sock:/var/run/docker.sock
api:
build:
target: api-debug
container_name: api
image: api
environment:
- "SERVER_NAME=:80"
env_file:
- ./.env.docker-compose
volumes:
- ./app:/opt/api/app
- ./bootstrap:/opt/api/bootstrap
- ./public:/opt/api/public
- ./routes:/opt/api/routes
- ./storage:/opt/api/storage
- ./resources:/opt/api/resources
- ./.env.docker-compose:/opt/api/.env
links:
- database
- cache
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.myproject.rule=Host(`myproject.localhost`)"
- "traefik.docker.network=web"
- "traefik.http.services.myproject.loadbalancer.passhostheader=true"
- "traefik.http.services.myproject.loadbalancer.server.scheme=https"
- "traefik.http.routers.myproject.tls=true"
- "traefik.http.routers.myproject.priority=100"
cache:
container_name: cache
image: memcached:alpine
networks:
- web
ports:
- "11211:11211"
database:
image: mysql:8.4
container_name: database
platform: linux/x86_64
environment:
- MYSQL_DATABASE=app
- MYSQL_ROOT_PASSWORD=secret
ports:
- 13306:3306
networks:
- web
healthcheck:
test: "/usr/bin/mysql --user=root --password=secret --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
static.yml:
global:
sendAnonymousUsage: false
api:
dashboard: true
insecure: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
watch: true
exposedByDefault: false
file:
filename: /etc/traefik/dynamic.yml
watch: true
log:
level: INFO
format: common
http:
serversTransports:
mytransport:
certificates:
- certFile: /var/traefik2/tls/local-cert.pem
keyFile: /var/traefik2/tls/local-key.pem
insecureSkipVerify: true
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
动态.yml
http:
routers:
traefik:
rule: "Host(`traefik.localhost`)"
service: "api@internal"
tls:
domains:
- main: "myproject.localhost"
sans:
- "*.myproject.localhost"
tls:
certificates:
- certFile: "/var/traefik2/tls/local-cert.pem"
keyFile: "/var/traefik2/tls/local-key.pem"