In this lab you will open up some ports on a compute instance to make a web server accessible from anywhere in the world and you will deploy a Micronaut + GraalVM application to that VM.
Estimated Lab Time: 15 minutes
- To make this available to the world, let's live dangerously and open a port.
- Open a port in the security list in Instance's network. On the VM details page, click on the 'subnet' link:
- Click "Security Lists"
- Click "Default Security List"
- Click "Add Ingress Rules"
- On the "Add Ingress Rules" dialog, add two rules:
- You will also need to open up the VM's firewall:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp sudo firewall-cmd --permanent --zone=public --add-port=8080/udp sudo firewall-cmd --reload
- Now from any computer use a web browser and access the url http://:8080/pets
TODO Fix this
-
Before deploying, ensure the wallet exists on the VM by running the snippet produced by
setup.sh
that looks similar to:# run on local machine to push to VM scp -i ~/.ssh/id_oci -r /tmp/wallet opc@[VM IP Address]:/tmp/wallet
-
Build JAR with:
# run on local machine ./gradlew assemble
-
Push JAR to VM with the snippet produced by
setup.sh
that looks similar to this:# run on local machine to push to VM scp -i ~/.ssh/id_oci -r build/libs/micronaut-data-jdbc-graal-atp-0.1-all.jar opc@[VM IP Address]:/app
-
To run on the VM, SSH in and run the snippet generated by
setup.md
that looks similar to this:# run on VM to start application java -jar -DMICRONAUT_OCI_DEMO_PASSWORD [your generated password] /app/micronaut-data-jdbc-graal-atp-0.1-all.jar
- Cleanup Cleanup