No configuration file in your repository. Qovery does not read a
qovery.yml, .qovery.yml or .qovery.toml, and there is no qovery init. Projects, environments and services are created in the Console, with qovery api, or with Terraform. For the full path from a repository to a running app with commands only, see Deploy with the CLI and API.Prerequisites
- A Laravel 11 or later application in a GitHub, GitLab or Bitbucket repository, with a
composer.lock. - A Qovery account and a cluster: create one in your cloud account, connect your own cluster, or try it on your laptop.
- An application key, generated with
php artisan key:generate --show.
Prepare the application
Laravel reads a full connection URL fromDB_URL. In config/database.php, let the pgsql connection fall back to DATABASE_URL, the name the other services of the environment use:
config/database.php
bootstrap/app.php, trust the cluster’s ingress, so Laravel builds https:// URLs and reads the client IP from the forwarded headers:
bootstrap/app.php
Add a production Dockerfile
Create aDockerfile at the root of the repository:
Dockerfile
php:8.4-apacheis the official PHP image with Apache, which serves PHP in a single container. Thefpmvariant needs a separate web server in front of it. Match the PHP version to thephpconstraint of yourcomposer.json.- It adds the
pdo_pgsqlextension for PostgreSQL,opcacheto cache compiled PHP, andzipfor Composer, and uses the productionphp.ini. - The
sedlines point Apache at thepublicfolder, where Laravel’s entry point is, and move it to port8080, so it runs without root.mod_rewritereads the.htaccessthat Laravel ships inpublic. - Composer comes from the official
composer:2image. Installing the dependencies before copying the code keeps that layer cached when only the code changes. - The container runs as
www-data, which ownsstorageandbootstrap/cache, the folders Laravel writes to. php artisan optimizecaches the configuration, routes and views at startup, when the variables are set, thenexecmakes Apache the main process, so it receives the stop signal.LOG_CHANNEL=stderrsends the logs to the container output, where Qovery reads them.
node image with npm ci and npm run build, and copy public/build into this image. Add a .dockerignore with at least .git, .env, vendor and node_modules.
Port and health check
The application listens on port8080. Laravel 11 and later register a GET /up route in bootstrap/app.php that answers 200 when the application boots, so use it as the health check path.
Connect PostgreSQL
The application and the migration job read the connection string fromDATABASE_URL. Create PostgreSQL, then expose its connection string under that name at the environment scope, so every service of the environment gets it.
- Qovery database (development)
- Blueprint (production)
- In the environment, click New Service and pick PostgreSQL. Keep the visibility private, then create and deploy it. See Create a Database.
- Open the Variables section of the environment, find the built-in variable
QOVERY_POSTGRESQL_Z<ID>_DATABASE_URL_INTERNAL, select Create alias, and name itDATABASE_URL.
postgresql:// URL as is and maps it to its pgsql driver.
Set the variables
The
qovery.io domain shows in the Console once the application is created. Without DB_CONNECTION, Laravel 11 and later use SQLite.
Run the migrations
Runmigrate in a lifecycle job built from the same repository and Dockerfile, triggered on the Deploy event, with these CMD arguments:
--force is required because APP_ENV is production. The job runs once per deployment. In the default deployment pipeline, jobs run after the databases and before the applications, so the schema is up to date when the new code starts. The default Laravel migrations also create the sessions, cache and jobs tables that the database drivers use.
Running migrate in the start command instead works for a single instance, but every instance then runs it at boot, and a failed migration leaves the application crashing in a loop.
Deploy
- Console
- With a coding agent
1
Create a project and an environment
Follow steps 1 and 2 of Deploy Your First Application. Pick the cluster the environment runs on.
2
Add PostgreSQL
Create the database and the
DATABASE_URL variable as described in Connect PostgreSQL.3
Create the application
In the environment, click New Service › Create application, select Git Repository, then your repository and branch. Leave Root Application Path empty unless the Dockerfile is in a subfolder.
4
Set the port
Add port
8080 with the protocol HTTP, and turn on Publicly Accessible. Qovery serves it over HTTPS on port 443.5
Set the health checks
Set the readiness and liveness probes to type HTTP, path
/up, port 8080. See Service Health Checks.6
Add the variables
Click Create, without deploying yet. Then open the Variables section of the environment and add the other variables listed in Set the variables at the environment scope, so the migration job gets them too.
DATABASE_URL already exists from the previous step. Mark keys and passwords as secrets.7
Create the migration job
Click New Service › Create lifecycle job, select the same repository, branch and Dockerfile, and trigger it on the Deploy event (
START) with the CMD arguments ["php", "artisan", "migrate", "--force"]. Set the number of restarts to 0. See Run the migrations.8
Deploy
Deploy the environment. Qovery deploys the database, then the job, then the application, builds the image from your Dockerfile and gives the application a URL on
qovery.io. Follow the progress in the Deployment logs tab.Troubleshooting
The CLI commands below use the organization, project and environment selected withqovery context set. Run it first, or add --organization, --project and --environment to each command.
Deployment fails on the health check
Deployment fails on the health check
Apache listens on another port than the one set in Qovery. Check that the
Listen 8080 and VirtualHost *:8080 lines are in the Dockerfile and that the port in Qovery is 8080. Read the error lines with qovery environment deployment logs --environment "<env>" --service "<app>" --errors-only.Database file at path database.sqlite does not exist
Database file at path database.sqlite does not exist
DB_CONNECTION is not set, so Laravel falls back to SQLite. Set it to pgsql at the environment scope, so the migration job gets it too, then redeploy.No application encryption key has been specified
No application encryption key has been specified
APP_KEY is missing or empty. Generate one with php artisan key:generate --show and add it as a secret, including the base64: prefix.relation does not exist
relation does not exist
The migrations did not run against this database. Check that the job and the application read the same
DATABASE_URL and DB_CONNECTION at the environment scope, and read the job output with qovery log --job "<job name>".Links and assets use http:// instead of https://
Links and assets use http:// instead of https://
Laravel does not trust the forwarded headers of the ingress. Add
trustProxies(at: '*') in bootstrap/app.php and set APP_URL to the https:// URL. A Vite manifest not found error means the assets were not built into the image.Next steps
Preview environments
Get a full copy of the environment for each pull request
Custom domain
Serve the application on your own domain
Auto deploy
Deploy on every push to the branch
Other frameworks
All framework guides