/spring-micro-websocket-chat

Microservice chat application. Based on Spring Cloud / Netflix / Java / Docker / Docker Compose / Webflux / JWT / RabbitMQ / MySql / MongoDB

Primary LanguageJavaApache License 2.0Apache-2.0

Microservice chat application

CircleCI

Repository with configuration files

Repository with front-end

This project creates a complete micro service chat system in Docker containers. The services are implemented in Java using Spring, Spring Cloud and RabbitMQ. It uses 5 microservices:

  • Mail service
  • Websocket service
  • Messages storing service
  • Chat profiles service
  • Auth service

Technologies

  • Eureka
  • Spring Cloud Gateway
  • Spring Cloud Config Server
  • MySql and MongoDB
  • WebFlux
  • RabbitMQ (AMQP + STOMP)

Requirements:

Diagram

Steps to run in docker

1. Clone repository

git clone https://github.com/kubAretip/spring-micro-websocket-chat.git

2. Configuration time

  • In this moment repositories with configuration files is public so you must remove configuration for privates repositories.
  • Go to config-server/src/main/resources open bootstrap-docker.yml and remove properties ignore-local-ssh-settings: , host-key-algorithm:, host-key: and private-key:
  • Go to docker folder and open .env.docker. Next fill REPO_BRANCH=master and GIT_REPO_URI=. Link to config repo below: https://github.com/kubAretip/spring-micro-websocket-chat-config
  • Go to docker folder and open docker-compose-docker.yml. In services section find config-server and remove environments variables: HOST_KEY: ${KNOWN_HOST_KEY}, PRIVATE_KEY: ${PEM}

3. Package

  • In spring-micro-websocket-chat run mvn clean package

4. Run

  • Inside docker folder run docker-compose -f docker-compose-docker.yml --env-file .env.docker up -d and ...
  • ... wait a moment, docker compose builds the docker images and runs them.
  • You can access the application at http://localhost:8080
  • Documentation with application endpoints is available on http://localhost:8080/swagger-ui.html PS-1 If you don't see anything in Swagger UI, you must restart the gateway. It's happen because gateway has been in ready state before services, so gateway can't see Swagger endpoints from services. You can use Actuator to restart the gateway (POST http://localhost:8080/actuator/restart).