Giter VIP home page Giter VIP logo

rev-hello-world's Introduction

rev-hello-world

This repository contains a Flask application designed to be deployed both locally and in a Kubernetes cluster. The infrastructure components such as Kubernetes clusters, VPC, networking, and security groups are assumed to be managed separately, potentially using Terraform or other IaC tools, and are not included in this repository. The Flux and Helm files are just a starting point and should be customized to fit the specific requirements of the target environment.

Index

  1. Local setup
    1. Raw setup
    2. Docker setup
  2. Cloud setup
    1. Behaviour
    2. Cloud architecture diagram
  3. Next steps

Local setup

Raw setup

Clone repo:

git clone https://github.com/dtdom/rev-hello-world.git
cd rev-hello-world

Create a virtual environment and activate it:

python3 -m venv venv
source venv/bin/activate

Install the dependencies:

pip install -r requirements.txt

Run the app:

flask run

Docker setup

Build the image:

docker build -t rev-hello-world .

Run the image:

docker run -p 5000:5000 rev-hello-world

Cloud setup

This solution has been designed to be deployed in a K8s cluster hosted in AWS. This cluster should have at least the following components:

  • Load balancer controller
  • Helm controller
  • Prometheus operator
  • A collector like Alloy already in place

For the remote deployment, it also expects a database to be available.

Behaviour

  1. When you push code to the main branch of the Git repository, the following automated process begins:
  2. The GitHub Actions Pipeline get executed:
    1. Checkout and python setup
    2. Lint Code
    3. Run Tests: The code is tested using unittest.
    4. Build the imnage with buildx or kaniko, etc
    5. Push image to ECR.
  3. FluxCD:
    1. When a change is detected (e.g., a new Docker image), FluxCD updates the Kubernetes cluster with the new manifests.
    2. The updated Docker image is deployed to the Kubernetes cluster.

Cloud arch diagram

Diagram

We are not including in the Diagram the following information:

  • Security groups and some other network configurations.
  • DNS/route53 configurations.
  • WAF, Firewall, etc.
  • K8s controllers, operator, etc.

Next steps

  1. Install Vault operator to manage the secrets in the cluster.
  2. We may discuss if one environment is enough or if we need to have a staging environment, etc.
  3. The pipeline should be improved to include more tests and checks. Using SCA and SAST tools would be a good idea.

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.