Browse Source

Merge branch 'main' into feat/auto-scale-clock-time

# Conflicts:
#	thread-worker.go
#	watcher_test.go
Alliballibaba 1 month ago
parent
commit
9a83ab1cb0
10 changed files with 35 additions and 56 deletions
  1. 4 13
      .github/workflows/docker.yaml
  2. 3 12
      .github/workflows/static.yaml
  3. 3 1
      README.md
  4. 0 15
      alpine.Dockerfile
  5. 1 1
      caddy/caddy_test.go
  6. 5 5
      caddy/go.mod
  7. 8 8
      caddy/go.sum
  8. 9 0
      docs/classic.md
  9. 1 0
      docs/cn/README.md
  10. 1 1
      docs/config.md

+ 4 - 13
.github/workflows/docker.yaml

@@ -29,7 +29,7 @@ env:
   IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
 jobs:
   prepare:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     outputs:
       # Push if it's a scheduled job, a tag, or if we're committing to the main branch
       push: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')) && true || false }}
@@ -100,7 +100,7 @@ jobs:
           VERSION: ${{ (github.ref_type == 'tag' && github.ref_name) || steps.check.outputs.ref || 'dev' }}
           PHP_VERSION: ${{ steps.check.outputs.php_version }}
   build:
-    runs-on: ubuntu-latest
+    runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
     needs:
       - prepare
     if: ${{ !fromJson(needs.prepare.outputs.skip) }}
@@ -111,12 +111,8 @@ jobs:
         platform: ${{ fromJson(needs.prepare.outputs.platforms) }}
         include:
           - race: ""
-            qemu: true
           - platform: linux/amd64
-            qemu: false
             race: "-race" # The Go race detector is only supported on amd64
-          - platform: linux/386
-            qemu: false
         exclude:
           # arm/v6 is only available for Alpine: https://github.com/docker-library/golang/issues/502
           - variant: php-${{ needs.prepare.outputs.php82_version }}-bookworm
@@ -132,11 +128,6 @@ jobs:
       - uses: actions/checkout@v4
         with:
           ref: ${{ needs.prepare.outputs.ref }}
-      - name: Set up QEMU
-        if: matrix.qemu
-        uses: docker/setup-qemu-action@v3
-        with:
-          platforms: ${{ matrix.platform }}
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v3
         with:
@@ -202,7 +193,7 @@ jobs:
           if-no-files-found: error
           retention-days: 1
       - name: Run tests
-        if: ${{ !matrix.qemu && !fromJson(needs.prepare.outputs.push) }}
+        if: ${{ !fromJson(needs.prepare.outputs.push) }}
         run: |
           docker run --platform=${{ matrix.platform }} --rm \
             "$(jq -r '."builder-${{ matrix.variant }}"."containerimage.config.digest"' <<< "${METADATA}")" \
@@ -211,7 +202,7 @@ jobs:
           METADATA: ${{ steps.build.outputs.metadata }}
   # Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
   push:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     needs:
       - prepare
       - build

+ 3 - 12
.github/workflows/static.yaml

@@ -31,7 +31,7 @@ env:
   IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
 jobs:
   prepare:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     outputs:
       push: ${{ toJson((steps.check.outputs.ref || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')) && true || false) }}
       platforms: ${{ steps.matrix.outputs.platforms }}
@@ -74,17 +74,13 @@ jobs:
         debug: [false]
         mimalloc: [false]
         include:
-          - qemu: true
           - platform: linux/amd64
-            qemu: false
           - platform: linux/amd64
-            qemu: false
             debug: true
           - platform: linux/amd64
-            qemu: false
             mimalloc: true
     name: Build ${{ matrix.platform }} static binary${{ matrix.debug && ' (debug)' || '' }}${{ matrix.mimalloc && ' (mimalloc)' || '' }}
-    runs-on: ubuntu-latest
+    runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
     needs: [prepare]
     steps:
       - name: Prepare
@@ -95,11 +91,6 @@ jobs:
       - uses: actions/checkout@v4
         with:
           ref: ${{ needs.prepare.outputs.ref }}
-      - name: Set up QEMU
-        if: matrix.qemu
-        uses: docker/setup-qemu-action@v3
-        with:
-          platforms: ${{ matrix.platform }}
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v3
         with:
@@ -187,7 +178,7 @@ jobs:
 
   # Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
   push:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     needs:
       - prepare
       - build-linux

+ 3 - 1
README.md

@@ -60,7 +60,8 @@ frankenphp php-cli /path/to/your/script.php
 
 ## Docs
 
-* [The worker mode](https://frankenphp.dev/docs/worker/)
+* [Classic mode](https://frankenphp.dev/docs/classic/)
+* [Worker mode](https://frankenphp.dev/docs/worker/)
 * [Early Hints support (103 HTTP status code)](https://frankenphp.dev/docs/early-hints/)
 * [Real-time](https://frankenphp.dev/docs/mercure/)
 * [Configuration](https://frankenphp.dev/docs/config/)
@@ -86,3 +87,4 @@ frankenphp php-cli /path/to/your/script.php
 * [Drupal](https://github.com/dunglas/frankenphp-drupal)
 * [Joomla](https://github.com/alexandreelise/frankenphp-joomla)
 * [TYPO3](https://github.com/ochorocho/franken-typo3)
+* [Magento2](https://github.com/ekino/frankenphp-magento2)

+ 0 - 15
alpine.Dockerfile

@@ -82,21 +82,6 @@ RUN apk add --no-cache --virtual .build-deps \
 	sqlite-dev \
 	upx
 
-# FIXME: temporary workaround for https://github.com/golang/go/issues/68285
-WORKDIR /
-RUN git clone https://go.googlesource.com/go goroot
-WORKDIR /goroot
-# Revert https://github.com/golang/go/commit/3560cf0afb3c29300a6c88ccd98256949ca7a6f6 to prevent the crash with musl
-RUN git config --global user.email "build@example.com" && \
-	git config --global user.name "Build" && \
-	git checkout "$(go env GOVERSION)" && \
-	git revert 3560cf0afb3c29300a6c88ccd98256949ca7a6f6
-WORKDIR /goroot/src
-ENV GOHOSTARCH="$TARGETARCH"
-RUN ./make.bash
-ENV PATH="/goroot/bin:$PATH"
-RUN go version
-
 WORKDIR /go/src/app
 
 COPY --link go.mod go.sum ./

+ 1 - 1
caddy/caddy_test.go

@@ -608,7 +608,7 @@ func TestAllDefinedServerVars(t *testing.T) {
 			"Content-Type: application/x-www-form-urlencoded",
 			"Content-Length: 14", // maliciously set to 14
 			"Special-Chars: <%00>",
-			"Host: Malicous Host",
+			"Host: Malicious Host",
 			"X-Empty-Header:",
 		},
 		bytes.NewBufferString("foo=bar"),

+ 5 - 5
caddy/go.mod

@@ -10,9 +10,9 @@ require (
 	github.com/caddyserver/caddy/v2 v2.9.1
 	github.com/caddyserver/certmagic v0.21.6
 	github.com/dunglas/caddy-cbrotli v1.0.0
-	github.com/dunglas/frankenphp v1.3.6
-	github.com/dunglas/mercure/caddy v0.18.0
-	github.com/dunglas/vulcain/caddy v1.1.0
+	github.com/dunglas/frankenphp v1.4.1
+	github.com/dunglas/mercure/caddy v0.18.1
+	github.com/dunglas/vulcain/caddy v1.1.1
 	github.com/prometheus/client_golang v1.20.5
 	github.com/spf13/cobra v1.8.1
 	github.com/stretchr/testify v1.10.0
@@ -55,8 +55,8 @@ require (
 	github.com/dlclark/regexp2 v1.11.4 // indirect
 	github.com/dolthub/maphash v0.1.0 // indirect
 	github.com/dunglas/httpsfv v1.0.2 // indirect
-	github.com/dunglas/mercure v0.18.0 // indirect
-	github.com/dunglas/vulcain v1.1.0 // indirect
+	github.com/dunglas/mercure v0.18.1 // indirect
+	github.com/dunglas/vulcain v1.1.1 // indirect
 	github.com/dustin/go-humanize v1.0.1 // indirect
 	github.com/felixge/httpsnoop v1.0.4 // indirect
 	github.com/francoispqt/gojay v1.2.13 // indirect

+ 8 - 8
caddy/go.sum

@@ -163,14 +163,14 @@ github.com/dunglas/caddy-cbrotli v1.0.0 h1:+WNqXBkWyMcIpXB2rVZ3nwcElUbuAzf0kPxNX
 github.com/dunglas/caddy-cbrotli v1.0.0/go.mod h1:KZsUu3fnQBgO0o3YDoQuO3Z61dFgUncr1F8rg8acwQw=
 github.com/dunglas/httpsfv v1.0.2 h1:iERDp/YAfnojSDJ7PW3dj1AReJz4MrwbECSSE59JWL0=
 github.com/dunglas/httpsfv v1.0.2/go.mod h1:zID2mqw9mFsnt7YC3vYQ9/cjq30q41W+1AnDwH8TiMg=
-github.com/dunglas/mercure v0.18.0 h1:REdWvU3DMpnYW43s4S3mTSnujMWGjClG8umkVw8mcfU=
-github.com/dunglas/mercure v0.18.0/go.mod h1:Fgquo4PTXop+TtpkXiE4CyV2i5+FmD/dCKVJ6fsOBEc=
-github.com/dunglas/mercure/caddy v0.18.0 h1:Akns0zO2CUKQHkT5oiMdLHRKWaOZibON9iuH5aiBYds=
-github.com/dunglas/mercure/caddy v0.18.0/go.mod h1:rmgtvcWws2K8pdhbpCE3mcUTkGeaRq9rRteS5coB9g8=
-github.com/dunglas/vulcain v1.1.0 h1:HKA5hmubA8VYlmArHEo8IpCfFQRm627rHn8GaxkK3nI=
-github.com/dunglas/vulcain v1.1.0/go.mod h1:5YslB+KQI6SbghCDB3zrDyGtS2WCLvu+oFBkHi6mo+w=
-github.com/dunglas/vulcain/caddy v1.1.0 h1:O/65ccL4peT31+dmRzK73xl4RtqdZKPDIiXxWNoeA40=
-github.com/dunglas/vulcain/caddy v1.1.0/go.mod h1:hQOmuJPE29xGSd/ILcoT0tybK1CcATXUOdQOMGr/FEQ=
+github.com/dunglas/mercure v0.18.1 h1:cpY6p5IIonjdUl8RXuIfNP41mR6GBE4RNusKiJWM+FQ=
+github.com/dunglas/mercure v0.18.1/go.mod h1:Fgquo4PTXop+TtpkXiE4CyV2i5+FmD/dCKVJ6fsOBEc=
+github.com/dunglas/mercure/caddy v0.18.1 h1:hUXG1HjLBqnePVZDH9pu7DODOuUK2nK/7xPAK4/c03U=
+github.com/dunglas/mercure/caddy v0.18.1/go.mod h1:tydZIo08KxuTbUoW8AwwER/kLYXYjKlpfR9QuvdABWU=
+github.com/dunglas/vulcain v1.1.1 h1:nWh6sEhaeSla3IVXpzxQ8tK1nEr4lM1Q/HW8EVdpIgU=
+github.com/dunglas/vulcain v1.1.1/go.mod h1:5YslB+KQI6SbghCDB3zrDyGtS2WCLvu+oFBkHi6mo+w=
+github.com/dunglas/vulcain/caddy v1.1.1 h1:TT90lkiqnF1rGEyWXwZwhnuTRInNmYgJsFzR9ZH8pbQ=
+github.com/dunglas/vulcain/caddy v1.1.1/go.mod h1:6aXBrXh46qlJv9rIBlX5DlxzmRPJyVWpnFp8JMkpBNI=
 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
 github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=

+ 9 - 0
docs/classic.md

@@ -0,0 +1,9 @@
+# Using Classic Mode
+
+Without any additional configuration, FrankenPHP operates in classic mode. In this mode, FrankenPHP functions like a traditional PHP server, directly serving PHP files. This makes it a seamless drop-in replacement for PHP-FPM or Apache with mod_php.
+
+Similar to Caddy, FrankenPHP accepts an unlimited number of connections and uses a [fixed number of threads](config.md#caddyfile-config) to serve them. The number of accepted and queued connections is limited only by the available system resources. The PHP thread pool operates with a fixed number of threads initialized at startup, comparable to the static mode of PHP-FPM.
+
+Queued connections will wait indefinitely until a PHP thread is available to serve them. To prevent that, set a reasonable [write timeout in Caddy](https://caddyserver.com/docs/caddyfile/options#timeouts).
+
+Each Caddy instance will only spin up one FrankenPHP thread pool, which will be shared across all `php_server` blocks.

+ 1 - 0
docs/cn/README.md

@@ -75,3 +75,4 @@ docker run -v $PWD:/app/public \
 * [Drupal](https://github.com/dunglas/frankenphp-drupal)
 * [Joomla](https://github.com/alexandreelise/frankenphp-joomla)
 * [TYPO3](https://github.com/ochorocho/franken-typo3)
+* [Magento2](https://github.com/ekino/frankenphp-magento2)

+ 1 - 1
docs/config.md

@@ -19,7 +19,7 @@ FROM dunglas/frankenphp
 # Production:
 RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
 
-# Or developement:
+# Or development:
 RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
 ```
 

Some files were not shown because too many files changed in this diff