For tasks, checkout tasks.md
In this task, we will create a Google Cloud Storage bucket using Terraform.
-
Provider Configuration:
- The provider information is defined in the Task-1/provider.tf file.
- A service account is required for Terraform to access Google Cloud services.
- Once the service account is created, download the Task-1/keys.json file.
- This Task-1/keys.json needs to be referenced in the provider section of Terraform.
-
Bucket Creation:
- The bucket creation code is provided in the Task-1/main.tf file.
-
Steps to Provision the Bucket: Run the following commands to initialize and apply the Terraform configuration:
terraform init terraform apply
I just tried to create storage connection as I don't have experience with GO. I am explaining the steps here:
- Include the Google Cloud Storage Client Library
go get cloud.google.com/go/storage
This will automatically add the cloud.google.com/go/storage package to the go.mod file. For reference, I have manually added it to go.mod
-
Initialize the GCS Client
-
Provide the Bucket Name Used the bucket name that was created earlier using the Infrastructure as Code (IAC) tool (Terraform). main.go
-
Create an Object with Airport Name and Image
-
Generate the Public URL for the image main.go
A Dockerfile has been created to containerize the application in the Task-3/Dockerfile
From that, we can create the image using the following command:
docker build -t GoApplication .
We can run the image as a container using the command below:
docker run -d GoApplication
Created deloyment.yaml and service.yaml file in Task-4 for deploy the application in kubernetes.
For GCP perspective we can use Google Cloud Load Balancer and Traffic Director. For this we can follow the below step:
- Deploy the Services on Google Kubernetes Engine (GKE)
- Setup Load Balancing with Traffic Director
We can use Jenkins, github action or any other CI/CD tool for deploy the app to kubernetes I have just added basic github action CI/CD pipeline in (.github/workflows/deploy.yaml) file.
Note: Currently, the pipeline only contains the basic steps for deployment. Further configurations are needed, such as: For deploying in our server we need to create self hosted runner in our server. Also we need to configure some more things in pipeline like login in dockhub, kubernetes access etc.
We can set up basic monitoring using Prometheus and Grafana. Configure Prometheus to scrape metrics from the app and use Grafana for visualization.