Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Run microservices to automatically create and destroy OCI resources
Introduction
This is the final part of a six-part tutorial series that shows you how to deploy a temporary set of resources on an OKE cluster using Golang microservices representing the usage of OCI SDK, OCI-CLI, Resource Manager, OCI Devops and Helm to deploy and destroy Apache Airflow.
Objective
In this tutorial you will run the microservices to start the process flow to create and destroy the whole set of OCI resources.
Prerequisites
- Completion of the previous tutorial in this learning path, Part 5/6 - Create OCI DevOps pipelines for Apache Airflow and deploy it using Helm
Task 1: Set up your laptop host to invoke the microservices on OKE
In previous steps of this tutorial, you changed the bastion jump-box host /etc/hosts
file by adding the proper load balancer IP and host names for each service (go-login, go-microservice and airflow). In order to reproduce that on your local machine, you must copy those entries from bastion host jump-box to your local machine.
-
Open you bastion host jump-box shell and check the current values of the
/etc/hosts
file.cat /etc/hosts
-
Change your
/etc/hosts
file and add three lines for go-login, go-microservice and airflow just like it was added to the bastion jump-box.sudo vi /etc/hosts # Paste the copied lines from bastion host /etc/hosts file.
Note:
-
If you are a Windows user, you must add these entries here:
C:\Windows\System32\Drivers\etc\hosts
. -
For more information about how to modify hosts on Windows, see How to Edit Your Hosts File on Windows, Mac, or Linux.
-
Task 2: Call go-login and go-microservice to start the process flow for CREATION
We will go through this process flow by invoking go-login and go-microservice.
-
Open your bastion host terminal that has already been prepared with
/etc/hosts
(ips for the Load balancer).#1 - Get the TOKEN from login microservice TOKEN=$(curl -s -v -X GET http://go-login.superocilab.com/login) #2 call the service passing the TOKEN curl -H 'Accept: application/json' -H "Token: ${TOKEN}" http://go-microservice.superocilab.com/oci-init
Note: By now, all the process flow has been started, you may check the status using the following steps.
-
Open the Resource Manager, “Stack” page and check the job status.
-
Open the OKE cluster page, click “Node Pools” and check the status of “extra-node-pool” creation.
-
Open your DevOps project, click Build pipelines and check status for airflow-helm.
-
Check if the build pipeline for airflow-helm is running and waiting for the stack to be completed.
Note: Depending on the elapsed time for the new node-pool creation, this build pipeline will be in a waiting status, it may take up to 10 min depending on OCI creation backends.
-
Open your DevOps project, click Deployment pipelines and check status for “airflow-helm-deploy”.
-
-
Open your browser and open the airflow app: http://airflow.superocilab.com.
-
Note: This will only work if you have correctly set up your
/etc/hosts
file. -
The default user/password for airflow is : admin/admin
-
Task 3: Call go-login and go-microservice to start the process flow for DESTRUCTION
-
To destroy the implementation and release all resources created on OCI, run the following command.
#1 - Get the TOKEN from login microservice TOKEN=$(curl -s -v -X GET http://go-login.superocilab.com/login) #2 Invoke the destroy endpoint curl -H 'Accept: application/json' -H "Token: ${TOKEN}" http://go-microservice.superocilab.com/oci-destroy
-
You can check in your Resource Manager, Stacks for status.
Related Links
Acknowledgments
- Author - Joao Tarla (Oracle LAD A-Team Solution Engineer)
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Run microservices to automatically create and destroy OCI resources
F79812-01
March 2023
Copyright © 2023, Oracle and/or its affiliates.