Giter Club home page Giter Club logo

code-challenge's Introduction

Code Challenge

Requirements

This project was executed using the services with the specific version listed below (on Windows 10 Pro):

  • Docker 20.10.8
  • Minikube 1.23.2
  • Java 8

How to run?

Login docker hub

With the docker installed and running, execute:

docker login

Inform your docker hub credentials and press enter.

These credentials will be used by docker in the future to upload the images to your docker hub account.

Building services containers

Run the run.sh script inside of all service folders passing the -n [USER_FROM_DOCKER_HUB]

run.sh -n thiago123789

like this:

  • Email service

cd email

./run.sh -n thiago123789

  • Bff service

cd bff

./run.sh -n thiago123789

  • Subscription service

cd subscription

./run.sh -n thiago123789

Creating Kubernetes infrastructure

First of all, we need to start the minikube

minikube start

After this, go to the Kubernetes folder and run the deploy-kubernetes.sh

./deploy-kubernetes.sh

if you want to use your own image repository from docker hub you must use -n [DOCKER_HUB_USER] flag on the previous script, like the snippet below:

./deploy-kubernetes.sh -n thiago123789

⚠️ If you don't inform your docker hub user this script is gonna use thiago123789 by default

Testing load balancer locally

To test load balancer locally you need to use minikube tunnel running:

minikube tunnel

After this run:

kubectl get svc

The result will be something like this:

image

Now you need to use the external-ip to open the bff's swagger (on windows you can use localhost instead of 127.0.0.1)

So put on the browser the following address:

http://localhost:8090/swagger-ui/index.htm

The swagger ui should appear with the endpoints available on bff service

⚠️ Can take some time until the swagger works after run minikube tunnel

Architecture

arch-1

The image above shows the architecture and how the services communicate between them.

All the operations from the BFF to the Subscription Service that will cause database change will be made using the RabbitMQ service

RabbitMQ

The connection string and credentials to access the RabbitMQ are configured on the Kubernetes secrets (secrets.yaml)

Email Service

The email service is using Gmail to send the emails. The credentials used are also configured on Kubernetes secrets.

Subscription Service

The communication between this service and the email service is made using RabbitMQ.

The requests related to adding new subscriptions and unsubscribe are received through RabbitMQ from the BFF service.

Improvements opportunities

  • add some cache service on bff get endpoints (using something like Redis)
  • improve the logging
  • add some service to help with trace requests
  • improve swagger docs
  • improve unit tests

code-challenge's People

Contributors

thiago123789 avatar

Watchers

 avatar

code-challenge's Issues

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.