Giter Club home page Giter Club logo

weather-golang-app's Introduction

weather-probe

Simple demo backend that checks weather in London via OpenWeatherAPI, CA on "/" path deployed to EKS in GitOps way.

Overview

The application is called weather-backend and is written in Golang, supports several paths: / - returns HTML with current weather in London, CA

~ ❯ curl development.s0rl0v.com             ✘ INT

Temperature in London, Canada is 5.990000 C <br/>
~ ❯

/ping - returns PONG /health - returns JSON with status /metrics - http total requests, http request codes and golang metrics exposed by prometheus sdk /version - build metadata

Deployment instructions for EKS cluster with NGINX ingress, external secrets and argocd could be found here.

THere is GitOps repository for ArgoCD with manifests to deploy and continuously sync applications.

The app is containerized and pushed to ECR registry via GitHub Actions pipeline, then ArgoCD Image Updater (that continiously monitors application ECR repo) modifies the image to the new one for corresponding environment, thus triggering rollout.

Branching strategy

This app uses trunk based development - main branch for development, release/* branches for releases. The artifacts built from main branch are deployed to development environment, release/* branches - to staging and tagged changesets trigger deployment to production environment.

Build

# go mod download
# go run -ldflags "-X main.version=1.0.0 -X 'main.build=$(date)' -X main.version=1" ./main.go

Deployment

Prerequisites

OpenWeather API key AWS programmatic access

Steps

  1. Navigate to infrastructure repo and deploy according to the provided README:

NOTE: Write down the output - this will come handy in next steps.

  1. Navigate to ArgoCD deployments repo and review IAM roles, repositories URLs (if you want to use different that defined here), helm values (especially ingress for weather-backend), replace IAM roles in annotations (search by arn) with values aquired in step 1.

  2. Add your API key to SSM:

aws ssm put-parameter --name "/sorlov/weather/OWM_API_KEY" --type "String" --value "******"
  1. Navigate to ArgoCD deployment repo and apply manifests README.

  2. Point application DNS name to nginx controller:

k get svc -n ingress-nginx ingress-nginx-controller
  1. Test deployment by commiting something to the repo.

Cleanup

  1. Remove all the ArgoCD applicatons first (execute from ArgoCD deployments repo):
cd apps-registry && kustomize build | k delete -f-
  1. Execute terraform destroy.

weather-golang-app's People

Contributors

s0rl0v avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.