Firstly, I’m not a front-end developer – nor do I aspire to be. This project first started out as an exercise to get more familiar with Golangs/Go’s net/http module. Creating a janky web app (with probably the worse UI known to humankind) was just a means to an end (see below evidence) I found an awesome API (https://the-one-api.dev) that allowed me to explore my Lord of the Rings obsession whilst exploring Go’s net/http package…
Once I’d created the app, I decided to package it as a container and just kind of archive it. Before I knew it I was experimenting with ways to host/deploy it. Obviously, the cloud was a no-brainer, and what better cloud platform than OCI?
OCI’s free tier gives access to some great always free resources (including 2 free AMD compute instances) for you to lab, study, and experiment with. I highly recommend checking it out. https://www.oracle.com/uk/cloud/free/
If you are interested in the GO source code for my webapp then it’s in the below repository along with the dockerfile:
https://github.com/thecraigus/tolkienwebapp
The actual docker image is over at:
https://hub.docker.com/repository/docker/clcartlidge/tolkienweb/general
The terraform configuration file manages the application lifecycle, provisioning and destroying the resources as required. Below is a breakdown of the elements of this stack. Again, all are available on OCI free tier.
- 2 x AMD Micro VM Compute Instances (Running Oracle Linux + Docker) Spread Across 2 fault domains.
- 1 x Load Balancer
- 1 x Load Balancer Listener
- 1 x Backend-Set
- 1 x VCN
- 2 x Subnets (one web tier and one lb tier.)
The Terraform configuration is avalable at :
https://github.com/thecraigus/tolkien-oci-terraform/blob/master/tolkien-portal-ha.tf
The OCI Terraform provider is very well documented and there are lots of pre-written examples you can use to get yourself up and running in no-time.
Time to run terraform:
Plan:
Apply:
The remote-exec provisioner allows us to bootstrap the compute instances to install docker, pull the image from dockerhub and start the application!
Lets check out our newly created resources!
Great, our 2 free compute instances are up and running.
And so is our OCI Load Balancer.
Let’s browse and give our app a road test.
Hit search
Thanks for reading guys.
Happy Labbing!