Skip to content

bramlak/origoss-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

origoss-task

Logo

Origoss Task

An HTTP server and its infrastructure

About This Project

This project demonstrates a complete end-to-end workflow for deploying a simple Go HTTP server with modern infrastructure practices.

Features:

  • A Go HTTP server that responds with Hello, World! at /
  • A Dockerfile for server containerization
  • A GitHub CI workflow for building and pushing the server changes to Docker Hub
  • Kubernetes manifests for deployment, service, and ingress
  • Terraform infrastructure replicating the Kubernetes resources plus some additional enhancements
  • Deployment is designed for a Minikube cluster for local development

Languages and Technologies

  • Go Server Programming Language
  • Docker Containerization
  • Kubernetes Orchestration
  • Terraform Infrastructure-as-Code
  • Minikube Local Cluster
  • GitHub Actions CI

Set Up

Prerequisites

A few things need to be installed first. Feel free to follow the official websites.

Installation

  1. Clone the repository
git clone https://github.com/your-username/origoss-task.git
cd origoss-task
  1. Start Minikube
minikube start
  1. Enable Ingress Addon

This setup uses Ingress. Enable Minikbe's ingress addon:

minikube addons enable ingress
  1. Add local domain to host list

Aquire Minikube IP and add to /etc/hosts

echo "$(minikube ip) origoss-task.local" | sudo tee -a /etc/hosts

Usage

There are a two ways to use the Minikube cluster. There are kubernetes manifest YAML files and also a terraform infrastructure.

Via Kubernetes Manifest

  1. Apply the manifests
cd kubernetes
kubectl apply -f deployment.yaml -f service.yaml -f ingress.yaml
  1. Access the server
curl origoss-task.local

Via Terraform

  1. Initialize Terraform
cd minikube-infra
terraform init
  1. Apply the infrastructure
terraform apply
  1. Access the server
curl origoss-task.local

Utilising CI

To use CI capabilities for custom development, follow these steps:

Fork The Repository

Follow the official Forking - GitHub documentation

Edit Workflow File

  1. Change the image reference to a custom one
  2. Generate Docker Hub Personal Access Token (Settings > Personal access tokens > Generate new token)
  3. Set The PAT for GitHub as DOCKER_HUB_TOKEN (Settings > Secrets and variables> Actions > New Repository Secret)

Change Image

Kubernetes Manifest

  1. Change the image reference in deployment.yaml

Terraform

  1. Create a terraform.tfvars file with the updated image reference or change the default image value in variables.tf

Trigger GitHub Action

  1. Navigate to Actions
  2. Find and choose the action from left side menu
  3. Find the This workflow has a workflow_dispatch event trigger. field and choose Run workflow
  4. Continue with the usage steps

Notes

  • Feel free to change local domain from origoss-task.local to any custom one
  • Feel free to change replica count according to custom needs
  • This approach aims to satisfy the main requirements: simplicity and efficiency. If more complexity is acceptable, a few improvements could be added:
    • AWS EKS cluster usage (possibly with additional features)
    • additional Go endpoints for Kubernetes probes if needed
    • Terraform state management backend
    • server and server image versioning
    • etc.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors