Deploy Java on Your Own Server

Deploy Spring Boot and other JVM applications built with Maven or Gradle. Temps compiles your project, packages it into a minimal runtime image, and runs it with automatic HTTPS.


Quickstart

From your project root, deploy with your preferred package manager:

npx @temps-sdk/cli up

Temps detects your pom.xml (Maven) or build.gradle / build.gradle.kts (Gradle) and builds the project via Nixpacks. Your app is live with HTTPS in a few minutes.


What Temps Handles Automatically

FeatureHow Temps handles it
Detectionpom.xml, build.gradle, or build.gradle.kts
BuildMaven or Gradle via Nixpacks
HTTPSLet's Encrypt certificate, auto-renewed
PortPORT env var injected, defaults to 8080
Health checksHTTP health check on /
Zero-downtime deploysNew container starts before old one stops

Spring Boot

A minimal Spring Boot application that runs on Temps:

src/main/java/com/example/Application.java

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

src/main/java/com/example/HelloController.java

package com.example;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@RestController
public class HelloController {
    @GetMapping("/")
    public Map<String, String> hello() {
        return Map.of("message", "Hello from Spring Boot");
    }

    @GetMapping("/health")
    public Map<String, String> health() {
        return Map.of("status", "ok");
    }
}

Configure Spring Boot to read the port from the environment:

src/main/resources/application.properties

server.port=${PORT:8080}

Custom Dockerfile

For full control over the JDK version and runtime image, add your own multi-stage Dockerfile. It takes priority over auto-detection.

FROM maven:3.9-eclipse-temurin-21-alpine AS build
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src ./src
RUN mvn package -DskipTests

FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar

EXPOSE 8080
CMD ["java", "-jar", "app.jar"]

Platform behavior

These rules apply to every app deployed on Temps, regardless of framework.

Health checks

After your container starts, Temps sends HTTP GET requests to verify it is healthy before routing traffic to it.

  • Path: / (the root of your application)
  • Success: 2 consecutive responses with a 2xx or 3xx status code
  • Timeout: 300 seconds (5 minutes) for the app to become healthy
  • Retry interval: every 5 seconds

Connection errors while the app is still starting are retried without penalty. If the app returns 4xx or 5xx errors for 60 consecutive seconds, the deployment fails. Customize the check by adding a .temps.yaml to your repository root:

.temps.yaml
health:
  path: /health
  status: 200
  interval: 30
  timeout: 5
  retries: 3

Auto-injected environment variables

Temps injects these variables into every deployment automatically:

VariableValueDescription
PORTResolved portThe port your app must listen on
HOST0.0.0.0Bind address
SENTRY_DSNAuto-generatedError tracking endpoint
TEMPS_API_URLYour Temps URLPlatform API endpoint
TEMPS_API_TOKENDeployment tokenAuthentication for Temps SDKs
OTEL_EXPORTER_OTLP_ENDPOINTYour Temps OTLP URLOpenTelemetry trace collection
OTEL_SERVICE_NAMEProject nameService identifier for traces

You do not need to configure these manually. They are available in process.env (Node.js), os.environ (Python), os.Getenv (Go), and the equivalent in other languages.


Next Steps

Was this page helpful?