Jin Microservices

Jin microservices is a complete microservice demo based on PHP language + hyperf microservices framework
Alternatives To Jin Microservices
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nats.go4,4601151,3363 days ago168September 16, 202297apache-2.0Go
Golang client for NATS, the cloud native messaging system.
Microservices Platform3,977
18 days ago9apache-2.0Java
基于SpringBoot2.x、SpringCloud和SpringCloudAlibaba并采用前后端分离的企业级微服务多租户系统架构。并引入组件化的思想实现高内聚低耦合,项目代码简洁注释丰富上手容易,适合学习和企业中使用。真正实现了基于RBAC、jwt和oauth2的无状态统一权限认证的解决方案,面向互联网设计同时适合B端和C端用户,支持CI/CD多环境部署,并提供应用管理方便第三方系统接入;同时还集合各种微服务治理功能和监控功能。模块包括:企业级的认证系统、开发平台、应用监控、慢sql监控、统一日志、单点登录、Redis分布式高速缓存、配置中心、分布式任务调度、接口文档、代码生成等等。
Login With2,293
2 years ago9August 08, 201835mitJavaScript
Stateless login-with microservice for OAuth
Spring Boot Jwt1,022
a year agomitJava
JWT auth service using Spring Boot, Spring Security and MySQL
Gin Boilerplate871
23 days ago8mitGo
The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis
Canduma751
2 months ago19mitRust
A Rust Boilerplate server with GraphQL API, Diesel, PostgreSQL, session authentication and JWT
Simplemall689
3 years agon,ullJava
基于SpringCloud的微服务架构实战案例项目,以一个简单的购物流程为示例,融合spring cloud 相关组件,如spring-cloud-netflix、swagger等
Paseto62711217 months ago3November 08, 20185mitGo
Platform-Agnostic Security Tokens implementation in GO (Golang)
Auth Service581
3 years ago6mitJava
spring security + oauth2.0 + jwt
Hydra56012a month ago24March 02, 202218mitGo
后端一站式微服务框架,提供API、web、websocket,RPC、任务调度、消息消费服务器
Alternatives To Jin Microservices
Select To Compare


Alternative Project Comparisons
Readme

English |

Introduction

Jin microservices is a complete microservice demo based on PHP language + hyperf microservices framework

githubhttps://github.com/Double-Jin/jin-microservices

giteehttps://gitee.com/ljj96/jin-microservices

About JM

As a developer of both php and go, the microservice system of the go language has been basically mastered. There are a lot of articles and open source projects related to the go language on the Internet, which makes it easy for developers who know the go language Get started and implement microservices. After all, go language is the most suitable language for microservices other than java.

The advantage of the php language lies in the web ecosystem, and most of the applications developed are monolithic application architectures. In recent years, with the emergence of hyperf framework based on swoole extension, php can also develop microservice architecture, thanks to open source workers. However, when using "php + microservices" as the keyword, the articles and open source projects searched are simple cases. Developers cannot understand microservices through these simple cases, which makes me want to write this project. raw power.

Foreword

JM is a complete microservice demo written based on php language + hyperf microservice framework. Unlike articles that can be found on the Internet with simple implementation of a single function point, JM starts from the actual project requirements and strives to achieve the git clone project. The file can help you build a complete knowledge system for microservices, so that you can paste and copy the code of this project when you actually use hyperf to develop a microservice project.

The microservice architecture is not an architecture that is more advanced than the monolithic architecture, but a choice after the project volume and the number of project developers reach a certain order of magnitude. Do not blindly advocate microservices. Forcibly promoting the microservice architecture when the team's development and operation and maintenance capabilities are insufficient may be counterproductive.

The components mentioned below are not only used in microservice architecture, such as elk, nacos, and dtm. They are also used in suitable scenarios in monolithic applications, and the essence of them can be used to meet business needs. If these components are used in production, it is best to choose to compile and install or purchase cloud services

Feature

  • Complete microservice architecture
  • JsonRpc call
  • Jwt authority authentication
  • Upload the file
  • Unified exception handling
  • Service Registration and Service Discovery
  • Message queue
  • Link tracking
  • Configuration Center
  • Service current limit
  • Service downgrade
  • Distributed log
  • Distributed transaction

Prepare

Microservices are an architecture that splits a monolithic application. By using third-party components to solve the problems caused by the split, you will encounter many strange problems when installing and deploying these components. In order to reduce the difficulty, most of the components of this project are installed by docker. I have verified the overall process several times on different computers. Even so, there are still problems such as composer, github, http/tcp access, ports, memory, docker version, etc. , the same operation may cause problems if you change the computer, which requires you to find relevant information according to the content of the error to solve it yourself.

  • 8 core 16G computer
  • familiar with docker
  • Learn about network protocols
  • Basic operation and maintenance capabilities

Install

Use

  • Directory Structure

      |-- api-gateway //Gateway service project code 
      |-- order-srv //Order service project code
      |-- user-srv // User service project code
      |-- task-srv // Timed task and queue service project code
      |-- doc // Documentation directory
      |-- README.md //English description
      |-- README-CN.md //Chinese description
    
  • Complete microservice architecture php

  • JsonRpc call

    • GET http://127.0.0.1:9501/User/UserInfo Communication single service
    • GET http://127.0.0.1:9501/User/UserBonusList Communication single service
    • GET http://127.0.0.1:9501/User/UserStoredList Communication single service
    • GET http://127.0.0.1:9501/Order/OrderList Communication multiple services
  • Jwt authority authentication

    • GET http://127.0.0.1:9501/Auth/Login User login
    • GET http://127.0.0.1:9501/Auth/Logout Authorization : Bearer {{token}} User logged out
  • Upload the file

    • RPC in microservices is a lightweight communication framework that is good at transporting strings. Not very friendly for text file transfers, And for the file if it is forced into String, it will be a bunch of garbled characters. Therefore, the general solution idea is that regardless of the file type,
    • all are converted into binary, and then the binary is Base64 encoded into String, and the encoded String is transferred to the background, and the background is restored to binary according to Base64 decoding, and the File object can be constructed through binary.
    • POST http://127.0.0.1:9501/File/UploadFile The file is converted to a base64 string and transferred via json-rpc
    • file-srv.app.JsonRpc.FileRpcService.uploadFile Generate a file by receiving a base64 string via json-rpc
  • Unified exception handling

    • Encapsulate AppServiceExceptionHandler.php http request exceptions
    • Encapsulate RateLimitExceptionHandler.php current limiting exceptions
    • Encapsulate JsonRpcExceptionHandler.php JsonPrc exceptions
    • Encapsulate DtmExceptionHandler.php DTM Distributed transaction exceptions
  • Service Registration and Service Discovery

  • Message queue

    • GET http://127.0.0.1:9501/User/UserRabbitMQ Call the delivery user message queue interface
    • GET http://127.0.0.1:9501/Order/OrderRabbitMQ Call the delivery order message queue interface php
  • Link tracking

  • Configuration Center

  • Service current limit GET http://127.0.0.1:9501/RateLimit/Test

  • Service downgrade GET http://127.0.0.1:9501/CircuitBreaker/Test

  • Distributed log

    When the system becomes a cluster, the application logs on dozens or even hundreds of different servers can realize the functions of unified search, analysis and archiving of logs, which can be called a distributed log system.

    There are many solutions in production, such as outputting logs directly to Elasticsearch, such as using log collection provided by cloud service providers. In this case, the log is synchronized to ELK through filebeat.

  • Distributed transaction

    A database transaction ensures that all operations within the scope of the transaction can either succeed or fail. But for distributed systems, data operations come from multiple different databases, and the success or failure of a single database transaction does not mean that the data consistency of the entire system is correct, and can only be resolved through distributed transactions.

    Distributed transaction means that the initiator, resource and resource manager and transaction coordinator of the transaction are located on different nodes of the distributed system. Two-phase submission, SAGA, TCC and other schemes are commonly used in the industry. After understanding the principle, you can also use http/tcp to achieve two-phase submission, SAGA, and TCC.

    The following interface is implemented in a SAGA case via DTM scheduling.

    POST http://127.0.0.1:9501/Order/CreateOrder Distributed transaction php

Question

  • Service registration and service discovery without gRpc support
  • The configuration center component only supports config calls, and cannot do dynamic writing of env and framework restarts, but it can be achieved through k8s

Thank

  • hyperfhttps://hyperf.wiki/2.2/#/README
  • dtmhttps://en.dtm.pub/
  • nacoshttps://nacos.io/zh-cn/docs/what-is-nacos.html
  • elkhttps://www.elastic.co/cn/what-is/elk-stack
Popular Microservices Projects
Popular Jwt Projects
Popular Application Programming Interfaces Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Microservices
Jwt
Grpc
Amqp
Json Rpc
Zipkin