Giter VIP home page Giter VIP logo

spring-redis-websocket's Introduction

spring-redis-websocket

Heroku Status DockerHub Status License

Multi-instance Reactive Chat App using Spring Boot WebFlux and Redis Pub/Sub

Scalable Java 11 Spring Boot WebFlux Chat Application to demonstrate use of Reactive Redis Pub/Sub using Reactive WebSocket Handler, without using any external Message Broker like RabbitMQ to sync messages between different instances.

Deploy to Heroku

The older non-reactive servlet based spring-redis-websocket application can be found in below links:

  1. Spring-Boot 2.3: Java-11 version
  2. Spring-Boot 1.5: Java-8 version

Deploy to Play-with-Docker

Ctrl + Click this button to deploy multiple instances of the spring-redis-websocket load balanced by NGINX:

Deploy to PWD

Installation and Configuration

Pre-requisite:

Install and run Redis locally or on Docker.

To run Redis in Docker:

$ docker run -d -p 6379:6379 -e REDIS_PASSWORD=SuperSecretRedisPassword bitnami/redis:4.0.11-r6
Clone repo:
$ git clone https://github.com/RawSanj/spring-redis-websocket.git

Build and Run the applications:

Build and run the spring-redis-websocket application:

$ cd spring-redis-websocket

$ mvn clean package

$ mvn spring-boot:run

Run in Docker

Build and run the spring-redis-websocket locally in Docker:

Build the JAR file:

$ mvn clean package

Build docker image:

$ mvn spring-boot:build-image

Run docker image:

$ docker run -d -p 8080:8080 \
$ rawsanj/spring-redis-websocket

Run multiple instance using docker-compose locally

Run multiple instances of spring-redis-websocket locally load balanced via Ngnix connected to redis container in Docker:

$ cd src/main/docker
$ docker-compose up

Or try Play with Docker to quickly setup Docker and run in browser:

  1. Click Create Instance to quickly setup Docker host.
  2. Install git by running:
$ apk add git --no-cache
  1. Clone the repository:
$ git clone https://github.com/RawSanj/spring-redis-websocket.git
  1. Run multiple instances of spring-redis-websocket:
$ cd spring-redis-websocket/src/main/docker
$ docker-compose up

Run in Kubernetes

Assuming you have a Kubernetes Cluster up and running locally:

$ kubectl apply -f src/main/k8s

Or try Play with Kubernetes to quickly setup a K8S cluster:

  1. Follow the instructions to create Kuberenetes cluster.
  2. Install git by running:
$ yum install git -y
  1. Clone the repository:
$ git clone https://github.com/RawSanj/spring-redis-websocket.git
  1. Run multiple instances of spring-redis-websocket load balanced by native Kubernetes Service. All instances connected to a single Redis pod.
$ cd spring-redis-websocket
$ kubectl apply -f src/main/k8s

Tech

spring-redis-websocket uses a number of open source projects:

  • Spring Boot - An opinionated framework for building production-ready Spring applications. It favors convention over configuration and is designed to get you up and running as quickly as possible.
  • Spring Data Redis - Spring Data Redis provides easy configuration and access to Redis from Spring applications.
  • Redis - Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
  • Bootstrap - Bootstrap is an open source toolkit for developing with HTML, CSS, and JS. Custom Bootstrap theme - Bootswatch Sketch.
  • Docker - Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.
  • NGINX - NGINX is High Performance Load Balancer, Web Server, & Reverse Proxy.
  • Kubernetes - Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.

License

Apache License 2.0

Copyright (c) 2020 Sanjay Rawat

spring-redis-websocket's People

Contributors

rawsanj 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.