Docs menu
Getting started with Scala
Deploy a minimal Scala Play app to Primcloud end-to-end from a sample repo, in about ten minutes.
On this page
This guide takes a small Scala Play app from a git repo to a running URL on Primcloud. You'll fork a sample, import it, watch the build, and open the deployed app at its *.primcloud.app address. Budget about ten minutes. A Scala build runs longer than most languages the first time through, before the caches are warm.
Before you start#
You'll need:
- A Primcloud account. Creating one costs nothing; 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: sbt and a JDK locally, if you want to run the sample or change it before deploying. The sample targets JDK 25 and sbt 1.11.7.
The sample app#
Use Heroku's heroku/scala-getting-started repo, a minimal Play app that deploys on Primcloud with no changes. Fork it into an account your connected provider can see, so Primcloud can pull from it.
The sample already carries the three files a Scala app on Primcloud relies on:
project/build.propertiespinssbt.version(1.11.7here).system.propertiespinsjava.runtime.version, the OpenJDK major (25here).Procfiledeclares thewebcommand that launches the packaged app.
1. Create the application#
From the dashboard, hit Import Git Repository on the applications list. The wizard is three steps:
- Pick a repository: your fork of
scala-getting-started. - Configure the deployment:
- Branch:
main, the fork's default. - Region: US East (NYC).
- Branch:
- Review and create: Primcloud provisions the app's primary
*.primcloud.appsubdomain on the production environment.
2. Deploy#
The first deployment starts on its own when the app is created. Watch it stream in the Deployments tab:
- Detection. Primcloud finds
build.sbtandproject/build.propertiesand picks the Scala toolchain. - JDK. OpenJDK is resolved from
system.properties(java.runtime.version=25in the sample) and installed. - sbt. Primcloud fetches the sbt version pinned in
project/build.properties(1.11.7) and runs the build with it. - Build.
sbt compile stageruns. Play pulls insbt-native-packagerand wires up thestagetask, which assembles the runnable app undertarget/universal/stage/. - Release. Primcloud starts the
webprocess, running the sample'sProcfileline:target/universal/stage/bin/scala-getting-started -Dhttp.port=${PORT}.
Expect the first build to take a few minutes. sbt downloads Play, the Scala library, and their transitive dependencies from Maven Central the first time through. Later deploys reuse the cached Ivy and Coursier stores and finish much faster.
When the status flips to Release Succeeded, the app is live.
3. Reach the app#
The application dashboard shows the assigned *.primcloud.app URL in its header. Open it, and the sample's landing page renders.
If it doesn't come up:
- Deployments: the build log holds the raw sbt output, including any compile or
stageerror. - Logs: your app's runtime output streams here, including Play's startup banner and any unhandled exception.
- Confirm the app binds to
$PORT. Primcloud sets that variable on thewebprocess, and the sample passes it through with-Dhttp.port=${PORT}.
Where to go next#
- Deploying a Scala app that isn't the sample: Scala on Primcloud for detection,
sbt compile stage, and caching. - Pinning an sbt or JDK version: Runtime versions.
- Pulling from a private Maven or Ivy resolver: Package managers.
- Building a subproject or overriding the default tasks: Customizing the build.
- Something breaking: Troubleshooting Scala.