- DigitalOcean
- Linux
- Java
- Gradle
- Setup and configure a server on DigitalOcean
- Create and configure a new Linux user on the Droplet (Security best practice)
- Deploy and run Java Gradle application on Droplet
$ ssh -i .ssh/digitalocean root@137.184.120.168
~# apt update
~# apt upgrade
~# apt install openjdk-8-jre-headless
~# adduser application
~# usermod -aG sudo application
~# su - application
$ mkdir .ssh
$ sudo vim .ssh/authorized_keys
- copy the public ssh key into the newly created
authorized_keys
file
gradle build
scp -i /home/<user>/.ssh/digitalocean build/libs/devops-module5-project.jar root@137.184.120.168:/home/application
$ ssh -i .ssh/digitalocean application@137.184.120.168
$ java -jar devops-module5-project.jar &
...
2023-10-11 20:55:35.183 INFO 26741 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 7071 (http)
...
$ ps aux | grep java
$ netstat -lpnt