Deploying Spring Boot Project to VPS: Step by Step Guide
How to deploy your Spring Boot application to your own VPS? Comprehensive guide comparing 5 different ways to JAR upload, Git-based build, systemd, Docker and Kubernetes.
Although launching Spring Boot projects is a relatively simple process, establishing a sustainable deployment pipeline is a tiring task for most developers. It takes 5 minutes to upload the JAR file to the server; but adding systemd service, nginx reverse proxy, Let’s Encrypt SSL, automatic restart, log rotation, health check to it may take 2-3 days.
In this guide, we will compare 5 different ways to deploy a Spring Boot project to VPS; Finally, we will show you how to do it via VDS Panel for the fastest way.
Preparation: A clean VPS
For any method, a minimum of 2 vCPU + 4 GB RAM + Ubuntu 22.04+ is sufficient. If your Spring Boot application does not use a large heap, it will also run on a VPS with 2 GB RAM.
Let’s install the necessary packages on the server:
P0
Method 1: JAR + systemd (manual, classic)
The most basic method. You copy the JAR to the server with scp:
P1
You write systemd unit ( P0 ):
P2
You start the service:
P3
You add the Nginx reverse proxy config, get a Let’s Encrypt certificate, install log rotation…
Pros: Complete control, no dependencies.
Cons: Same ritual for every deployment. There’s a lot of human error. Updating takes time.
Method 2: Containerize with Docker
You add a Dockerfile to the Spring Boot project:
P4
You build, push to the docker registry, and pull + run on the server.
Pros: Portability, version control, easy rollback.
Cons: Docker registry management, image size optimization, still nginx + SSL manual.
Method 3: Docker Compose
If there are multiple services (DB, Redis, etc.) Docker Compose simplifies things. But you still need to SSH into the server and run P0. You install CI/CD yourself.
Method 4: Kubernetes (K3s)
Professional option. You write your Deployment, Service, Ingress manifests and apply them to the cluster. Scalable, rolling updates, built-in health checks.
Pros: Industry standard, scalable, resilient.
Cons: The learning curve is steep. YAML too. Too complex for a simple app.
Which one should we learn?
Knowing the basics of systemd, Docker and Kubernetes is valuable in a developer’s career. But you don’t have to use them for every deployment. Two different goals: to learn and to be productive.
Method 5: One click deploy with VDS Panel
All 4 methods above work, but they all have labor costs. If your dev team’s time is valuable, automation can take over much of this process.
01
Add project to panel
If GitHub is connected, the repo is selected from the list; If not, the URL is entered. There is also a JAR upload option.
02
Automatically detect build strategy
If there is pom.xml, Maven is used, if there is build.gradle, Gradle is used, and if there is Dockerfile, Docker build is used.
03
Add automatic database (optional)
You tick the PostgreSQL box; panel generates DB + user + password, DATABASE_URL is injected into env.
04
Connect a custom domain
Point the DNS A record to the server IP; The panel automatically obtains the Let's Encrypt certificate.
05
Press Deploy
Panel starts parallel pipeline: build, DB, SSL, nginx, health check. Live in ~90 seconds.
~90sec
git push to live
Build + DB + SSL + nginx are all parallel. After the first deployment, it becomes even shorter with cache.
Each subsequent deploy, git push
After the first deployment, with each push to GitHub, the panel captures the webhook and runs the above steps again. Rollback is also a click: it says “Restore” to the previous successful deployment.
JVM parameters, health check, log
From the panel interface:
JVM parameters ( P0 , P1 , P2 ) are determined
Health check endpoint (P3) is defined, the interval is determined
Log rotation is automatically active (5 files, 100 MB each)
Memory/CPU limit is set on a project-by-project basis
Environment variables are stored securely (not written to file)
Nexus + SonarQube integration
Two common needs that come with Spring Boot projects: artifact repository and code quality analysis. VDS Panel’s systemServices module provides these two in a click-to-install manner:
Nexus Repository Manager, JARs are pushed here, your Maven P0 is automatically updated
SonarQube, code quality analysis runs on every build, the report is integrated into the panel
~2 hours
Manual Nexus + SonarQube
Take and configure a Docker image for Nexus
Set volume + port + reverse proxy
Create admin password, define repository
Same process for SonarQube
Edit Maven settings.xml manually
connect webhook
~2 minutes
Click-to-install from Panel
'Install' Nexus from the Services tab
'Install' SonarQube from the Services tab
settings.xml is automatically updated
Every build is sent to SonarQube
Reports can be accessed from the panel
Installing these two tools manually is a job of at least 2 hours. 1 minute by going to the “Services” tab from the panel and clicking +.
Conclusion
We have seen five methods to deploy Spring Boot to VPS. It is necessary to learn the first four, it is still valuable to know systemd, Docker and Kubernetes in a developer’s career. But you do not have to use this information for every deployment.
This is exactly the purpose of VDS Panel: to speed up your workflow by keeping the surface simple, without hiding the technology behind. To go live with your Spring Boot projects git push, you can complete the panel installation in 8 minutes.