TencentFemas / femas

JavaAgent-based Microservice Governance Platform
https://zilongtong.notion.site/Femas-Home-4e1ad62bc48d4f23b6063c460a337c40
Other
474 stars 138 forks source link
api-management apm authentication circuit-breaker javaagent metrics microservices router service-discovery

Femas: Tencent Cloud Open Source Microservices Governance Platform

English | 简体中文

Introduction

Femas is an open source product form of Tencent Cloud's microservice platform TSF . It focuses on the running state of microservices and provides one-stop microservice management and control capabilities such as multi-frame unified service discovery, north-south and east-west traffic management, service observability, and configuration management. In the service architecture transformation, the core issues are difficult to reuse heterogeneous frameworks, difficult to manage and control surge traffic, and time-consuming for troubleshooting and recovery.

  • data plane: Femas uses the multi-runtime architecture design to standardize and modularize the underlying core capabilities of microservices, and assemble the basic components split in the microservice field through a reasonable architecture to meet diversified microservice scenarios. , lightweight, portable, low-cost, cloud-free vendor binding,Currently, the community provides governance data planes in two proxyLess modes: SDK and business-agnostic JVM TI Agent.
  • control plane: Femas provides a unified control plane standard protocol, a set of governance protocols, and multi-language and multi-data plane distribution.

    ability

    image

Feature

Code Structure

.
├── femas-adaptor # adaptation layer plugin for paas plateform
│   └── femas-adaptor-opensource-admin #  The PAAS platform adaptation layer is adapted to the open source platform by default. If you want to connect to other control surfaces, you can plug-in an adapter. Secondly, you can assemble the capability matrix required by the platform here
├── femas-admin # admin 
├── femas-admin-starter # starter for admin
├── femas-agent # java agent module
│   ├── femas-agent-core # javaagent bytebuddy core module
│   ├── femas-agent-example 
│   ├── femas-agent-plugin # byte-code plugin module
│   ├── femas-agent-starter # premain entrance
│   └── femas-agent-tools 
├── femas-api # the abstract layer of microservice life cycle, is convenient for users to connect with heterogeneous RPC framework
├── femas-benchmark
├── femas-common # toolkit
├── femas-config #  abstraction layer of configuration module
├── femas-config-impl # implementation layer of configuration module
│   ├── femas-config-consul # consul for femas-config
│   ├── femas-config-nacos # nacos for femas-config
│   └── femas-config-paas # pass for femas-config
├── femas-dependencies-bom # Unified management of femas dependent versions
├── femas-example # demo
│   ├── feams-example-springcloud-hoxton
│   ├── femas-example-alibaba-dubbo-consumer
│   ├── femas-example-alibaba-dubbo-provider
│   ├── femas-example-springcloud-2020-consumer
│   ├── femas-example-springcloud-2020-provider
│   ├── femas-example-springcloud-greenwich-consumer
│   ├── femas-example-springcloud-greenwich-gateway
│   ├── femas-example-springcloud-greenwich-provider
│   └── femas-example-springcloud-greenwich-zuul
├── femas-extensions # rpc layer docking framework SDK
│   ├── femas-c-dubbo # extension for dubbo
│   └── femas-extension-springcloud #  extension for springcloud
├── femas-governance # abstraction layer of governance module
├── femas-governance-impl # implementation layer of governance module
├── femas-helm
├── femas-registry # abstraction layer of registry module
├── femas-registry-impl # implementation layer of registry module
│   ├── femas-registry-consul
│   ├── femas-registry-etcd
│   ├── femas-registry-eureka
│   ├── femas-registry-k8s
│   ├── femas-registry-nacos
│   └── femas-registry-polaris
├── femas-starters # Starter dependency of user's SDK
│   ├── femas-dubbo-starters
│   └── femas-springcloud-starters
└── jacoco-aggregate

Install the server

Runtime environment dependencies:

64 bit OS, support Linux/Unix/Mac/Windows, script startup supports Linux/Unix/Mac;

64 bit JDK 1.8+;

Maven 3.2.x+;

External database Mysql (optional)

Stand-alone deployment

mvn -Dmaven.test.skip=true clean install -U

cd femas-admin-starter/target/femas-admin-starter-$version/femas-admin/bin

sh startup.sh

The console configuration mainly includes:

Femas default Start with the embedded database:

The embedded database only supports single-machine deployment, and does not support cluster deployment. The embedded database data disk path is ${user.home}/rocksdb/femas/data/

To use the monitoring capability, the following configuration is required:

#Configure skywalking backend address
Femas:
  trace:
    backend:
      addr: http://skywalking WEB IP:PORT
#Configure Metrics grafana address
  metrics:
    grafana:
      addr: http://IP:PORT

Cluster deployment

Cluster deployment is the same as stand-alone deployment. The only difference is that the data source must be an external data source, so that the server side of Femas supports stateless horizontal expansion.

Configuration file configuration data source

spring:
  datasource:
    url: jdbc:mysql://IP:3306/adminDb?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useSSL=false&serverTimezone=Asia/Shanghai
    username: username
    password: password
    hikari:
      driver-class-name: com.mysql.cj.jdbc.Driver

The start command is

sh startup.sh external

Visit http://localhost:8080/index to see the console page

Login user name: admin, password: 123456, the user name and password are hard-coded, and the open source side does not impose any permission restrictions.

Preparation before the service is connected to the paas platform

step 1. Configure the registry(Before this, you must have a deployed registry cluster, Femas is not bound to any registry, you can host any registry to the Femas platform)

image

Cluster addresses support IP:prot comma-separated, or domain name mode

step 2. Create namespace

image

Registry for namespace binding configuration

The service list of the femas governance center is logically isolated in the namespace dimension. The service list is pulled from the third-party registration center. The pull condition is to access FemasSDK and the name of the service tag (namespace ID written by -D below) The space is the same as the namespace selected in the list.

After completing the above two steps, you can then access femas through the SDK to manage the service to the paas platform.

Springcloud access

Sample

Execute the script under the femas parent pom:

mvn -Dmaven.test.skip=true clean install -U

Add dependency
<!-- Native dependency of registry -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
    <version>2.1.2.RELEASE</version>
</dependency>

<!-- femas middleware dependency -->
<dependency>
    <groupId>com.tencent.tsf</groupId>
    <artifactId>femas-extension-springcloud-greenwich-starter</artifactId>
    <version>${femas.latest.version}</version>
</dependency>

Currently Femas supports starter list directory: cd femas-starters/

The default supported version components are:

Configuration file
Business application native configuration file, the path is: resources/bootstrap.yaml
server:
  port: 18001
spring:
  application:
    name:
      femas-springcloud-consumer
  cloud:
    consul:
      host: 127.0.0.1
      port: 8500
      discovery:
        serviceName: femas-springcloud-consumer
        instanceId: ${spring.application.name}-${server.port}-${spring.cloud.client.hostname}
        heartbeat:
          enabled: true
# nacos:
# discovery:
# server-addr: 127.0.0.1:8848
Femas component configuration file path: resources/femas.yaml (Ymal format, used to configure femas-related local configuration, such as paas address, custom registry cluster, custom governance rules, etc.)
# Configure the paas background address, if not configured, get the rules from the local configuration file
paas_server_address: http://127.0.0.1:8080
femas_namespace_id=Namespace ID
femas_prog_version=Service version

# Use the method provided by Femas to access the registration center, how to use dubbo or self-developed protocol
femas_registry_ip: 127.0.0.1 //Registry center cluster address
femas_registry_port: 8500 //Registry center port number
femas_registry_type: consul //registry type

#The following configuration is optional, which is used to configure and load the basic component type and local governance rules. If not, load the default configuration of femas.
rateLimit:
  type: femasRateLimit
authenticate:
  type: femasAuthenticate
serviceRouter:
  chain:
    - FemasDefaultRoute
loadbalancer:
  type: random
circuitBreaker:
  enable: true
  chain:
    -femasCircuitBreaker
Start service command
-javaagent:"{skywalking agent absolute path}/agent/skywalking-agent.jar"
-Dfemas_namespace_id=Namespace ID
-Dfemas_prog_version=Service version
-Dskywalking.agent.service_name=The name of the service registered on skywalking, which needs to be consistent with the name of the registration center
-Dskywalking.collector.backend_service=skywalking backend address, which can override the agent's conf configuration
  1. Reference agent probe of skywalking
  2. The service needs to specify its own namespace
  3. Specify the group to which the service belongs, and cooperate with the realization of service governance on the SDK side
  4. The service name registered to skywalking must be the same as the name registered to the registration center, otherwise the tracing link observation will not find the corresponding service.

Dubbo access

Sample

For details, see the official document below

Documentation

Official Document

FAQ

Contribution Manual

Code of Conduct

Participate in Contribution

  • Actively participate in the discussion of the Issue, such as answering questions, providing ideas, or reporting unsolvable errors (Issue)
  • Write and improve project documentation (Wiki)
  • Submit patch optimization code (Coding)

You will get

  • Join the list of contributors to Tencent open source projects and display them on Tencent open source official website
  • Write CONTRIBUTING.md for specific items
  • Tencent open source contributor certificate (electronic version & paper)
  • Become a special guest of offline technology conference/salon
  • Q coins and souvenirs

contact us

群微信号

Add WeChat, note [femas].

微信号

License

LICENSE.