老版本Docker部署

一只会飞的鱼儿 1年前 ⋅ 382 阅读
ad
大家好,我们已经正式发布了webfunny的官方镜像:https://hub.docker.com/repository/docker/webfunny/webfunny_monitor

部署前提是你的服务器已经按照了Docker环境,没有安装docker环境的可以参考这篇文章:

https://blog.csdn.net/BThinker/article/details/123358697

一、拉取官方镜像

执行命令$:docker pull webfunny/webfunny_monitor:3.1.52-beta

查看镜像$:  docker images

二、创建配置文件

1. 下载配置文件模板:模板

git clone https://github.com/yuyuleilei/configTemplate.git

把configTemplate项目克隆下来,将里面的app整个文件夹copy放到本地或者服务器对应目录下

2. 三个目录分别挂载容器里面的路径,如下:

应用中心:/app/center/config_variable/, 则映射目录为:/app/center/config_variable/
监控系统:/app/monitor/config_variable/, 则映射目录为:/app/monitor/config_variable/
埋点系统:/app/event/config_variable/, 则映射目录为:/app/event/config_variable/

3. 配置文件的参数说明文档在最下方 ↓↓↓。

三、填写基础配置

1. 进入映射目录,找到配置文件进行修改:/app/center/config_variable/config.json,/app/monitor/config_variable/config.json,/app/event/config_variable/config.json

2. 填写授权码,如果没有,可以去官网:申请试用版

"purchase": {
   "purchaseCode": "授权码",
   "secretCode": "解码(没有可以空着)"
}

3. 填写数据库配置

"mysqlConfig": {
  "write": {
    "ip": "localhost",
    "port": "3306",
    "dataBaseName": "webfunny_db",
    "userName": "root",
    "password": "123456"
  },
  "read": []
},

4. 应用中心配置域名和端口号,如何配置?请参考文档的第四步:服务器部署

进入/app/center/config_variable/config.json

"domain": {
  "localServerDomain": "localhost:8009",
  "localAssetsDomain": "localhost:8008",
  "localServerPort": "8009",
  "localAssetsPort": "8008",
  "mainDomain": ""
},
"monitorDomain": {
  "localServerDomain": "localhost:8011",
  "localAssetsDomain": "localhost:8010"
},
"eventDomain": {
  "localServerDomain": "localhost:8015",
  "localAssetsDomain": "localhost:8014"
},

5. 监控系统配置域名和端口号,如何配置?请参考文档的第四步:服务器部署

进入/app/monitor/config_variable/config.json

"uploadDomain": {
  "localServerDomain": ""
},
"domain": {
  "localServerDomain": "localhost:8011",
  "localAssetsDomain": "localhost:8010",
  "localServerPort": "8011",
  "localAssetsPort": "8010",
  "mainDomain": ""
},
"centerDomain": {
    "localServerDomain": "localhost:8009",
    "localAssetsDomain": "localhost:8008",
    "localServerPort": "8009",
    "localAssetsPort": "8008"
},

6. 埋点系统配置域名和端口号,如何配置?请参考文档的第四步:服务器部署

进入/app/event/config_variable/config.json

"uploadDomain": {
  "localServerDomain": ""
},
"domain": {
  "localServerDomain": "localhost:8015",
  "localAssetsDomain": "localhost:8014",
  "localServerPort": "8015",
  "localAssetsPort": "8014",
  "mainDomain": ""
},
"centerDomain": {
    "localServerDomain": "localhost:8009",
    "localAssetsDomain": "localhost:8008",
    "localServerPort": "8009",
    "localAssetsPort": "8008"
},

7. 配置生产环境,搭配nginx配置域名,代理配置可以参考文档:nginx代理配置

"domain": {
  "localServerDomain": "www.xxx.com",
  "localAssetsDomain": "www.xxx.com",
  "localServerPort": "8011",
  "localAssetsPort": "8010",
  "mainDomain": ""
},

四、启动容器

1. 执行启动命令之前,需要替换一下映射目录和版本号,按照文档的示例,对应值如下:

应用中心映射目录 -> /app/center/config_variable/

监控系统映射目录 -> /app/monitor/config_variable/

埋点系统映射目录 -> /app/event/config_variable/

版本号 -> 3.1.52-beta

2. 三种方式启动$:

第一种:多行命令

docker run -it --rm -d --name webfunny \
       -p 8008:8008 \
       -p 8009:8009 \
       -p 8010:8010 \
       -p 8011:8011 \
       -p 8014:8014 \
       -p 8015:8015 \
       -v 应用中心映射目录:/app/center/config_variable/ \
       -v 监控系统映射目录:/app/monitor/config_variable/ \
       -v 埋点系统映射目录:/app/event/config_variable/ \
       webfunny/webfunny_monitor:版本号

第二种:单行命令

docker run -it --rm -d --name webfunny -p 8008:8008 -p 8009:8009 -p 8010:8010 -p 8011:8011 -p 8014:8014 -p 8015:8015 -v 应用中心映射目录:/app/center/config_variable/ -v 监控系统映射目录:/app/monitor/config_variable/ -v 埋点系统映射目录:/app/event/config_variable/ webfunny/webfunny_monitor:版本号

第三种:docker-compose方式启动,yml文件配置:

# 将此yml文件上传服务器,执行启动命令 docker-compose -f ./docker-compose.yml up
version: '2'
services:
  webfunny_monitor:
    image: webfunny/webfunny_monitor:版本号
    restart: always
    container_name: webfunny_monitor
    volumes:
      - 应用中心映射目录:/app/center/config_variable/
      - 监控系统映射目录:/app/monitor/config_variable/
      - 埋点系统映射目录:/app/event/config_variable/
    ports:
      - 8008:8008
      - 8009:8009
      - 8010:8010
      - 8011:8011
      - 8014:8014
      - 8015:8015

启动slave命令:

docker run -it --rm -d --name webfunny \
       -p 8008:8008 \
       -p 8009:8009 \
       -p 8010:8010 \
       -p 8011:8011 \
       -p 8014:8014 \
       -p 8015:8015 \
       -v 应用中心映射目录:/app/center/config_variable/ \
       -v 监控系统映射目录:/app/monitor/config_variable/ \
       -v 埋点系统映射目录:/app/event/config_variable/ \
       webfunny/webfunny_monitor:版本号 \
       npm run monitor_slave

3. 查看容器情况$:docker container ls ; 进入启动的容器$:docker exec -it 容器id /bin/bash

4. 访问页面:

此时,可以直接访问应用中心首页了

应用中心首页: http://localhost:8008/webfunny_center/main.html

五、容器的其他常用操作指令

拉取镜像:docker pull webfunny/webfunny_monitor:3.1.52-beta

查看镜像:docker images

删除镜像:docker rmi -f 镜像id

查看容器:docker container ls ,  docker container ls —all

删除容器:docker container kill 容器id

启动容器:docker start 容器id

停止容器:docker stop 容器id

重启容器:docker restart 容器id

进入容器:docker exec -it 容器id /bin/bash

参数说明:

{
    "purchase": {
      "purchaseCode": "",
      "secretCode": ""
    },
    "uploadDomain": {
      "localServerDomain": ""
    },
    "domain": {
      "localServerDomain": "localhost:8011",
      "localAssetsDomain": "localhost:8010",
      "localServerPort": "8011",
      "localAssetsPort": "8010",
      "mainDomain": ""
    },
   "centerDomain": {
      "localServerDomain": "localhost:8009",
      "localAssetsDomain": "localhost:8008",
      "localServerPort": "8009",
      "localAssetsPort": "8008"
    },
    "mysqlConfig": {
        "write": {
          "ip": "localhost",
          "port": "3306",
          "dataBaseName": "webfunny_db",
          "userName": "root",
          "password": "123456"
        },
        "read": []
    },
    "email": {
      "useCusEmailSys": false,
      "emailUser": "",
      "emailPassword": ""
    },
    "httpReqRes": {
      "requestTextLength": 1000,
      "responseTextLength": 1000
    },
    "protocol": "",
    "messageQueue": false,
    "openMonitor": true,
    "logSaveDays": 8,
    "isOpenTodayStatistic": true,
    "business": {
      "batchInsert": {
         "limitQueueLength": 100
      },
      "userStayTimeScope": {
        "min": 100,
        "max": 100000
      }
    }
}

{
"purchase": {
   "purchaseCode": "", //授权码
   "secretCode": "" //解码
},

"uploadDomain": {

    "localServerDomain": ""//日志上报域名
},

"domain": {
   "localServerDomain": "localhost:8011", // 接口域名
   "localAssetsDomain": "localhost:8010", // 前端域名
   "localServerPort": "8011",
   "localAssetsPort": "8010",
   "mainDomain": ""
},

"centerDomain": {
  "localServerDomain": "localhost:8009",   // 应用中心接口域名
  "localAssetsDomain": "localhost:8008",  // 应用中心前端域名
  "localServerPort": "8009",
  "localAssetsPort": "8008"
}


"mysqlConfig": { // 数据库配置
"write": {
   "ip": "localhost",
   "port": "3306",
   "dataBaseName": "webfunny_db",
   "userName": "root",
   "password": "123456"
},
"read": [] // 读写分离配置
},
"email": {
  "useCusEmailSys": false, // 是否使用自己的邮件系统, true: 使用配置的邮箱密码;false: 由webfunny系统给你发送邮件
  "emailUser": "", // 163邮箱用户名
  "emailPassword": "" // 163邮箱,网易老账号用密码, 新账号用安全码
},

"httpReqRes": {
   "requestTextLength": 1000,
   "responseTextLength": 1000
},
"protocol": "",            //协议配置

"messageQueue": false, // 是否开启消息队列,默认不开启
"openMonitor": true, // 是否开启监控,企业版可关闭此选项
"isOpenTodayStatistic": true,//是否开启今日分析
"logSaveDays": 8 // 数据保存周期,默认8天

}

关于Webfunny

Webfunny专注于前端监控系统,前端埋点系统的研发。 致力于帮助开发者快速定位问题,帮助企业用数据驱动业务,实现业务数据的快速增长。支持H5/Web/PC前端、微信小程序、支付宝小程序、UniApp和Taro等跨平台框架。实时监控前端网页、前端数据分析、错误统计分析监控和BUG预警,第一时间报警,快速修复BUG!支持私有化部署,Docker容器化部署,可支持千万级PV的日活量!

  点赞 0   收藏 0
  • 一只会飞的鱼儿
    共发布53篇文章 获得8个收藏
全部评论: 0