Caddy вылетает с ошибкой при настройке MercurePhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Caddy вылетает с ошибкой при настройке Mercure

Сообщение Anonymous »

Я пытаюсь использовать Mercure-Bundle в своем проекте Symfony(7.4).
Я пытался изменить Transport_url на Transport, но это тоже не помогло. Я также не понимаю, откуда берется путь /root/.local/share/caddy/mercure.db. Система каким-то образом автоматически это определяет? Пожалуйста, помогите TT
Мой Caddyfile
{
auto_https off
order cache before route

servers {
protocols h1 h2 h2c h3
}

cache {
api {
souin
}

key {
disable_body
disable_host
headers Content-Type X-User X-Tenant
}

regex {
exclude /(\.well-known|mng|api|bundles|swagger|mng/\?crudAction=transcribe).*
}

redis {
url {$REDIS_USER}:{$REDIS_PASS}@{$REDIS_HOST}:{$REDIS_PORT}
}

timeout {
backend 60s
cache 300ms
}

ttl 2000s
stale 4000s

mode bypass

storers redis
}
}

{$SERVER_NAME} {
log {
output stdout
format console
}

route {
cache

root * /srv/app/public

encode {
gzip 9
zstd

match {
header Content-Type text/*
header Content-Type application/ld+json*
header Content-Type application/javascript*
header Content-Type application/xhtml+xml*
header Content-Type application/atom+xml*
header Content-Type application/rss+xml*
header Content-Type image/svg+xml*
}
}

mercure {
# Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
# Publisher JWT key
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
# Subscriber JWT key
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
# Allow anonymous subscribers (double-check that it's what you want)
anonymous
# Enable the subscription API (double-check that it's what you want)
subscriptions
# Extra directives
{$MERCURE_EXTRA_DIRECTIVES}
}

@isPreflight {
method OPTIONS
}
@filesPreflight {
path /uploads/*
}
handle @filesPreflight {
header Access-Control-Allow-Origin {http.request.header.Origin}
header Access-Control-Allow-Methods "OPTIONS, GET"
header Access-Control-Allow-Credentials "true"
header Access-Control-Max-Age "3600"
header Access-Control-Allow-Headers "content-type, authorization, preload, fields, cache-control, pragma"
header Vary "Origin"

respond @isPreflight "" 200
}

php_fastcgi {$CORE_FASTCGI_ADDR} {
read_timeout 1200s
write_timeout 1200s
}
file_server
}

request_body {
max_size 4GB
}
}

docker-compose:
services:
php:
image: ${IMAGES_PREFIX:-}/php:${IMAGES_TAG}
healthcheck:
test: ["CMD", "php-fpm-healthcheck"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
- database
- redis
restart: unless-stopped
volumes:
- php_socket:/var/run/php
dns:
- 192.168.10.3
- 8.8.8.8
- 8.8.4.4
networks:
recmeet:
default:
environment:
MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
extra_hosts:
- host.docker.internal:host-gateway

caddy:
image: ${IMAGES_PREFIX:-}/caddy:${IMAGES_TAG}
depends_on:
php:
condition: service_healthy
redis:
condition: service_started
networks:
recmeet:
ipv4_address: 192.168.10.10
default:
environment:
SERVER_NAME: ${SERVER_NAME:-recmeet.local:80, *.recmeet.local:80, localhost:80}, caddy:80, varnish:80, core.service.consul:80
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
REDIS_ADDR_PORT: ${REDIS_ADDR_PORT:-redis:6379}
CORE_FASTCGI_ADDR: php:9000
restart: unless-stopped
ports:
- 2019:2019
- 80:80
volumes:
- php_socket:/var/run/php
- caddy_data:/data
- caddy_config:/config

Часть Dockerfile
RUN xcaddy build \
--output /usr/local/bin/caddy \
--with github.com/darkweak/storages/redis/caddy \
--with github.com/caddyserver/cache-handler \
--with github.com/dunglas/mercure/caddy \
--with github.com/darkweak/souin@v1.7.2

.env
###> symfony/mercure-bundle ###
MERCURE_URL=https://caddy/.well-known/mercure
MERCURE_PUBLIC_URL=https://localhost/.well-known/mercure
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###< symfony/mercure-bundle ###

Журналы:
caddy-1 | {"level":"info","ts":1769613126.4651031,"msg":"maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined"}
caddy-1 | {"level":"info","ts":1769613126.46551,"msg":"GOMEMLIMIT is updated","package":"github.com/KimMachineGun/automemlimit/memlimit","GOMEMLIMIT":18686225203,"previous":9223372036854775807}
caddy-1 | {"level":"info","ts":1769613126.4659293,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
caddy-1 | {"level":"error","ts":1769613126.4698067,"msg":"Setting the \"transport_url\" directive is not available anymore, use the \"transport\" directive instead"}
caddy-1 | {"level":"info","ts":1769613126.4732652,"msg":"adapted config to JSON","adapter":"caddyfile"}
caddy-1 | {"level":"warn","ts":1769613126.4734504,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
caddy-1 | {"level":"info","ts":1769613126.476302,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
caddy-1 | {"level":"info","ts":1769613126.476663,"logger":"http.auto_https","msg":"automatic HTTPS is completely disabled for server","server_name":"srv0"}
caddy-1 | {"level":"info","ts":1769613126.4767263,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000506b00"}
caddy-1 | {"level":"error","ts":1769613126.4777722,"logger":"http.handlers.cache","msg":"Error during Redis init, did you include the Redis storage (--with github.com/darkweak/storages/redis/caddy or github.com/darkweak/storages/go-redis/caddy)? provision storages.cache.redis: dial tcp: address :@:: too many colons in address"}
caddy-1 | {"level":"warn","ts":1769613126.4777842,"logger":"http.handlers.cache","msg":"You're running Souin with the default storage that is not optimized and for development purpose. We recommend to use at least one of the storages from https://github.com/darkweak/storages"}
caddy-1 | {"level":"info","ts":1769613126.477831,"logger":"http.handlers.cache","msg":"Set backend timeout to 1m0s"}
caddy-1 | {"level":"info","ts":1769613126.477834,"logger":"http.handlers.cache","msg":"Set cache timeout to 1m0s"}
caddy-1 | {"level":"info","ts":1769613126.4778366,"logger":"http.handlers.cache","msg":"Souin configuration is now loaded."}
caddy-1 | {"level":"info","ts":1769613126.4788327,"logger":"http","msg":"servers shutting down with eternal grace period"}
caddy-1 | {"level":"info","ts":1769613126.4789042,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc000506b00"}
caddy-1 | {"level":"info","ts":1769613126.4789426,"msg":"maxprocs: No GOMAXPROCS change to reset"}
caddy-1 | Error: loading initial config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 0: loading handler modules: position 1: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 0: loading handler modules: position 3: loading module 'mercure': provision http.handlers.mercure: provision http.handlers.mercure.bolt: "": invalid transport: open /root/.local/share/caddy/mercure.db: no such file or directory


Подробнее здесь: https://stackoverflow.com/questions/798 ... ng-mercure
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»