Antrykntryk
Antryk
ProductsDocsPricingBlogsAboutContact

Antryk

Antryk

Deploy in seconds, scale infinitely, and manage effortlessly — your next-gen cloud solution for modern applications.

Explore

  • Home
  • Products
  • Pricing
  • Blogs
  • Npm Packages
  • Terms of Use
  • Privacy Policy
  • Payment & Refund Policy
  • About Us
  • Contact Us
  • Reviews

Connect

© 2026 Antryk. All rights reserved.
Back to Blogs
Web Hosting12 min read

How to Deploy a Spring Boot App from GitHub Without Managing Servers

Learn to deploy a Spring Boot app from GitHub without managing servers: JVM memory, health checks, env vars, migrations, domains and rollbacks.

MuthuSelvi
How to Deploy a Spring Boot App from GitHub Without Managing Servers

You can deploy a Spring Boot app from GitHub without managing servers: connect your repository, set your environment variables, and let a managed platform build the jar, run it and restart it if it fails. No SSH, no systemd units, no reverse proxy to configure, no patching a Linux box.

The catch is that a Spring Boot app is a JVM process, and the JVM behaves differently inside a small cloud container than on your laptop. Most failed first deploys come from four things: the wrong jar, the wrong port, too little memory, or a health check that fires before the app has finished starting.

This guide covers what "without managing servers" really means, how to get your app ready, the full deploy flow, and the errors you are most likely to hit, with fixes.

What "without managing servers" actually means#

A managed platform takes over the work that has nothing to do with your code:

  • The operating system, security patches and machine uptime

  • The Java runtime

  • TLS certificates and HTTPS

  • Building your app every time you push to GitHub

  • Restarting the app when it crashes

You still own everything inside the app:

  • Environment variables and secrets

  • Your database schema and migrations

  • JVM memory settings

  • Your health check endpoint

  • Whether a release is safe to roll back

Platforms remove the server work, but they cannot tune a JVM or write safe migrations for you. The sections below cover those parts.

Step 1: Get your Spring Boot app ready#

Do these once, before your first deploy.

1. Build a runnable "fat" jar. Your platform will run a single jar file, so the Spring Boot build plugin must be set up. With Maven, spring-boot-starter-parent or the spring-boot-maven-plugin handles this. With Gradle, use the Spring Boot plugin and its bootJar task. Commit the Maven or Gradle wrapper (mvnw or gradlew) so the platform builds with the same version you do.

bash

bash
./mvnw clean package
# or
./gradlew bootJar

2. Check which jars your build produces. Recent Spring Boot Gradle builds create two files in build/libs/: your runnable jar and a -plain.jar. If a platform picks the plain one, the app will not start. Turn the plain jar off:

groovy

groovy
tasks.named("jar") {
    enabled = false
}

3. Pick a supported Java version and set it in your build. Spring Boot 3 and later need Java 17 or newer. Match the version in your build file to the version your platform runs:

xml

xml
<properties>
    <java.version>21</java.version>
</properties>

4. Read the port from the environment. Cloud platforms tell your app which port to use. Keep 8080 as a fallback for local runs:

properties

properties
server.port=${PORT:8080}

5. Add Actuator for health checks. Platforms use a health endpoint to decide whether a new release is working:

xml

xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

properties

properties
management.endpoints.web.exposure.include=health
management.endpoint.health.probes.enabled=true

Expose only health publicly. Other Actuator endpoints can leak internal details.

6. Let the app shut down gracefully. When the platform replaces an old version, in-flight requests should finish first:

properties

properties
server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=30s

7. Keep the app stateless. On a managed platform the container's local disk is temporary. Store uploads in object storage, not on disk. If you run more than one instance, keep sessions in a database or Redis.

Step 2: Connect your GitHub repository#

Sign in to your platform, create a new app and authorize GitHub. Pick the repository and the branch to deploy, usually main. Turn on auto-deploy so every push builds and releases a new version.

Good platforms detect Maven or Gradle automatically and run the build for you, with no Dockerfile. Others expect you to write one. If you do not want to write and maintain a Dockerfile, check this before you choose a platform.

Step 3: Set your environment variables#

Spring Boot reads environment variables and maps them to properties. SPRING_DATASOURCE_URL becomes spring.datasource.url, so you do not need to edit application.properties per environment. Add these in the platform's settings, not in a file in the repo:

  • SPRING_PROFILES_ACTIVE=prod

  • SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD

  • JAVA_TOOL_OPTIONS for JVM flags (explained in Step 5)

  • Any API keys, mail credentials and third-party tokens your app reads

Never commit secrets to Git. If you change a variable after deploying, redeploy so the new value is picked up.

Step 4: Connect a managed database#

Create a managed PostgreSQL or MySQL database and put its connection details into the SPRING_DATASOURCE_* variables. Do not run the database inside the same container as your app, because it would be lost with the container. Use the database's private address if the platform offers one.

Watch your connection pool. Spring Boot uses HikariCP, which defaults to 10 connections per instance. If you run three instances, that is 30 connections. Small managed databases often allow fewer than that. Set the pool size with SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE so the total across all instances stays under your database's limit.

Step 5: Get JVM memory right#

Memory is the number one reason Spring Boot apps crash in the cloud. The JVM's heap is only part of what the app uses. It also needs memory for class metadata, thread stacks, and direct buffers. If the total goes over the container's limit, the platform kills the process, often with exit code 137 and no stack trace.

Modern JVMs read the container's memory limit. By default, though, the maximum heap is only 25% of it, which wastes memory on a small instance. A better starting point is to let the heap use about 75%, and leave the rest for everything else:

bash

bash
JAVA_TOOL_OPTIONS=-XX:MaxRAMPercentage=75.0

If your platform runs a fixed java -jar command and you cannot edit it, JAVA_TOOL_OPTIONS is how you pass JVM flags. The JVM reads it on startup, and you set it as an ordinary environment variable.

How much memory does your app need? As a starting point, give a small Spring Boot API at least 1 GB, then watch real usage and adjust. Very small instances can start up slowly or run out of memory under load.

Step 6: Run database migrations safely#

With Flyway or Liquibase, migrations run when the app starts, so they run on every deploy. That is convenient, but it creates one risk: rolling back your code does not roll back your database. If release 42 adds a column and release 43 drops it, going back to release 42's code will not bring that column back.

Write migrations that work with both the old and new code:

  1. 1

    Add first. Add new columns as nullable or with defaults. Deploy.

  2. 2

    Switch the code to use the new column. Deploy.

  3. 3

    Clean up later. Drop old columns in a separate release, once nothing uses them.

Never drop or rename a column in the same release that stops using it. If that release fails and rolls back, the old code will break against the new schema.

Step 7: Health checks and automatic rollback#

A health check is a URL the platform calls to ask "is this app working?" For Spring Boot, that is /actuator/health. The platform sends traffic to a new release only after it reports healthy. If the new release never becomes healthy, a good platform keeps or restores the last working version, so your users never see the broken one.

Two things make this work well:

  • Give the app time to start. A Spring Boot app can take 20 to 60 seconds to start on a small instance, longer if it runs migrations. If the platform checks too early, it will think the app is broken and restart it, and the app never finishes starting. Check the platform's startup or initial delay setting.

  • Keep the health check honest and simple. If your health check includes optional third-party services, a short outage there can make the platform think your whole app is down. Use readiness and liveness groups, and only include what your app truly cannot run without, such as its database.

Step 8: Add your custom domain, HTTPS and redirects#

Your platform gives you a default URL so you can test straight away. To go live on your own domain:

  1. 1

    Add the domain in the platform.

  2. 2

    Copy the DNS record the platform shows you and add it at your domain provider.

  3. 3

    Wait for the record to propagate, then verify the domain.

  4. 4

    Choose one canonical address, either www.example.com or example.com, and redirect the other to it.

Your app sits behind a proxy that handles HTTPS. Without one setting, Spring Boot may build redirect links that start with http://. Tell it to trust the forwarded headers:

properties

properties
server.forward-headers-strategy=framework

Step 9: Run scheduled jobs without duplicates#

@Scheduled methods run inside your app, on every instance. If you scale to two instances, each job runs twice. Either run a single instance, or use a lock library such as ShedLock so only one instance runs each job at a time. For heavy background work, a separate worker process is cleaner than putting it inside your web app.

Common first-deploy errors and how to fix them#

The app starts, then is killed with exit code 137. It ran out of memory. Raise the instance size, set -XX:MaxRAMPercentage, and check for memory-hungry caches.

"no main manifest attribute" or "Unable to access jarfile". The build did not produce a runnable Spring Boot jar. Check that the Spring Boot plugin is applied.

The platform runs the wrong jar. Your Gradle build created a -plain.jar next to the real one. Disable the plain jar as shown in Step 1.

The deploy fails the health check even though the app works. The app listens on 8080 but the platform expects a different port. Set server.port=${PORT:8080}.

"UnsupportedClassVersionError". The jar was built for a newer Java version than the runtime. Set the same Java version in your build and on your platform.

The app crashes at startup with a database error. The datasource URL, username or password is wrong, or the database address is not reachable from your app. Check the SPRING_DATASOURCE_* variables first.

"Too many connections" under load. Your connection pools add up to more than the database allows. Lower the HikariCP pool size.

The site loads, but redirects go to http://. Add server.forward-headers-strategy=framework.

The new release keeps restarting. The health check runs before the app finishes starting. Increase the startup delay, or use a readiness check.

A migration fails during startup. The app will not start, so the release fails. Fix the migration and push again. This is why you test migrations against a copy of production data first.

Which deployment approach fits you?#

  • A virtual machine you manage. Full control, and full responsibility for updates, security, scaling and recovery.

  • A container platform where you supply a Dockerfile. Flexible, but you must write and maintain the Dockerfile and keep the base image patched.

  • A Git-based platform with automatic builds. Connect a repo and get builds, databases, domains and rollbacks in one place. This is the lowest-effort option.

  • A cloud vendor's Spring-specific service. If you use Azure Spring Apps, note that Microsoft stopped accepting new customers in March 2025 and will retire the service on March 31, 2028. Microsoft points existing users to Azure Container Apps, AKS or App Service.

Choose based on how much operations work you want to keep. If the honest answer is "none", a Git-based platform is the right fit.

Deploying Spring Boot on Antryk#

Antryk is a managed cloud platform built for this workflow. You connect your GitHub repository and deploy Spring Boot with no Dockerfile and no configuration needed. The install and build commands are detected automatically, and you can change them if you want. Your app runs with the fixed command java -jar /app/app.jar, so build a runnable jar and pass any JVM flags through the JAVA_TOOL_OPTIONS environment variable. Antryk also detects your app's port automatically, even if you never set one.

Antryk supports Java 8, 11, and 17 through 27, with instance memory from 500 MB up to 16 GB. Health checks drive automatic rollback: if a new release does not come up healthy, Antryk rolls back to the last stable version. You can also roll back to any previous commit yourself. For heavy background jobs, you can run a separate Java process on Antryk's Background Workers. You set your own environment variables, attach any managed database, and add a custom domain by adding the DNS record Antryk gives you and clicking verify. Micronaut apps are supported too.

[Follow the step-by-step Antryk Spring Boot deployment tutorial →]

Frequently asked questions#

Can I deploy Spring Boot without a server? Yes. A managed platform runs the servers for you. You connect your GitHub repo, add environment variables and deploy. You never log in to a machine.

Do I need a Dockerfile to deploy Spring Boot? Not on every platform. Some detect Maven or Gradle and build the jar automatically. Others expect a Dockerfile. Check before you choose.

How much memory does a Spring Boot app need? As a starting point, give a small API at least 1 GB, then watch real usage. Set -XX:MaxRAMPercentage=75.0 so the JVM uses most of the memory you pay for.

How do I pass JVM options when the start command is fixed? Set the JAVA_TOOL_OPTIONS environment variable. The JVM reads it automatically when it starts.

Which Java version should I use? Use a current long-term support version such as 21 or 25 for new projects. Spring Boot 3 and later require at least Java 17.

How do I run Flyway or Liquibase migrations on deploy? They run automatically when the app starts. Write backward-compatible migrations so a rollback does not break the old code.

Does rolling back undo my database changes? No. A rollback restores earlier code, not earlier data. That is why you add columns in one release and remove old ones in a later one.

How do I add a custom domain? Add the domain in your platform, create the DNS record it shows you at your domain provider, verify it, then choose one canonical address and redirect the other.

Does this work for other JVM frameworks? Any framework that builds a runnable jar can use the same approach. Micronaut is one example, and it is supported on Antryk.

#Spring Boot#Spring Boot Deployment#GitHub Deployment#Serverless Deployment#Cloud Deployment#Java Application Deployment#CI/CD Pipeline#DevOps Automation#GitHub Actions#Automated Deployment#Cloud Hosting#Server Management#Spring Boot Hosting#Java Development#Continuous Integration#Continuous Deployment#Application Hosting#cloud infrastructure#Deployment Automation#antryk
Share:

MuthuSelvi

SEO Executive

Muthuselvi R is an SEO Executive specializing in SEO, content optimization, keyword research, technical SEO, and organic growth strategies. She enjoys creating search-focused content that helps businesses improve visibility, reach the right audience, and grow online.

On This Page

  • What "without managing servers" actually means
  • Step 1: Get your Spring Boot app ready
  • Step 2: Connect your GitHub repository
  • Step 3: Set your environment variables
  • Step 4: Connect a managed database
  • Step 5: Get JVM memory right
  • Step 6: Run database migrations safely
  • Step 7: Health checks and automatic rollback
  • Step 8: Add your custom domain, HTTPS and redirects
  • Step 9: Run scheduled jobs without duplicates
  • Common first-deploy errors and how to fix them
  • Which deployment approach fits you?
  • Deploying Spring Boot on Antryk
  • Frequently asked questions

Related Articles

web-hosting-price-comparison-2026-6-platforms-compared-image
16 min

Web Hosting Price Comparison 2026: 6 Platforms Compared

Compare web hosting price in 2026 across Antryk, Render, Railway, DigitalOcean, Northflank, and Voroa. Explore plans, resources, and billing.

MuthuSelviOct 23, 2026
How to Deploy a Laravel App from GitHub Without Managing Servers
11 min

How to Deploy a Laravel App from GitHub Without Managing Servers

Learn to deploy a Laravel app from GitHub without managing servers: production setup, env vars, migrations, queue workers, scheduler, domains and rollbacks.

MuthuSelvi