Code Monkey home page Code Monkey logo

awesome-blog's Introduction

Awesome blog

TravisCI Build

This is a blog site designed with microservices architecture using Spring Cloud Netflix features, Kotlin as a main server side language and Angular for user interface parts.

Client npm dependencies status:

dependencies Status devDependencies Status

Technology stack
  • Spring Framework 5 with Webflux/Reactor and Netty server
  • Spring Boot 2.0
  • Spring Cloud Netflix 2.0
  • Spring Webflux Security with JWT
  • Kotlin 1.3
  • Angular 7
  • Gradle 5 with Kotlin Script and jUnit 5
  • Docker
Prerequisites
  1. Node 8+
  2. Yarn
  3. JRE 8+
  4. Docker

Microservices architecture:

diagram

  • Config Server: A Spring Boot application which provides configs (yml files) to all other services. Should be run first.
  • Service Discovery: A Spring Boot application with embedded Service Discovery Server (Eureka server). Each other services except Config Server are registered in it and can access each other by names instead of host-port combination using Api Gateway Router service. Should be run second.
  • Frontend: A Spring Boot application with Angular parts. Contains embedded Api Gateway Router (Zuul), Client Side Load Balancer (Ribbon) and Service Discovery Client (Eureka client) which help to redirect requests to Api service instances registered in Service Discovery Server.
  • API: A Spring Boot application with backend information for the Frontend. Includes Spring Security parts to provide Json Web Tokens and validate them.

The diagram is created with the help of draw.io

How to run

First of all the project:

   ./gradlew clean build

This also creates a Docker image for every application

Local environment

  1. Set environment variables:

    SPRING_PROFILES_ACTIVE=local,native
    
  2. Run Config Server instance:

    ./gradlew config-server:bootRun
    

    Check that it's running at http://localhost:9000/actuator/health

  3. Run Service Discovery instance:

    ./gradlew service-discovery:bootRun
    

    Check that it's running at http://localhost:9001

  4. Run API instance:

    ./gradlew api:bootRun
    

    Check that it's running at http://localhost:8081/api/echo

  5. Run Frontend instance:

    ./gradlew frontend:bootRun
    

    Check that it's running at http://localhost:8082

Docker compose

  1. Remove containers from previous runs:

     docker-compose rm
    
  2. Run everything:

     docker-compose up
    

    Check it running at http://localhost:8082

Docker containers

  1. Remove named containers from previous runs:

     docker rm {config,discovery,api,frontend}
    
  2. Create a custom bridge network if it's not created:

     docker network create --driver bridge awesome-network
    
  3. Run the config server container with mounted logs and configs directories:

     docker run --name config --net awesome-network -v $(pwd)/logs:/logs -v $(pwd)/configs:/configs hiper2d/config  
    
  4. Run the service discovery container:

     docker run --name discovery --net awesome-network -v $(pwd)/logs:/logs hiper2d/discovery
    
  5. Run the backend container:

     docker run --name api --net awesome-network -v $(pwd)/logs:/logs hiper2d/api
    
  6. Run the frontend container exposing the 8082 port:

     docker run --name frontend --net awesome-network -p 8082:80 -v $(pwd)/logs:/logs hiper2d/frontend  
    

    Check it running at http://localhost:8082

Elk Docker containers

    docker run --rm --name elasticsearch --net awesome-network -p 9200:9200 -p 9300:9300 docker.elastic.co/elasticsearch/elasticsearch:6.5.4
    docker run --rm --name kibana --net awesome-network -p 5601:5601 -v $(pwd)/elk/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml docker.elastic.co/kibana/kibana-oss:6.5.4
    docker run --rm -it --name logstash --net awesome-network -p 5000:5000 -p 9600:9600 -v $(pwd)/elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml -v $(pwd)/elk/logstash/pipeline:/usr/share/logstash/pipeline -v $(pwd)/logs:/logs docker.elastic.co/logstash/logstash:6.5.4

Roadmap

  • add Docker Compose
  • add Logstash, Elasticsearch, Kibana stack for advanced logging
  • add Mongodb to the Api service
  • start creating user interfaces

awesome-blog's People

Contributors

hiper2d avatar naxa777 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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