FinBus单机体验一键部署



  • 在部署服务之前,需要每台机器都安装Docker以及Docker Compose。

    推荐服务器最低配置如下:

    项目 参数
    服务器参数 CPU:8核、内存:16G、硬盘:50G
    服务器数量 1台
    操作系统 Ubuntu-16.04 LTS / Mac OS 10.12以上,防火墙需关掉
    容器环境 Docker v1.12.3、docker-compose v1.9.0

    1.1 安装Docker

    安装docker1.12的脚本

    sudo curl https://releases.rancher.com/install-docker/1.12.sh | sh
    

    将用户名添加到docker组里,your-username需替换成实际的用户名:

    sudo usermod -aG docker your-username
    

    然后推出重新登陆服务器生效,使用以下命令验证docker版本是否正确:

    docker version
    

    1.2 安装docker-compose

    下载docker-compose版本到本地并安装

    sudo curl -LJO https://github.com/docker/compose/releases/download/1.9.0/docker-compose-Linux-x86_64
    

    修改权限

    sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
    
    sudo chmod +x /usr/local/bin/docker-compose
    

    安装完成后在命令行中输入docker-compose version 查看当前安装的版本是否正确:

    docker-compose version
    

    2 Finbus组件说明

    FinBus系统包含 shield(交易管理核心服务)monitor(监控系统)cms(后台管理系统)。其中shield(核心服务)有两种配置,一种支持接入kafka,另一种不支持接入kafka。下面依次介绍各个服务的配置以及启动步骤。

    2.1 shield(核心服务)不带kafka配置

    配置文件docker-compose-prod.yml 如下所示:

    version: '2'
    services:
      ar-hundson:
        container_name: quark-ar-hundson
        image: 'docker.finogeeks.club/quark/ar-hundson:1.0.0'
        ports:
         - 19001:19001
         - 19003:19003
        environment:
            T2_PORT: 19003
            COMMON_PUBLISHER_SERVERS: "shield:1234"
            COMMON_SUBSCRIBER_SERVERS: "shield:1235"
        links:
         - 'shield'
      lh-hundson:
        container_name: quark-lh-hundson
        image: 'docker.finogeeks.club/quark/lh-hundson:1.0.0'
        environment:
            T2SDK_SERVERS: "123.207.115.95:19001"
            T2SDK_LICENSE_NO: "GFZQ-HSTYRZ-0000-Y6uwlyPMQiSrxULwCFISKqv+"
            PUBLISHER_SERVERS: "shield:1234"
            SUBSCRIBER_SERVERS: "shield:1235"
        volumes:
         - /opt/ar_license/license.dat:/opt/lh-hundson/ar_license/license.dat
        links:
         - 'shield'
      shield:
        container_name: quark-shield
        image: 'docker.finogeeks.club/quark/shield:1.0.0'
        environment:
         SERVICE_NAME: "shield"
         ENABLE_MONITOR: "true"
         MONITOR_PORT: 9092
         PUSH_GW_ADDR: "http://pushgateway:9091"
         ZMQ_IN_ADDR: "tcp://*:1234,tcp://httpsrv:1236"
         ZMQ_OUT_ADDR: "tcp://*:1235"
         RATELIMITER_TOTAL: 500
         ROSTER_TOTAL: 500
         REDIS_URI: "redis://user:finochat@redis:6379/0"
        links:
         - 'redis'
      httpsrv:
        container_name: quark-httpsrv
        image: 'docker.finogeeks.club/quark/shield:1.0.0'
        environment:
         SERVICE_NAME: "http_srv"
         ZMQ_OUT_ADDR: "tcp://*:1236"
         RATELIMITER_TOTAL: 500
         ROSTER_TOTAL: 500
         REDIS_URI: "redis://user:finochat@redis:6379/0"
        ports:
         - 8000:8000
        links:
         - 'redis'
      redis:
        image: 'docker.finogeeks.club/quark/finbus-redis:1.0.0'
        ports:
         - 6379:6379
        volumes:
         - /data:/data:rw
    

    柜台相关配置,请按照实际情况进行修改。包含T2SDK_SERVERS(柜台地址), T2SDK_LICENSE_NO(License号),柜台认证如果使用License文件,请把License文件放在此处:/opt/ar_license/license.dat。
    注意:T2SDK_LICENSE_NO和License文件至少要有一个,否则柜台无法完成认证。如果两者同时存在,只识别T2SDK_LICENSE_NO

    2.2 shield(核心服务)带kafka配置

    配置文件docker-compose-prod.yml 如下所示:

    version: '2'
    services:
      zookeeper:
        container_name: zookeeper
        hostname: localhost
        image: 'docker.finogeeks.club/finochat/zookeeper'
      kafka:
        container_name: kafka
        hostname: localhost
        image: 'docker.finogeeks.club/finochat/kafka'
        ports:
         - 9092:9092
        environment:
          KAFKA_ADVERTISED_HOST_NAME: "kafka"
          KAFKA_DELETE_TOPIC_ENABLE: "true"
          KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
        depends_on:
          - zookeeper
        links:
         - 'zookeeper'
      ar-hundson:
        container_name: quark-ar-hundson
        image: 'docker.finogeeks.club/quark/ar-hundson:1.0.0'
        ports:
         - 19001:19001
         - 19003:19003
        environment:
            T2_PORT: 19003
            COMMON_PUBLISHER_SERVERS: "shield:1234"
            COMMON_SUBSCRIBER_SERVERS: "shield:1235"
        links:
         - 'shield'
      lh-hundson:
        container_name: quark-lh-hundson
        image: 'docker.finogeeks.club/quark/lh-hundson:1.0.0'
        environment:
            T2SDK_SERVERS: "123.207.115.95:19001"
            T2SDK_LICENSE_NO: "GFZQ-HSTYRZ-0000-Y6uwlyPMQiSrxULwCFISKqv+"
            PUBLISHER_SERVERS: "shield:1234"
            SUBSCRIBER_SERVERS: "shield:1235"
        volumes:
         - /opt/ar_license/license.dat:/opt/lh-hundson/ar_license/license.dat
        links:
         - 'shield'
      shield:
        container_name: quark-shield
        image: 'docker.finogeeks.club/quark/shield:1.0.0'
        environment:
         SERVICE_NAME: "shield"
         ENABLE_MONITOR: "true"
         MONITOR_PORT: 9092
         PUSH_GW_ADDR: "http://pushgateway:9091"
         ZMQ_IN_ADDR: "tcp://*:1234,tcp://httpsrv:1236"
         ZMQ_OUT_ADDR: "tcp://*:1235"
         RATELIMITER_TOTAL: 500
         ROSTER_TOTAL: 500
         REDIS_URI: "redis://user:finochat@redis:6379/0"
         KFLOG_ADDR: "kafka:9092"
         KFLOG_TOPIC: "trademsg"
        links:
         - 'redis'
      httpsrv:
        container_name: quark-httpsrv
        image: 'docker.finogeeks.club/quark/shield:1.0.0'
        environment:
         SERVICE_NAME: "http_srv"
         ZMQ_OUT_ADDR: "tcp://*:1236"
         RATELIMITER_TOTAL: 500
         ROSTER_TOTAL: 500
         REDIS_URI: "redis://user:finochat@redis:6379/0"
        ports:
         - 8000:8000
        links:
         - 'redis'
      redis:
        image: 'docker.finogeeks.club/quark/finbus-redis:1.0.0'
        ports:
         - 6379:6379
        volumes:
         - /data:/data:rw
    

    柜台相关配置,请按照实际情况进行修改。包含T2SDK_SERVERS(柜台地址), T2SDK_LICENSE_NO(License号),柜台认证如果使用License文件,请把License文件放在此处:/opt/ar_license/license.dat。
    注意:T2SDK_LICENSE_NO和License文件至少要有一个,否则柜台无法完成认证。如果两者同时存在,只识别T2SDK_LICENSE_NO

    2.3 monitor(监控系统)配置

    配置文件docker-compose-monitor.yml 如下所示:

    version: '2'
    services:
      node-exporter:
        image: docker.finogeeks.club/monitor/node-exporter:1.0.0
        network_mode: host
        pid: host
    #  alert-webhook:
    #    image: docker.finogeeks.club/monitor/alert-webhook:1.0.6
    #    environment:
    #      AGENT_ID: ''
    #      ALARM_WAY: matrix
    #      APP: finogeeks
    #      CORPID: ''
    #      CORPSECRET: ''
    #      HOMESERVER_URL: https://chat.finogeeks.club
    #      PASSWD: '*h1RDlr7%wC62Bu4ekQ40QBmS5'
    #      SMS_MOBILE: ''
    #      SMS_URL: ''
    #      USERID: '@alarm-bot:finogeeks.club'
    #    depends_on:
    #    - grafana
      grafana:
        image: docker.finogeeks.club/monitor/grafana
        environment:
          GF_CONFIG: finbus
        volumes:
        #- /opt/grafana/lib/:/var/lib/grafana:rw
        - /var/run/grafana/lib/:/var/lib/grafana:rw
        depends_on:
        - prometheus
        ports:
        - 3000:3000/tcp
      cadvisor:
        image: docker.finogeeks.club/monitor/cadvisor:1.0.3
        network_mode: host
        volumes:
        - /:/rootfs:ro
        - /var/run:/var/run:rw
        - /sys:/sys:ro
        - /var/lib/docker/:/var/lib/docker:ro
        pid: host
      pushgateway:
        image: prom/pushgateway:master
        ports:
          - 9091:9091
      prometheus:
        privileged: true
        image: docker.finogeeks.club/monitor/prometheus
        environment:
          CONFIG_FILE: finbus.yml
        volumes:
        - /mnt/data/monitor/prometheus:/prometheus/data
        - /etc/localtime:/etc/localtime:ro
        ports:
        - 9090:9090/tcp
      alertmanager:
        image: docker.finogeeks.club/monitor/alertmanager:1.13.2
        depends_on:
        - grafana
    

    2.4 cms(后台管理系统)配置

    配置文件docker-compose-cms.yml 如下所示:

    version: '2'
    services:
      egg:
        image: docker.finogeeks.club/quark/finbus-cms
        networks:
          - cms-network
        environment:
          - LOGIN_URL=https://api.finogeeks.club/api/v1/registry/login
          - FINBUS_URL=http://httpsrv的ip:8000/api/v1/quark
      redis:
        image: redis:alpine
        networks:
          - cms-network
      nginx:
        image: docker.finogeeks.club/quark/finbus-cms-page
        networks:
          - cms-network
        ports:
          - 80:80
    networks:
      cms-network:
    

    LOGIN_URLFINBUS_URL需要根据实际情况配置。LOGIN_URL请输入im或者oa的登陆接口,FINBUS_URL需要填入shield(核心服务)下属服务httpsrv的ip。

    3 服务启动

    FinBus系统的三大组件 shield(核心服务)monitor(监控系统)cms(后台管理系统)均通过docker-compose直接启动,请输入以下命令,依次启动即可。
    注意:docker-compose-prod.yml、docker-compose-monitor.yml必须在同一个目录,否则会报错!

    docker-compose -f docker-compose-prod.yml -d up
    docker-compose -f docker-compose-monitor.yml -d up
    docker-compose -f docker-compose-cms.yml -d up