chore: backport fixes and improvements from API Platform

This commit is contained in:
Kévin Dunglas 2023-10-26 14:49:28 +02:00
parent ef8c7ad2a2
commit 6eee59b50d
9 changed files with 37 additions and 59 deletions

View File

@ -11,6 +11,10 @@
**/.gitattributes **/.gitattributes
**/.gitignore **/.gitignore
**/.gitmodules **/.gitmodules
**/compose.*.yaml
**/compose.*.yml
**/compose.yaml
**/compose.yml
**/docker-compose.*.yaml **/docker-compose.*.yaml
**/docker-compose.*.yml **/docker-compose.*.yml
**/docker-compose.yaml **/docker-compose.yaml

View File

@ -16,57 +16,43 @@ trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.{js,html,ts,tsx}] [*.{js,html,ts,tsx}]
indent_style = space
indent_size = 2 indent_size = 2
[*.json] [*.json]
indent_style = space
indent_size = 2 indent_size = 2
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.php]
indent_style = space
indent_size = 4
[*.sh] [*.sh]
indent_style = tab indent_style = tab
indent_size = 4
[*.xml{,.dist}] [*.xml{,.dist}]
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
[*.{yaml,yml}] [*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false trim_trailing_whitespace = false
[.github/workflows/*.yml] [.github/workflows/*.yml]
indent_style = space
indent_size = 2 indent_size = 2
[.gitmodules] [.gitmodules]
indent_style = tab indent_style = tab
indent_size = 4
[.php_cs{,.dist}] [.php_cs{,.dist}]
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
[.travis.yml]
indent_style = space
indent_size = 2
[composer.json] [composer.json]
indent_style = space
indent_size = 4 indent_size = 4
[docker-compose{,.*}.{yaml,yml}] [{,docker-}compose{,.*}.{yaml,yml}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[Dockerfile] [{,*.*}Dockerfile]
indent_style = tab
[{,*.*}Caddyfile]
indent_style = tab indent_style = tab
indent_size = 4

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
github: [dunglas]

View File

@ -18,19 +18,19 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- -
name: Build Docker images name: Build Docker images
uses: docker/bake-action@v3 uses: docker/bake-action@v4
with: with:
pull: true pull: true
load: true load: true
files: | files: |
docker-compose.yml compose.yaml
docker-compose.override.yml compose.override.yaml
set: | set: |
*.cache-from=type=gha,scope=${{github.ref}} *.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main *.cache-from=type=gha,scope=refs/heads/main
@ -66,7 +66,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Lint Dockerfile name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0 uses: hadolint/hadolint-action@v3.1.0

View File

@ -47,7 +47,7 @@ ENV PATH="${PATH}:/root/.composer/vendor/bin"
COPY --from=composer_upstream --link /composer /usr/bin/composer COPY --from=composer_upstream --link /composer /usr/bin/composer
HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://localhost:2019/metrics || exit 1 HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
# Dev FrankenPHP image # Dev FrankenPHP image

View File

@ -20,6 +20,7 @@ services:
extra_hosts: extra_hosts:
# Ensure that host.docker.internal is correctly defined on Linux # Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway - host.docker.internal:host-gateway
tty: true
###> symfony/mercure-bundle ### ###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ### ###< symfony/mercure-bundle ###

View File

@ -4,26 +4,31 @@
frankenphp { frankenphp {
{$FRANKENPHP_CONFIG} {$FRANKENPHP_CONFIG}
} }
}
{$SERVER_NAME:localhost} # https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
order mercure after encode
order vulcain after reverse_proxy
order php_server before file_server
}
{$CADDY_EXTRA_CONFIG} {$CADDY_EXTRA_CONFIG}
log { {$SERVER_NAME:localhost} {
# Redact the authorization query parameter that can be set by Mercure log {
format filter { # Redact the authorization query parameter that can be set by Mercure
wrap console format filter {
fields { wrap console
uri query { fields {
replace authorization REDACTED uri query {
replace authorization REDACTED
}
} }
} }
} }
}
route {
root * /app/public root * /app/public
encode zstd gzip
mercure { mercure {
# Transport to use (default to Bolt) # Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
@ -38,28 +43,11 @@ route {
# Extra directives # Extra directives
{$MERCURE_EXTRA_DIRECTIVES} {$MERCURE_EXTRA_DIRECTIVES}
} }
vulcain vulcain
# Add trailing slash for directory requests # Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
@canonicalPath { header ?Permissions-Policy "browsing-topics=()"
file {path}/index.php
not path */
}
redir @canonicalPath {path}/ 308
# If the requested file does not exist, try index files php_server
@indexFiles file {
try_files {path} {path}/index.php index.php
split_path .php
}
rewrite @indexFiles {http.matchers.file.relative}
# FrankenPHP!
@phpFiles path *.php
php @phpFiles
encode zstd gzip
file_server
respond 404
} }