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 are free to create; compute is metered by the minute once you deploy, from around $5/mo for the smallest app.
  • A git provider connected to your account with access to at least one repo.
  • 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 cleanly on Primcloud with no changes: a pom.xml, a Maven wrapper, and a Procfile. Fork it into an account your connected provider can see, so Primcloud can pull from it.

1. Create the application#

From the Primcloud dashboard, hit Import Git Repository on the applications list. The import wizard walks you through three quick steps:

  1. Pick a repository: select your fork of java-getting-started.
  2. Configure the deployment:
    • Branch: main (the fork's default).
    • Region: US East (NYC).
  3. Review and create: Primcloud provisions the app's primary *.primcloud.app subdomain on the production environment.

2. Deploy#

The first deployment starts automatically when the app is created. Watch it stream in the Deployments tab:

  • 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. The local .m2 repository fills up and is cached for the next build.

  • Release. 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 status flips to Release Succeeded, 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#