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 Spring Boot application in a GitHub, GitLab or Bitbucket repository, with the Maven wrapper (
mvnwand the.mvnfolder) committed. - A Qovery account and a cluster: create one in your cloud account, connect your own cluster, or try it on your laptop.
- These dependencies: the Spring Web, Actuator, JDBC (or Data JPA) and Flyway starters,
org.postgresql:postgresqlandorg.flywaydb:flyway-database-postgresql. Spring Initializr adds them when you pick Spring Web, Spring Boot Actuator, JDBC API, Flyway Migration and PostgreSQL Driver.
Prepare the application
Read the port fromPORT, trust the ingress headers, turn on the health probes, and turn Flyway off at startup, because a lifecycle job runs it:
src/main/resources/application.properties
DATABASE_URL holds a postgresql://user:password@host:port/database URL. This configuration class builds the data source from it. Flyway uses the same data source:
src/main/java/com/example/demo/DataSourceConfig.java
com.example.demo with your package. Put the migrations in src/main/resources/db/migration, named in the Flyway format, for example V1__create_items.sql.
Add a production Dockerfile
Create aDockerfile at the root of the repository:
Dockerfile
- The first stage builds the jar with the official
eclipse-temurin:25-jdkimage, the second runs it oneclipse-temurin:25-jre, which has no compiler. Match the Java version to thejava.versionof yourpom.xml. - Downloading the dependencies before copying
srckeeps that layer cached when only the code changes. -XX:MaxRAMPercentage=75sizes the heap from the memory limit of the container, instead of the memory of the node.- The container runs as a non-root user.
CMD ["java", "-jar", "app.jar"]starts the JVM directly, so it receives the stop signal.
./gradlew bootJar and copy the jar from build/libs. Add a .dockerignore with at least .git and target.
Port and health check
The application listens on port8080. Actuator exposes two probe endpoints, which answer 200 when the state is up and 503 when it is not:
GET /actuator/health/readinessfor the readiness probe, which tells Kubernetes when the application can take traffic.GET /actuator/health/livenessfor the liveness probe, which tells Kubernetes when to restart it.
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.
Set the variables
Add the other variables your application reads, and mark keys and passwords as secrets. Spring Boot maps environment variables to properties, so
SPRING_PROFILES_ACTIVE=prod sets spring.profiles.active.
Run the migrations
Run Flyway in a lifecycle job built from the same repository and Dockerfile, triggered on the Deploy event, with these CMD arguments: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
/actuator/health/readiness, 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 ["java", "-jar", "app.jar", "--spring.main.web-application-type=none", "--spring.flyway.enabled=true"]. 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./actuator/health/liveness.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
The application listens on another port than the one set in Qovery, or the probes are off. Check
server.port=${PORT:8080} and management.endpoint.health.probes.enabled=true, and that the port in Qovery is 8080. A large application can take longer to start than the probe allows: raise the initial delay in Service Health Checks. Read the error lines with qovery environment deployment logs --environment "<env>" --service "<app>" --errors-only.OOMKilled or out of memory
OOMKilled or out of memory
The heap does not fit in the memory of the container. Keep
-XX:MaxRAMPercentage=75 and raise the memory of the application, or lower the percentage if the application uses a lot of memory outside the heap.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 at the environment scope, and read the job output with qovery log --job "<job name>".The migration job never finishes
The migration job never finishes
Something in the application keeps the JVM running without the web server, such as a scheduler or a message listener. Turn it off in the job with a property, for example with
@ConditionalOnProperty on its configuration, and pass that property in the CMD arguments.mvnw: Permission denied
mvnw: Permission denied
The wrapper lost its executable bit, which happens when the repository was committed from Windows. Run
git update-index --chmod=+x mvnw, commit and push.Next steps
Preview environments
Get a full copy of the environment for each pull request
Autoscaling
Set the number of instances and the resources
Auto deploy
Deploy on every push to the branch
Other frameworks
All framework guides