Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

  • Explore repository structure and understand current PHP-FPM/Nginx setup
  • Add configuration variable for selecting PHP-FPM vs Laravel Octane
  • Update Dockerfile to support all Octane drivers (Swoole, RoadRunner, FrankenPHP)
  • Create supervisor configurations for each Octane driver
  • Create nginx configuration for reverse proxying to Octane
  • Update entrypoint.sh to select appropriate configs based on runtime mode
  • Add Terraform variable and pass through to ECS task definition
  • Update documentation (README.md, example.tfvars, docker/README.md)
  • Support multiple Octane drivers per user feedback
  • Test configuration changes (syntax validation)
  • Fix documentation inconsistencies in variable descriptions
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for Laravel Octane while retaining PHP-FPM/Nginx setup</issue_title>
<issue_description>It would be great to add support for Laravel Octane to this module. Please ensure that we do not remove the existing PHP-FPM or Nginx setup. Instead, allow users to control whether to use PHP-FPM or Laravel Octane via configuration. I believe we can still serve Laravel Octane via Nginx as a reverse proxy, but I am not an expert in this area.

Acceptance Criteria

  • Add configuration option to select between PHP-FPM and Laravel Octane
  • Retain full support for the current PHP-FPM and Nginx setup
  • Confirm that Laravel Octane can be served via Nginx as a reverse proxy
  • Provide documentation/examples for switching between PHP-FPM and Octane

Additional Notes

  • Avoid breaking changes to existing workflows
  • Gather community feedback if approach is unclear</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #10


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Summary by CodeRabbit

  • New Features

    • Added support for Laravel Octane with multiple drivers (Swoole, RoadRunner, FrankenPHP) as an alternative to PHP-FPM for improved performance.
    • Introduced configurable application server mode via APP_SERVER_MODE environment variable.
  • Documentation

    • Added comprehensive configuration guides for switching between PHP-FPM and Octane.
    • Included local testing procedures and prerequisites for Octane deployment.

Copilot AI and others added 2 commits October 24, 2025 03:14
Co-authored-by: leek <60204+leek@users.noreply.github.com>
Co-authored-by: leek <60204+leek@users.noreply.github.com>
@leek leek added the enhancement New feature or request label Oct 24, 2025
Co-authored-by: leek <60204+leek@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Laravel Octane with PHP-FPM and Nginx Add support for Laravel Octane while retaining PHP-FPM/Nginx setup Oct 24, 2025
Copilot AI requested a review from leek October 24, 2025 03:24
Copilot finished work on behalf of leek October 24, 2025 03:24
@leek
Copy link
Owner

leek commented Oct 24, 2025

@copilot swoole is coole but id prefer frankenphp. if we can make it so users can switch between swoole, franken or roadrunner that's perfect

Co-authored-by: leek <60204+leek@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 24, 2025

@copilot swoole is coole but id prefer frankenphp. if we can make it so users can switch between swoole, franken or roadrunner that's perfect

Done! I've expanded the support to allow users to choose between three Octane drivers:

  • octane-swoole: Battle-tested with excellent performance (Swoole PHP extension)
  • octane-roadrunner: Go-based server, great for long-running tasks (RoadRunner binary)
  • octane-frankenphp: Modern PHP app server built on Caddy with Early Hints support (FrankenPHP binary)

All three drivers are now included in the Docker image and can be selected via the app_server_mode configuration variable. The default remains php-fpm for backward compatibility.

Changes in commit a4ab8a8

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: terraform version (dns block)
    • Triggering command: terraform fmt -recursive (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add support for Laravel Octane while retaining PHP-FPM/Nginx setup Add support for Laravel Octane with multiple drivers while retaining PHP-FPM/Nginx setup Oct 24, 2025
Copilot finished work on behalf of leek October 24, 2025 03:58
@leek leek requested a review from Copilot October 24, 2025 04:15
@leek
Copy link
Owner

leek commented Oct 24, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Laravel Octane as an alternative application server mode, allowing users to choose between traditional PHP-FPM or Laravel Octane with three driver options (Swoole, RoadRunner, FrankenPHP) while maintaining full backward compatibility with existing PHP-FPM deployments.

Key Changes:

  • Added app_server_mode Terraform variable with validation for four modes: php-fpm (default), octane-swoole, octane-roadrunner, and octane-frankenphp
  • Extended Docker image to include Swoole PHP extension and RoadRunner/FrankenPHP binaries for Octane support
  • Implemented dynamic runtime configuration selection in entrypoint.sh based on APP_SERVER_MODE environment variable, with separate supervisor configs and Nginx reverse proxy setup for each Octane driver

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
terraform/variables.tf Adds app_server_mode variable with validation for php-fpm and three octane driver options
terraform/modules/compute/variables.tf Declares app_server_mode variable in compute module
terraform/modules/compute/main.tf Passes APP_SERVER_MODE environment variable to ECS containers
terraform/main.tf Forwards app_server_mode variable to compute module
terraform/environments/example.tfvars Documents app_server_mode configuration with driver descriptions and compatibility notes
docker/supervisord-web-octane-swoole.conf Supervisor configuration for Octane with Swoole driver
docker/supervisord-web-octane-roadrunner.conf Supervisor configuration for Octane with RoadRunner driver
docker/supervisord-web-octane-frankenphp.conf Supervisor configuration for Octane with FrankenPHP driver
docker/nginx/custom.d/laravel-octane.conf Nginx reverse proxy configuration for all Octane modes
docker/entrypoint.sh Implements runtime selection logic to choose appropriate supervisor and nginx configs based on server mode
docker/README.md Documents application server modes and local testing commands for all four configurations
docker/Dockerfile Installs Swoole extension and downloads RoadRunner/FrankenPHP binaries; copies all supervisor configs
README.md Adds comprehensive documentation for application server modes, driver comparison, switching guide, and testing instructions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

variable "app_server_mode" {
description = "Application server mode: 'php-fpm' or 'octane'"
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description is incomplete and inconsistent with the validation in the root variables.tf file. It should mention all four valid values: 'php-fpm', 'octane-swoole', 'octane-roadrunner', and 'octane-frankenphp'.

Suggested change
description = "Application server mode: 'php-fpm' or 'octane'"
description = "Application server mode. Valid values: 'php-fpm', 'octane-swoole', 'octane-roadrunner', and 'octane-frankenphp'."

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 3ac0a75. Updated the description to list all four valid values: 'php-fpm', 'octane-swoole', 'octane-roadrunner', and 'octane-frankenphp'.

README.md Outdated
db_reporting_password = "..."
# Application server mode
app_server_mode = "php-fpm" # or "octane" for better performance
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment suggests 'octane' as a valid value, but according to the variable validation, the valid Octane values are 'octane-swoole', 'octane-roadrunner', or 'octane-frankenphp'. This comment should specify one of the actual valid Octane driver values.

Suggested change
app_server_mode = "php-fpm" # or "octane" for better performance
app_server_mode = "php-fpm" # or "octane-swoole", "octane-roadrunner", or "octane-frankenphp" for better performance

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 3ac0a75. Updated the comment to specify the actual valid Octane driver values instead of the generic 'octane'.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This PR introduces Laravel Octane support with Swoole, RoadRunner, and FrankenPHP drivers alongside the existing PHP-FPM/Nginx setup. A new app_server_mode configuration parameter allows users to switch between php-fpm and various octane modes. Docker entrypoint logic conditionally applies supervisor configurations and nginx proxy settings based on the selected mode, while Terraform variables propagate this setting through infrastructure-as-code layers.

Changes

Cohort / File(s) Change Summary
Documentation Updates
README.md, docker/README.md
Added comprehensive guides for Application Server Mode configuration, switching workflows between PHP-FPM and Octane, prerequisites and compatibility guidance, minimal and production configuration examples with app_server_mode values, and Docker deployment instructions with environment variable examples.
Docker Build & Entrypoint
docker/Dockerfile, docker/entrypoint.sh
Extended Dockerfile to install redis and swoole PECL extensions, download RoadRunner and FrankenPHP binaries in builder stage, copy Octane assets to final image, and disable laravel-octane nginx config by default. Updated entrypoint.sh to branch startup logic based on APP_SERVER_MODE environment variable, enabling corresponding supervisor configuration and nginx proxy swap for each octane driver or reverting to standard PHP-FPM setup.
Docker Process Management
docker/supervisord-web-octane-swoole.conf, docker/supervisord-web-octane-roadrunner.conf, docker/supervisord-web-octane-frankenphp.conf
Added three new supervisord configuration files, each defining nginx and octane process supervision for a respective driver (Swoole, RoadRunner, FrankenPHP) with stdout/stderr logging, autorestart, and worker configuration.
Docker Nginx Proxy Configuration
docker/nginx/custom.d/laravel-octane.conf
Added new nginx server block to proxy requests to Laravel Octane on 127.0.0.1:8000, including ALB real IP handling, header forwarding (Host, X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Port, Upgrade, Connection), and 60-second proxy timeouts.
Terraform Variables & Root Configuration
terraform/variables.tf, terraform/environments/example.tfvars
Added new app_server_mode Terraform variable with type string, default "php-fpm", and validation restricting values to ["php-fpm", "octane-swoole", "octane-frankenphp", "octane-roadrunner"] with error messaging. Added example value in tfvars file with comments describing supported modes and requirements.
Terraform Module Wiring
terraform/main.tf, terraform/modules/compute/variables.tf, terraform/modules/compute/main.tf
Wired app_server_mode variable from root module through to compute module (added as input parameter in main.tf module invocation and new variable declaration in modules/compute/variables.tf), then injected into ECS task environment as APP_SERVER_MODE environment variable in common_environment_variables list.

Sequence Diagram

sequenceDiagram
    participant User
    participant Terraform as Terraform<br/>(Root Module)
    participant ComputeModule as Compute<br/>Module
    participant Docker as Docker<br/>Container
    participant Entrypoint as entrypoint.sh
    participant Supervisor as supervisord
    participant Octane as Laravel Octane<br/>(octane-mode)
    participant Nginx as Nginx<br/>Proxy

    User->>Terraform: Set app_server_mode<br/>in .tfvars
    Terraform->>ComputeModule: Pass app_server_mode<br/>as input
    ComputeModule->>ComputeModule: Set APP_SERVER_MODE<br/>environment variable
    ComputeModule->>Docker: Create ECS task<br/>with environment
    Docker->>Entrypoint: Container starts
    Entrypoint->>Entrypoint: Read APP_SERVER_MODE
    
    alt octane-swoole/roadrunner/frankenphp
        Entrypoint->>Supervisor: Load supervisord-web-octane-{mode}.conf
        Supervisor->>Octane: Start Laravel Octane<br/>on 127.0.0.1:8000
        Supervisor->>Nginx: Start Nginx in proxy mode
        Nginx->>Nginx: Enable laravel-octane.conf
        Octane->>Nginx: ✓ Ready
    else php-fpm (default)
        Entrypoint->>Supervisor: Load supervisord-web.conf
        Supervisor->>Nginx: Start Nginx with PHP-FPM
        Nginx->>Nginx: Enable laravel.conf
    end
    
    User->>Nginx: HTTP Request
    Nginx->>Octane: Proxy request
    Octane-->>Nginx: Response
    Nginx-->>User: Response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR spans multiple file types with mixed complexity: documentation is straightforward, Terraform variable additions follow consistent patterns, supervisord configurations are repetitive, but Docker entrypoint logic introduces conditional branching requiring careful verification that mode selection correctly swaps configurations and nginx proxying.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The pull request description does not follow the required template structure. While the author has provided a task checklist of completed work items and included a reference to the related issue (Fixes #10), the description lacks most of the required template sections. Specifically, the main "Description" section is empty, the "Type of Change" checkboxes are not selected (though this is a significant feature addition spanning multiple components), the "Testing" section is not completed with proper details about testing performed, and the "Checklist" section for code quality and documentation verification is largely unchecked. Although the PR introduces comprehensive changes across Docker, Terraform, and documentation files (as evidenced by the raw summary showing Medium to High review effort), the description provided is essentially a task list rather than the structured format required by the template. The author should update the PR description to follow the template structure by: (1) adding a concise "Description" section summarizing what this PR accomplishes, (2) selecting the appropriate "Type of Change" checkbox (likely "✨ New feature" and possibly "📚 Documentation update"), (3) completing the "Testing" section with details about what was tested and which tests passed, (4) filling out the "Checklist" section by checking off applicable items related to code style, documentation updates, and testing, and (5) optionally adding an "Additional Notes" section if there is important context for reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Add support for Laravel Octane with multiple drivers while retaining PHP-FPM/Nginx setup" clearly and accurately reflects the main changes in the changeset. It specifically identifies what is being added (Laravel Octane with multiple drivers) and emphasizes what is being preserved (PHP-FPM/Nginx setup), which aligns with the primary objective of the PR. The title is concise, specific enough that a teammate scanning commit history would understand the change, and avoids vague or generic phrasing.
Linked Issues Check ✅ Passed The pull request satisfies all acceptance criteria from linked issue #10. A configuration option for selecting between PHP-FPM and Laravel Octane has been implemented through the app_server_mode Terraform variable with validation for all four modes (php-fpm, octane-swoole, octane-roadrunner, octane-frankenphp). Full support for the existing PHP-FPM and Nginx setup is retained with PHP-FPM as the default, requiring no changes to existing deployments. Laravel Octane is configured to be served via Nginx reverse proxy through the new laravel-octane.conf configuration that proxies requests to port 8000 and forwards ALB headers. Comprehensive documentation has been added including README sections on "Application Server Mode" and "Switching Between PHP-FPM and Octane," updated example configurations, and Docker testing instructions.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly related to the objective of adding Laravel Octane support while retaining PHP-FPM. The modifications span across documentation (README files), Docker infrastructure (Dockerfile, entrypoint.sh, supervisord configs, nginx config), and Terraform configuration (variables, modules, and environment examples). Each category of changes serves the core purpose: enabling users to choose between PHP-FPM and Octane drivers, providing necessary binaries and configurations, supporting dynamic runtime selection, and documenting the implementation. No extraneous changes, unrelated refactoring, or scope creep has been detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/add-laravel-octane-support

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 570fbbc and a4ab8a8.

📒 Files selected for processing (13)
  • README.md (4 hunks)
  • docker/Dockerfile (3 hunks)
  • docker/README.md (2 hunks)
  • docker/entrypoint.sh (2 hunks)
  • docker/nginx/custom.d/laravel-octane.conf (1 hunks)
  • docker/supervisord-web-octane-frankenphp.conf (1 hunks)
  • docker/supervisord-web-octane-roadrunner.conf (1 hunks)
  • docker/supervisord-web-octane-swoole.conf (1 hunks)
  • terraform/environments/example.tfvars (1 hunks)
  • terraform/main.tf (2 hunks)
  • terraform/modules/compute/main.tf (1 hunks)
  • terraform/modules/compute/variables.tf (1 hunks)
  • terraform/variables.tf (1 hunks)
🧰 Additional context used
🪛 Hadolint (2.14.0)
docker/Dockerfile

[warning] 130-130: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)

🪛 markdownlint-cli2 (0.18.1)
README.md

279-279: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


297-297: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


306-306: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


311-311: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


321-321: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


326-326: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🔇 Additional comments (19)
terraform/modules/compute/main.tf (1)

20-23: LGTM! APP_SERVER_MODE environment variable correctly added.

The new environment variable properly propagates the app_server_mode configuration to all containers, enabling runtime selection of the application server mode.

terraform/main.tf (1)

220-260: LGTM! Module parameter correctly passed.

The app_server_mode variable is properly passed from the root module to the compute module, maintaining the configuration flow from Terraform variables to container environment.

docker/supervisord-web-octane-roadrunner.conf (1)

1-28: LGTM! RoadRunner supervisord configuration is well-structured.

The configuration correctly:

  • Runs Nginx and Octane as separate supervised programs
  • Explicitly specifies --server=roadrunner for clarity
  • Uses consistent logging and restart settings
  • Sets appropriate priorities (Octane starts before Nginx)
docker/nginx/custom.d/laravel-octane.conf (2)

6-9: Consider the scope of the real IP trust range.

The set_real_ip_from 10.0.0.0/8 directive trusts all private Class A addresses. While this covers most VPC CIDR blocks and simplifies configuration, it's broader than necessary. If security is a concern, consider documenting that users should tighten this to their specific VPC CIDR block (available via module.networking.vpc_cidr_block).


26-29: Verify 60-second timeouts are sufficient for your use case.

The proxy timeouts are hardcoded at 60 seconds. For applications with long-running requests (file uploads, report generation, etc.), these timeouts may be insufficient and could cause 504 Gateway Timeout errors. Consider documenting this limitation or making the timeouts configurable via environment variables if needed.

docker/supervisord-web-octane-frankenphp.conf (1)

1-28: LGTM! FrankenPHP supervisord configuration is well-structured.

The configuration correctly:

  • Runs Nginx and Octane as separate supervised programs
  • Explicitly specifies --server=frankenphp for clarity
  • Uses consistent logging and restart settings matching the other Octane configurations
  • Sets appropriate priorities (Octane starts before Nginx)
docker/README.md (2)

5-34: Excellent documentation for Application Server Mode options.

The documentation clearly:

  • Explains the purpose and benefits of each server mode
  • Lists prerequisites and compatibility requirements
  • Provides guidance on when to use each mode
  • Maintains accurate technical details about each driver

This will help users make informed decisions about which mode to use for their application.


54-84: LGTM! Comprehensive examples for local testing.

The example commands cover all server modes with appropriate environment variables. The examples are practical and easy to follow, making it simple for developers to test each mode locally before deployment.

terraform/environments/example.tfvars (1)

67-75: LGTM! Excellent documentation and backward-compatible default.

The new app_server_mode configuration is well-documented with clear explanations of each driver option. The default value of "php-fpm" maintains backward compatibility as intended.

docker/entrypoint.sh (3)

14-15: LGTM! Consistent default value.

The APP_SERVER_MODE variable defaults to "php-fpm", maintaining backward compatibility with existing deployments.


88-98: LGTM! Proper fallback handling with idempotent config restoration.

The PHP-FPM mode correctly acts as the default fallback and safely restores the original nginx configuration. The file existence checks ensure the script is idempotent.


53-99: All referenced configuration files are properly present and copied to the Docker image.

Verification confirms:

  • All 4 supervisor configs (swoole, roadrunner, frankenphp, php-fpm) are copied in the Dockerfile
  • All nginx configs (laravel.conf, laravel-octane.conf) exist in docker/nginx/custom.d/
  • The nginx directory is properly copied to /etc/nginx

The entrypoint script correctly manages config files at runtime by swapping disabled/enabled versions via mv operations.

terraform/variables.tf (1)

105-114: LGTM! Robust variable definition with proper validation.

The app_server_mode variable includes:

  • Clear description of all supported values
  • Input validation to prevent invalid configurations
  • Helpful error message for invalid inputs
  • Backward-compatible default value
docker/Dockerfile (3)

56-58: LGTM! Proper PECL extension installation.

Swoole is correctly installed via PECL and enabled alongside the Redis extension, supporting the Octane Swoole driver.


150-152: LGTM! Proper multi-stage build pattern.

The Octane binaries are correctly copied from the builder stage to the final image.


160-162: LGTM! Proper default configuration with runtime selection.

The Dockerfile correctly:

  • Includes all supervisor configurations for different server modes
  • Disables the Octane nginx config by default (Line 175)
  • Allows the entrypoint script to enable the appropriate config at runtime

This maintains backward compatibility with PHP-FPM as the default.

Also applies to: 168-175

README.md (3)

156-185: LGTM! Comprehensive documentation of the new feature.

The Application Server Mode section clearly explains:

  • All four supported modes with code examples
  • Driver comparison to help users choose
  • Performance benefits of Octane
  • Important compatibility requirements

201-202: LGTM! Appropriate defaults for different environments.

The documentation recommends:

  • PHP-FPM for minimal/staging environments (conservative, most compatible)
  • Octane Swoole for production (battle-tested, high performance)

Both include helpful comments about alternatives.

Also applies to: 238-239


270-372: LGTM! Complete and practical migration guide.

The switching guide provides:

  • Clear prerequisites with installation commands
  • Step-by-step migration process in both directions
  • Local testing instructions with concrete examples
  • Proper handling of APP_KEY generation for security

This addresses the PR objective of providing "documentation and examples for switching between PHP-FPM and Octane."

Comment on lines +129 to +133
# Download RoadRunner binary for Laravel Octane
RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
| tar -xz -C /usr/local/bin roadrunner && \
chmod +x /usr/local/bin/roadrunner

Copy link
Contributor

@coderabbitai coderabbitai bot Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add pipefail and consider checksum verification for binary downloads.

The RoadRunner download uses a pipe without the pipefail option, which could mask download failures. Additionally, downloading binaries without checksum verification poses a security risk.

Apply this diff to add pipefail and improve error handling:

 # Download RoadRunner binary for Laravel Octane
-RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
-    | tar -xz -C /usr/local/bin roadrunner && \
+RUN set -o pipefail && \
+    curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
+    | tar -xz -C /usr/local/bin roadrunner && \
     chmod +x /usr/local/bin/roadrunner

Optional enhancement: Consider verifying checksums for both binaries to ensure integrity and security. You can obtain checksums from the respective GitHub release pages.

Based on static analysis hints.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Download RoadRunner binary for Laravel Octane
RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
| tar -xz -C /usr/local/bin roadrunner && \
chmod +x /usr/local/bin/roadrunner
# Download RoadRunner binary for Laravel Octane
RUN set -o pipefail && \
curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
| tar -xz -C /usr/local/bin roadrunner && \
chmod +x /usr/local/bin/roadrunner
🧰 Tools
🪛 Hadolint (2.14.0)

[warning] 130-130: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)

🤖 Prompt for AI Agents
In docker/Dockerfile around lines 129 to 133, the RoadRunner download uses a
piped curl->tar without pipefail and no integrity check; update the RUN step to
enable bash pipefail (e.g., set -o pipefail), use curl with fail flags (curl
-fSL) and fail fast so download errors surface, write the archive to a temporary
file, verify the archive (preferably by checking a published checksum or
signature) before extracting to /usr/local/bin, and ensure proper cleanup and
executable permission changes after extraction.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot In docker/Dockerfile around lines 129 to 133, the RoadRunner download uses a
piped curl->tar without pipefail and no integrity check; update the RUN step to
enable bash pipefail (e.g., set -o pipefail), use curl with fail flags (curl
-fSL) and fail fast so download errors surface, write the archive to a temporary
file, verify the archive (preferably by checking a published checksum or
signature) before extracting to /usr/local/bin, and ensure proper cleanup and
executable permission changes after extraction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +130 to +137
RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
| tar -xz -C /usr/local/bin roadrunner && \
chmod +x /usr/local/bin/roadrunner

# Download FrankenPHP binary for Laravel Octane
RUN curl -sSL https://github.com/dunglas/frankenphp/releases/download/v1.3.5/frankenphp-linux-x86_64 \
-o /usr/local/bin/frankenphp && \
chmod +x /usr/local/bin/frankenphp
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify that binary versions are current and consider platform compatibility.

The Dockerfile downloads specific versions of RoadRunner (v2024.2.1) and FrankenPHP (v1.3.5). Additionally, the binaries are hardcoded for x86_64 architecture, which won't work on ARM-based systems (e.g., Apple Silicon, AWS Graviton).

Run the following script to check for the latest versions:


🏁 Script executed:

#!/bin/bash
# Description: Check latest versions of RoadRunner and FrankenPHP

echo "=== Latest RoadRunner Release ==="
gh api repos/roadrunner-server/roadrunner/releases/latest --jq '.tag_name, .published_at'

echo ""
echo "=== Latest FrankenPHP Release ==="
gh api repos/dunglas/frankenphp/releases/latest --jq '.tag_name, .published_at'

echo ""
echo "=== Current versions in Dockerfile ==="
rg -n "roadrunner.*v[0-9]" docker/Dockerfile
rg -n "frankenphp.*v[0-9]" docker/Dockerfile

Length of output: 283



---

🏁 Script executed:

```shell
#!/bin/bash
# Description: Verify versions and architecture hardcoding in Dockerfile

echo "=== Dockerfile lines 130-137 ==="
sed -n '130,137p' docker/Dockerfile

echo ""
echo "=== Verify x86_64 hardcoding ==="
rg -n "x86_64|amd64|architecture" docker/Dockerfile -A2 -B2

Length of output: 1049






🌐 Web query:

RoadRunner GitHub releases ARM64 Linux support

💡 Result:

Yes — official RoadRunner releases include Linux ARM64 binaries. The roadrunner v2025.1.2 release (published 2025-06-14) includes a linux-arm64 asset, and earlier releases added linux/arm64 Docker support. (github.com)

Citations:


🌐 Web query:

FrankenPHP GitHub releases ARM64 aarch64 builds

💡 Result:

Yes — FrankenPHP GitHub releases include ARM64 / aarch64 builds (e.g., frankenphp-linux-aarch64 and frankenphp-*.aarch64.rpm in the release assets). [1][2]

Sources:

  • FrankenPHP releases (shows aarch64 assets, e.g., v1.9.1). [1]
  • FrankenPHP GitHub README (mentions static binaries for Linux/macOS). [2]

Update binary versions and add platform-agnostic architecture detection.

The Dockerfile downloads outdated binaries: RoadRunner v2024.2.1 (latest is v2025.1.4, released 2025-10-02) and FrankenPHP v1.3.5 (latest is v1.9.1, released 2025-08-29). Additionally, both binaries are hardcoded for x86_64 architecture, which will fail on ARM-based systems (e.g., Apple Silicon, AWS Graviton) even though both projects publish ARM64 binaries.

Lines 130–137 require:

  • Update RoadRunner to v2025.1.4 or later
  • Update FrankenPHP to v1.9.1 or later
  • Use dynamic architecture detection (e.g., $(uname -m) or Docker buildx multiplatform) instead of hardcoded linux-amd64 and linux-x86_64
🧰 Tools
🪛 Hadolint (2.14.0)

[warning] 130-130: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Update RoadRunner to v2025.1.4 or later
Update FrankenPHP to v1.9.1 or later
Use dynamic architecture detection (e.g., $(uname -m) or Docker buildx multiplatform) instead of hardcoded linux-amd64 and linux-x86_64

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +18 to +28
[program:octane]
command=php /var/www/html/artisan octane:start --host=127.0.0.1 --port=8000 --workers=auto --max-requests=500
priority=10
user=www-data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
startsecs=5
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Add explicit --server=swoole flag for consistency.

While Swoole is the default Octane server and the flag is optional, explicitly specifying --server=swoole improves consistency with the RoadRunner and FrankenPHP configurations and makes the configuration more self-documenting.

Apply this diff:

 [program:octane]
-command=php /var/www/html/artisan octane:start --host=127.0.0.1 --port=8000 --workers=auto --max-requests=500
+command=php /var/www/html/artisan octane:start --server=swoole --host=127.0.0.1 --port=8000 --workers=auto --max-requests=500
 priority=10
 user=www-data
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[program:octane]
command=php /var/www/html/artisan octane:start --host=127.0.0.1 --port=8000 --workers=auto --max-requests=500
priority=10
user=www-data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
startsecs=5
[program:octane]
command=php /var/www/html/artisan octane:start --server=swoole --host=127.0.0.1 --port=8000 --workers=auto --max-requests=500
priority=10
user=www-data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
startretries=3
startsecs=5
🤖 Prompt for AI Agents
In docker/supervisord-web-octane-swoole.conf around lines 18 to 28, the Octane
supervisor command omits an explicit server flag; update the command value to
include the --server=swoole option (preserving all existing flags: --host,
--port, --workers, --max-requests) so the command becomes explicit about using
Swoole for consistency and self-documentation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot In docker/supervisord-web-octane-swoole.conf around lines 18 to 28, the Octane
supervisor command omits an explicit server flag; update the command value to
include the --server=swoole option (preserving all existing flags: --host,
--port, --workers, --max-requests) so the command becomes explicit about using
Swoole for consistency and self-documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines 201 to 205
variable "app_server_mode" {
description = "Application server mode: 'php-fpm' or 'octane'"
type = string
default = "php-fpm"
}
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Update variable description to match allowed values.

The description states 'php-fpm' or 'octane' but the root-level validation (in terraform/variables.tf) enforces specific values: "php-fpm", "octane-swoole", "octane-frankenphp", "octane-roadrunner". Update the description to reflect the actual allowed values for clarity.

Apply this diff to improve the description:

 variable "app_server_mode" {
-  description = "Application server mode: 'php-fpm' or 'octane'"
+  description = "Application server mode: 'php-fpm', 'octane-swoole', 'octane-roadrunner', or 'octane-frankenphp'"
   type        = string
   default     = "php-fpm"
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
variable "app_server_mode" {
description = "Application server mode: 'php-fpm' or 'octane'"
type = string
default = "php-fpm"
}
variable "app_server_mode" {
description = "Application server mode: 'php-fpm', 'octane-swoole', 'octane-roadrunner', or 'octane-frankenphp'"
type = string
default = "php-fpm"
}
🤖 Prompt for AI Agents
In terraform/modules/compute/variables.tf around lines 201 to 205 the variable
description only lists 'php-fpm' or 'octane' while root-level validation allows
"php-fpm", "octane-swoole", "octane-frankenphp", and "octane-roadrunner"; update
the description to enumerate the exact allowed values (e.g., "php-fpm",
"octane-swoole", "octane-frankenphp", "octane-roadrunner") so it matches
validation and clarifies expected inputs.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot In terraform/modules/compute/variables.tf around lines 201 to 205 the variable
description only lists 'php-fpm' or 'octane' while root-level validation allows
"php-fpm", "octane-swoole", "octane-frankenphp", and "octane-roadrunner"; update
the description to enumerate the exact allowed values (e.g., "php-fpm",
"octane-swoole", "octane-frankenphp", "octane-roadrunner") so it matches
validation and clarifies expected inputs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Co-authored-by: leek <60204+leek@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 24, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: terraform version (dns block)
    • Triggering command: terraform fmt -recursive (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of leek October 24, 2025 09:22
Copilot finished work on behalf of leek October 24, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Laravel Octane while retaining PHP-FPM/Nginx setup

2 participants