Skip to content

Commit

Permalink
chore: backport fixes and improvements from API Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Oct 26, 2023
1 parent ef8c7ad commit 59751af
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 59 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
**/.gitattributes
**/.gitignore
**/.gitmodules
**/compose.*.yaml
**/compose.*.yml
**/compose.yaml
**/compose.yml
**/docker-compose.*.yaml
**/docker-compose.*.yml
**/docker-compose.yaml
Expand Down
24 changes: 5 additions & 19 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,43 @@ trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,html,ts,tsx}]
indent_style = space
indent_size = 2

[*.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_style = space
indent_size = 4

[*.sh]
indent_style = tab
indent_size = 4

[*.xml{,.dist}]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[.github/workflows/*.yml]
indent_style = space
indent_size = 2

[.gitmodules]
indent_style = tab
indent_size = 4

[.php_cs{,.dist}]
indent_style = space
indent_size = 4

[.travis.yml]
indent_style = space
indent_size = 2

[composer.json]
indent_style = space
indent_size = 4

[docker-compose{,.*}.{yaml,yml}]
[{,docker-}compose{,.*}.{yaml,yml}]
indent_style = space
indent_size = 2

[Dockerfile]
[{,*.*}Dockerfile]
indent_style = tab

[{,*.*}Caddyfile]
indent_style = tab
indent_size = 4
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
-
name: Build Docker images
uses: docker/bake-action@v3
uses: docker/bake-action@v4
with:
pull: true
load: true
files: |
docker-compose.yml
docker-compose.override.yml
compose.yaml
compose.override.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ENV PATH="${PATH}:/root/.composer/vendor/bin"

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" ]

# Dev FrankenPHP image
Expand Down
1 change: 1 addition & 0 deletions docker-compose.override.yml → compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
extra_hosts:
# Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway
tty: true

###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###
File renamed without changes.
File renamed without changes.
52 changes: 20 additions & 32 deletions frankenphp/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@
frankenphp {
{$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}

log {
# Redact the authorization query parameter that can be set by Mercure
format filter {
wrap console
fields {
uri query {
replace authorization REDACTED
{$SERVER_NAME:localhost} {
log {
# Redact the authorization query parameter that can be set by Mercure
format filter {
wrap console
fields {
uri query {
replace authorization REDACTED
}
}
}
}
}

route {
root * /app/public
encode zstd gzip

mercure {
# Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
Expand All @@ -38,28 +43,11 @@ route {
# Extra directives
{$MERCURE_EXTRA_DIRECTIVES}
}
vulcain

# Add trailing slash for directory requests
@canonicalPath {
file {path}/index.php
not path */
}
redir @canonicalPath {path}/ 308

# If the requested file does not exist, try index files
@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
vulcain

encode zstd gzip
file_server
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-topics=()"

respond 404
php_server
}

0 comments on commit 59751af

Please sign in to comment.