Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SIA-GateWay 's API Gateway installation and deployment Guide

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

SIA-GATEWAY is a distributed micro-service gateway system based on Spring Cloud micro-service ecosystem. With the characteristics of easy to use, visualization, high scalability and high availability, it provides cloud native, complete and mature access service solutions. This article describes the installation and deployment of the API gateway.

Micro Services and Gateway Technology (SIA-GateWay)

Environment 1.1Compiler Environment Maven3+nodejsJdk1.8+1.2 Runtime third Party depends on Mysql5.6+elasticsearch 5.5.2kibana-5.5.2kafka 2.12-2.0.0redis 3.2.11eureka-server1.3 Runtime Environment 64bit OS Linux/Mac/Windows/dockerJDK1.8+ II. Source code download git clone https://github.com/siaorg/sia-gateway.git2.1 source code structure is as follows: .├── sia-gateway-admin-buildcomponent gateway admin component collection │ ├── sia-gateway-admin gateway admin monitoring system component │ ├── sia-gateway-synchspeed gateway real-time awareness component │ ├── sia-gateway-stream for downstream services Gateway log component │ ├── sia-gateway-service gateway system auxiliary component │ ├── sia-gateway-monitor gateway monitoring, │ │ ├── sia-gateway-reactive │ │ ├── sia-gateway-messaging Base depends on │ │ ├── sia-gateway-sink │ │ ├── sia-gateway-esclient │ │ ├── sia-gateway-base ├── sia-gateway-admin-display Gateway system Front end Code ├── sia-gateway-buildcomponent Gateway core -buildcomponent │ ├── sia-gateway-core Gateway Core node │ │ ├── sia-gateway-base │ │ ├── sia-gateway-messaging basic dependence on │ │ ├── sia-gateway-reactive │ │ ├── sia-gateway-template 3. Initialize the API Gateway Database

1) for more information on the installation and configuration of MySQL, please see the official MySQL documentation.

2) download the project source code and decompress it, obtain the "API gateway database initialization SQL script" and execute it.

The location of "API Gateway Database initialization SQL script" is:

/ sia-gateway/sia-gateway-admin/src/main/resources/db/gateway_ admin.sql IV, Configure "Gateway system" 4.1 Gateway profile address # Gateway admin Central conf/sia-gateway/sia-gateway-admin-buildcomponent/config/gateway_admin_test.yml# Gateway Monitoring Service conf/sia-gateway/sia-gateway-admin-buildcomponent/config/gateway_monitor_test.yml# Gateway Auxiliary Node conf/sia-gateway/sia-gateway-admin-buildcomponent/config/gateway_service_test.yml# Gateway Log Service conf / sia-gateway/sia-gateway-admin-buildcomponent/config/gateway_stream_test.yml# gateway real-time aware service conf/sia-gateway/sia-gateway-admin-buildcomponent/config/gateway_synchspeed_test.yml# gateway core node conf/sia-gateway/sia-gateway-buildcomponent/config/gateway_test.yml

1) gateway_admin_test.yml

2) gateway_service_test.yml

3) gateway_stream_test.yml

4) gateway_synchspeed_test.yml

5) gateway_monitor_test.yml

6) gateway_test.yml

Description: spring.application.name is the name of the gateway group. Developers can modify this attribute to build a new gateway group.

4.2 maven warehouse address configuration alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central jdk-1.8 true 1.8 1.8 1.8 1.8 downloadSources true true spring plugins spring plugins Spring plugins Spring plugins https://maven.aliyun.com/repository/spring-plugin default always downloadSources 5. Build deployment Project 5.1 compile the project

1) if the above configuration has been done correctly, the project can be compiled, packaged and deployed.

2) procedure:

Cd sia-gateway chmod + x * .sh sh build.sh

3) after the package is successful, the following annotation file will appear.

/ sia-gateway/sia-gateway-admin-buildcomponent/target/gateway_admin_1.0.zip

/ sia-gateway/sia-gateway-buildcomponent/target/gateway_1.0.zip

/ sia-gateway/sia-gateway-admin-display/dist/

Note: nodeJs is required for front-end packaging. If it is not installed, please refer to the nodejs installation documentation.

5.2 the deployment mode of the API gateway system of the deployment project is distributed and centralized management mode, that is, the gateway Core node can be divided into different gateway groups according to the line of business, and the gateway management side serves as the management center of the gateway for a unified management interface, where users can set and maintain API, components and system basic information, collect monitoring logs, generate various operation and maintenance management reports, automatic alarms, and so on. Sia-gateway-admin-buildcomponent is a set of gateway management components, including: admin, stream, service, synchspeed, monitor; management side can deploy a single node (currently does not support clusters). Sia-gateway-buildcomponent is a gateway Core component, which can be grouped by business line and deployed in a single node or cluster mode within the group. 5.3 Vmware deployment

1) backend deployment

Unzip gateway_admin_1.0.zipcd / gatewayadmin/binchmod + x * .sh # starts gateway management services, including: admin, stream, service, synchspeed, monitor. Sh onekey_start.sh---unzip gateway_1.0.zipcd / gateway/binchmod + x * .sh # start the gateway Core service sh start_gateway_test.sh

2) Front-end deployment

Modify front-end site-map.js

For the proxy configuration of nginx, enter nginx.conf under the directory of nginx, and add the following configuration:

Upstream apigateway.open.location1 {# sia-gateway-admin service IP server *: 8090;} server {# nginx listening port listen 18086; server_name localhost; access_log logs/host.access.log main; # access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main Location / {# root html; # index index.html index.htm; root / app/jar/ROOT/dist; index index.html index.htm;} # backend service location location ^ ~ / vv1/ {proxy_pass http://apigateway.open.location1/; proxy_set_header Host $host Proxy_set_header X-Real-IP $http_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1;} error_page 500 502 503 504 / 50xcn.htl; location = / 50xcn.html {root html/error_page; index 50xcn.html } location / check_status {vhost_traffic_status_display; vhost_traffic_status_display_format json;}}

Restart nginx

# verify whether the configuration is correct. / nginx-t # restart. / nginx-s reload5.4 Docker image deployment

Note: if the docker environment and the compilation environment are on the same operating system, you can directly perform the following steps; otherwise, you need to upload the following files to the server where the docker environment is located according to the original directory structure.

/ sia-gateway/sia-gateway-admin-buildcomponent/target/gateway_admin_1.0.zip/sia-gateway/sia-gateway-buildcomponent/target/gateway_1.0.zip/sia-gateway/sia-gateway-admin-display/dist//sia-gateway/third-libary/sia-gateway/build.sh/sia-gateway/docker-start.sh/sia-gateway/docker-run.sh/sia-gateway/Dockerfile

Steps:

1) configuration: modify site-map.js, location: / dist/static/site-map.js

/ * vmware deployment: 127.0.0.1-> ip address of nginx * docker image deployment: 127.0.0.1-> host ip of docker container * / 'CESHI_API_HOST':' 127.0.0.1-> docker image deployment: 127.0.0.1-> host of docker container / * * 127.0.0.1-> ip address of kibana * / 'CESHI_API_HOST_LOG':' 127.0.0.1 CESHI_API_HOST_LOG': 5601'

2) download the basic centos image. If it has already been downloaded, this step will be ignored.

3) modify the Dockerfile,FROM image name: version number

4) configure the yum source. If the deployment machine can use the Ali yum source, this step is ignored.

Change the name of the yum source file to CentOS-Base.repo and replace it under / sia-gateway/third-libary/

5) build the image and start the container and service

# build an image cd / sia-gateway/ # authorize chmod + x * .sh # build an image sh docker-build.sh # start the container and service sh docker-run.sh # check whether the container starts successfully docker ps # enter the container to view the operation of the service docker exec-it gateway-test:v1 bash

Access address: http:// host IP:18086/

Description:

Docker image deployment is a kind of gateway deployment Demo in the form of ALL-IN-ONE, which is provided by us to facilitate developers to build gateway systems based on docker environment simply and quickly, that is, gateway monitoring services, early warning, gateway core nodes and so on are all built in a docker image. Developers can choose deployment solutions flexibly according to the conditions of the development environment. It is recommended to use vmware+docker image deployment method, that is, gateway management services are deployed on vmware and gateway core nodes are deployed in docker environment.

Links to SIA related open source products

Microservice task scheduling framework: sia-task: https://github.com/siaorg/sia-task microservice routing gateway: sia-gateway

Https://github.com/siaorg/sia-gatewayRabbitmq queue service PLUS:sia-rabbitmq-plus: https://github.com/siaorg/sia-rabbitmq-plus

Source: Yixin Institute of Technology

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report