Skip to main content
Deploy Laravel with Railpack’s FrankenPHP runtime on ECS Fargate behind an Application Load Balancer, with PostgreSQL on Amazon RDS.

Prerequisites

  • A Git repository containing your application and its production build command.
  • A Ravion account with your AWS account connected. Start free at Ravion signup.
  • The Ravion CLI installed and authenticated. See CLI installation.
The examples use my-org/my-app as a placeholder. Replace it with your repository before applying the config.

Set up this Laravel app for Ravion ECS hosting.

Open in Cursor

Configure the deployment

Laravel runs on Railpack’s FrankenPHP runtime on ECS Fargate behind an Application Load Balancer. Ravion creates the network, ECS cluster, web service, and PostgreSQL database in your AWS account. Railpack detects Laravel when the source contains an artisan file. It reads the PHP version from composer.json, uses FrankenPHP, sets the document root to public/, and runs the Laravel startup tasks. This is the preferred quickstart because it follows the current Laravel and Railpack container path without adding a separate Nginx process. Laravel’s production documentation requires PHP 8.3 or newer for Laravel 13. Check the php constraint in your own composer.json and use a compatible version. Railpack supports PHP 8.2 and newer; a project requirement takes precedence over its default PHP version.
ravion.yaml
Set these runtime values through Secrets Manager before the first web deployment:
  • APP_KEY: Generate it once with php artisan key:generate --show outside the repository, then store the result as a secret.
  • APP_ENV=production
  • APP_DEBUG=false
  • DB_CONNECTION=pgsql
  • DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD: Populate these from the RDS outputs.
  • FILESYSTEM_DISK=s3: Configure Laravel’s S3 credentials and bucket for user uploads.
The module catalog does not provide typed output references from rvn-rds to ECS runtime secrets. Create the Secrets Manager values from the RDS outputs, then apply the web service with those values.

Build and startup behavior

Railpack installs Composer dependencies and detects frontend dependencies when package.json is present. If the application has frontend assets, verify its actual package-manager build script and configure that script in the repository rather than assuming a command or output directory. Railpack’s Laravel startup process runs database migrations and seeding, creates the storage symlink, optimizes the application, and starts FrankenPHP. Migrations are enabled by default; set RAILPACK_SKIP_MIGRATIONS=true only when you run migrations in a separate release step. Laravel’s optimize command caches configuration, events, routes, and views. Run it as a release/startup operation after the runtime environment is available, not while building an image that cannot access production secrets. If you use a custom startup process, run:
Never use php artisan serve in production. If you do not use Railpack’s FrankenPHP runtime, follow Laravel’s documented PHP-FPM and Nginx setup: Nginx must use public/ as its root and route requests to public/index.php.

Health checks and storage

New Laravel applications include the /up health route. It returns 200 after the application boots successfully and 500 when boot fails. If your application has disabled or changed this route, add a lightweight unauthenticated route that returns 200 and update health_check_path. Laravel must be able to write to bootstrap/cache and storage. ECS task filesystems are ephemeral, so do not store user uploads there. Configure Laravel’s filesystem to use an S3 bucket for durable uploads and generated assets.

Apply and connect your domain

Follow custom domains to connect your domain to the Application Load Balancer.

Next steps

Custom domains

Point a domain at your deployed service and manage its certificate.

Project config

Preview and apply Ravion configuration from source control.

Pipelines

Add approvals, migrations, and deployment automation.

Logs and metrics

Inspect deploy output and production health in Ravion.