Docs menu

Getting started with Java

Deploy a minimal Spring Boot app to Primcloud end-to-end using a sample repo, in about five minutes.

On this page

This guide walks through deploying a small Spring Boot app to Primcloud. You'll fork a sample repo, import it, watch the build, and reach the running app at a *.primcloud.app URL. It takes about five minutes.

Before you start#

You'll need:

  • A Primcloud account. Standard accounts have no monthly fee; compute is metered by the minute once you deploy, from around $5/mo for the smallest app.
  • A git provider connected to your Primcloud account; see Source Control.
  • Optional: OpenJDK 17 or newer and Maven (or the bundled Maven wrapper) installed locally, if you want to run the sample or change it before deploying.

The sample app#

Use Heroku's heroku/java-getting-started repo. It's a minimal Spring Boot app that builds on Primcloud with no changes: a pom.xml, a Maven wrapper, and a Procfile. Fork it into an account you've connected to Primcloud.

1. Create the application#

Hit Import Git Repository on the applications list, then:

  1. Select your fork of java-getting-started.
  2. Configure the branch (main) and a region.
  3. Verify the commit and hit Import.

2. Deploy#

The first deployment starts as soon as the app is created, and its build log streams live:

  • Detection. Primcloud sees the pom.xml at the repo root and picks the Java toolchain.

  • Build. Primcloud installs OpenJDK (the latest LTS by default), then runs the Maven wrapper: ./mvnw clean install -DskipTests. Dependencies are kept for the next build.

  • Start. Primcloud reads the Procfile and starts the web process. The sample's Procfile is one line:

    Procfile
    web: java -jar target/java-getting-started-1.0.0-SNAPSHOT.jar
    

When the deployment's Rollout phase shows Complete, the app is live.

3. Reach the app#

The application dashboard shows the assigned *.primcloud.app URL in the header. Click it, and the Spring Boot sample loads.

If it doesn't come up:

  • Deployments: the build log has the raw output from Maven.
  • Logs: runtime output from your app streams there, including any startup errors.
  • Confirm the app binds to the port in $PORT. Primcloud sets PORT to 5000 on the web process, and the Spring Boot sample reads it through server.port=${PORT:5000} in application.properties. Your own apps need to do the same, or pass -Dserver.port=$PORT in the Procfile launch command.

Where to go next#