All Projects → CT83 → The-Overly-Complicated-Random-Number-Generator

CT83 / The-Overly-Complicated-Random-Number-Generator

Licence: other
An Overly Complex Random Number Generator, created to demystify how containers work.

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Dockerfile
14818 projects
Mako
254 projects
shell
77523 projects

Projects that are alternatives of or similar to The-Overly-Complicated-Random-Number-Generator

ampjucks
Boilerplate and base project to create static websites with AMP, Nunjucks and Gulp
Stars: ✭ 18 (-28%)
Mutual labels:  example-project, example-app
angular-seo
Angular 13 Example SEO Search engine optimization + PWA + SSR + Lazyloading
Stars: ✭ 58 (+132%)
Mutual labels:  example-project, example-app
angular-ssr
Angular 14 Example SSR (Server side rendering)
Stars: ✭ 92 (+268%)
Mutual labels:  example-project, example-app
yii2-realtime-chat-example
Yii2 simple realtime chat with websocket.io
Stars: ✭ 17 (-32%)
Mutual labels:  example-project, example-app
redis-developer.github.io
The Home of Redis Developers
Stars: ✭ 28 (+12%)
Mutual labels:  redis-server, redis-client
SplashScreenExample
How to implement a Splash Screen in ReactNative
Stars: ✭ 14 (-44%)
Mutual labels:  example-project, example-app
angular-routing
Angular 13 Example Routing
Stars: ✭ 21 (-16%)
Mutual labels:  example-project, example-app
Godot tutorials
Code and examples for KidsCanCode Godot Tutorials.
Stars: ✭ 119 (+376%)
Mutual labels:  example-project, tutorial-code
Wordpress Plugin Boilerplate Tutorial
Tutorials and Examples for WordPress Plugin Boilerplate, a foundation for WordPress Plugin Development.
Stars: ✭ 232 (+828%)
Mutual labels:  example-project, tutorial-code
Angular9 Example App
Angular 13 Example App + Angular CLI + i18n + GraphQL
Stars: ✭ 1,769 (+6976%)
Mutual labels:  example-project, example-app
redis-patterns-console
An interactive (and reactive) console to try and go into the deep of Redis and its patterns!
Stars: ✭ 22 (-12%)
Mutual labels:  redis-server, redis-client
bookshelf
My GraphQL playground
Stars: ✭ 64 (+156%)
Mutual labels:  example-project, example-app
angular-httpclient
Angular 15 Example HttpClient
Stars: ✭ 21 (-16%)
Mutual labels:  example-project, example-app
docker-compose-laravel
A Docker Compose setup for Laravel projects.
Stars: ✭ 23 (-8%)
Mutual labels:  docker-compose-template
NLP Quickbook
NLP in Python with Deep Learning
Stars: ✭ 516 (+1964%)
Mutual labels:  tutorial-code
racket-redis
Fast, idiomatic Redis bidings for Racket.
Stars: ✭ 30 (+20%)
Mutual labels:  redis-client
ARKitImageRecognition
ARKit 1.5 - Image Recognition Demo
Stars: ✭ 34 (+36%)
Mutual labels:  tutorial-code
Weekly-Challenge-2022-Swift
Retos semanales de la comunidad MoureDev para practicar Swift & iOS
Stars: ✭ 328 (+1212%)
Mutual labels:  tutorial-code
node-redis
A high-performance Node.js Redis client.
Stars: ✭ 15,783 (+63032%)
Mutual labels:  redis-client
spring-boot-demo
使用spring-boot的简单代码库,方便以后copy代码
Stars: ✭ 24 (-4%)
Mutual labels:  tutorial-code

The-Overly-Complicated-Random-Number-Generator

Build Status

This is an Overly Complex Random Number Generator, created to demystify how containers work.

How to Run?

Easy peasy lemon squeezy. 🍋💦

  1. docker-compose up --build

  2. Visit localhost

Below is an excerpt from my Blog Post about this.

Demo

  1. User sets a Random Seed
  2. Clicks Generate a Random Number
  3. Random Number is generated

Prerequisites

  • You have an understanding of Docker and Docker Compose
  • You have heard about Python, React and Redis

Aim

  • To illustrate how containerization actually looks in the wild
  • We will be skipping how the actual Python, JavaScript Apps work, as we want to focus on containerization here, you can find all of the code on Github - CT83/The-Complicated-Simple-Container-App

Architecture

  1. Nginx Proxy - Exposed on port 80, Manages networking
  2. React Dev Server - Accepts Input, Supports Live Reloading, Replaced with Nginx in Production
  3. Flask Server - Serves the API
  4. Redis Cache - To maintain the Task Queue
  5. Python Worker - Uses specified Seed to Generate Random Number, stores it in DB
  6. Database - PostGreSQL DB to store generated random numbers

Working

  1. React App is served, user inputs the random seed.
  2. Seed is sent to the Flask API through a POST
  3. Task is added to Queue
  4. Worker picks up the task, generates a random number and store result in the database
  5. Result is returned to the user.

Configuration

Here, is the minified docker-compose-prod.yml

version: "3.3"

services:
  proxy:
    container_name: proxy
    build: 
      ...
    ports:
      - 80:80

  database:
    container_name: database
    build: database/.
    volumes:
      - ./database/db_data:/var/lib/postgresql
    ...

  client:
    container_name: client
    build: 
      ...
    environment:
      ...

  api:
    container_name: api
    build: 
    ...
    volumes:
      - ./api:/app

  worker:
    container_name: worker
    build:
    ...

  redis:
    container_name: redis
    build: 
    ...

You can find the development docker-compose.yml here. It even supports Live Reloading for both, the Flask and React Container!

Next Steps

You could now move on to trying to push the built images to DockerHub, or add TravisCI integration!

Inspirations

Stephen Grider in his Udemy Course Docker and Kubernetes: The Complete Guide built an overly complex simple app, that greatly inspired me.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].