Runtime
OpenJDK 21
Framework
Spring Boot 3.5
Database
MariaDB 11.4
Process
systemd (fat JAR)
Start Building (Quickstart)
- SSH:
ssh root@172.235.194.159 - Upload code via SFTP / FileZilla / Cyberduck: host=
172.235.194.159, user=root, target=/opt/myapp_springboot/— includegradlew,gradle/, andbuild.gradle(ormvnw,pom.xml). - Ownership & permissions:
chown -R appuser:appuser /opt/myapp_springboot→chmod +x /opt/myapp_springboot/gradlew(SFTP often drops the +x bit.) - Build (Gradle):
sudo -iu appuser→cd /opt/myapp_springboot→./gradlew clean bootJar -x test— Maven? use./mvnw -DskipTests packageand updateExecStartin the unit file to point attarget/*.jar. - Restart:
exit→systemctl restart myapp_springboot
Operate (root)
Service status
systemctl status myapp_springbootApp logs
journalctl -u myapp_springboot -fHealth
curl http://127.0.0.1:8080/actuator/healthDB env
sudo cat /etc/myapp_springboot/envReference (paths & configs)
Runtime
OpenJDK 21 (Spring Boot 3.x requires JDK 17+)Build toolGradle wrapper (
./gradlew) is preinstalled. Maven (./mvnw) is NOT preinstalled — for a Maven project, upload your own mvnw + .mvn/ + pom.xml via SFTP, then build with ./mvnw -DskipTests package (JAR will land at target/*.jar — update systemd ExecStart accordingly).JAR location
/opt/myapp_springboot/build/libs/*.jar — executable fat JAR; the *-plain.jar variant is skipped.Service file
/etc/systemd/system/myapp_springboot.service (User=appuser, WorkingDirectory=/opt/myapp_springboot)App config
/opt/myapp_springboot/src/main/resources/application.properties (or application.yml)DB env file
/etc/myapp_springboot/env — loaded into systemd via EnvironmentFile=. Read by Spring as DATABASE_URL / DB_USER / DB_PASSWORD env vars.App port
8080 (Spring Boot embedded Tomcat); Nginx reverse-proxies :80 / :443 → :8080JVM optsedit the unit file:
Environment="JAVA_OPTS=-Xmx512m" and change ExecStart to /usr/bin/env java $JAVA_OPTS -jar /opt/myapp_springboot/build/libs/*.jarProfileadd
SPRING_PROFILES_ACTIVE=prod to /etc/myapp_springboot/env, or pass --spring.profiles.active=prod in ExecStart.Redeployupload new source →
./gradlew clean bootJar -x test as appuser → systemctl restart myapp_springboot as root.