/news-system

System for retrieving news from 3rd party APIs and asynchronously serving them to clients over web socket

Primary LanguageGo

news-system

A system is composed of three modules:

  1. news-collector
  1. news-presenter
  • Consume the batch of news from memphis broker
  • Expose that data over websocket with predefined port
  1. memphis-broker
  • Provides end-to-end support for in-app streaming use cases using Memphis distributed message broker.

Customization of behaviour

To customize behaviour or change config kinda values(scrape interval, switching source of news, external system credentials etc.)

Please refer to environment variables(e.g news-collector environment variables) and configuration files(e.g news-collector config file).

Testing on Docker

  1. First clone the application into your machine

git clone https://github.com/egasimov/news-system.git

  1. Make sure that docker already installed and running

docker info

  1. Use docker-compose to run the application in your machine (P:S it might take some time)

docker-compose -f ./docker-compose.yml up -d

  1. Verify containers are properly running on machine.

docker ps

alt text

  1. Open simple file in the browser, and verify it is working

open ./news-presenter/client-index.html

Testing on K8s

  1. First clone the application into your machine

git clone https://github.com/egasimov/news-system.git

  1. Make sure that kubernetes already configured and running, kubectl properly configured with k8s

kubectl cluster-info

  1. Make sure that memphis already configured and running properly

helm repo add memphis https://k8s.memphis.dev/charts/ --force-update && helm install memphis memphis/memphis --create-namespace --namespace memphis

Memphis Deployment Information

Secrets

UI/CLI/SDK root username - root

UI/CLI root Password - kubectl get secret memphis-creds -n memphis -o jsonpath="{.data.ROOT_PASSWORD}" | base64 --decode

SDK root connection token - kubectl get secret memphis-creds -n memphis -o jsonpath="{.data.CONNECTION_TOKEN}" | base64 --decode

Replace MEMPHIS_TOKEN(in k8s-deployment.yml) with value from SDK root connection token.

5.Use and apply below deployment file

kubectl apply -f k8s-deployment.yaml

6.Verify pods are properly running on machine.

kubectl get pods --namespace news-system

alt text

  1. Do port forwarding from k8s to your local machine to test it.

kubectl port-forward service/news-presenter-go-svc 8081:80 --namespace news-system

  1. Open simple file in the browser, and verify it is working

open ./news-presenter/client-index.html

Result:

alt text alt text