Skip to content

Commit

Permalink
docker文件&视频操作手册
Browse files Browse the repository at this point in the history
  • Loading branch information
Givemefive555 committed Feb 20, 2023
1 parent 0de878a commit fd09b30
Show file tree
Hide file tree
Showing 64 changed files with 478 additions and 13 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ yarn-debug.log*
yarn-error.log*

# lock
yarn.lock
yarn.lock

# docker
docker/elasticsearch/data/*
docker/elasticsearch/logs/*
docker/elasticsearch/plugins/*

!docker/web/**
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Moonbox(月光宝盒)是一个**无侵入**的线上**流量录制** 和**
## 快速开始
详见 [快速开始](./docs/quick-start.md)

## 问题参考
[问题参考](https://github.com/vivo/MoonBox/wiki)
## Docker部署
详见 [月光宝盒Docker部署](./docs/月光宝盒Docker部署手册.md)

## 未来计划

Expand Down
68 changes: 68 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2022 vivo Communication Technology Co., Ltd.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


version: "3"

services:
moonbox-mysql:
container_name: moonbox-mysql
build:
context: ./mysql
environment:
MYSQL_ROOT_PASSWORD: 123456
ports:
- 3307:3306
restart: always

moonbox-elasticsearch:
container_name: moonbox-elasticsearch
image: elasticsearch:7.16.2
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/logs:/usr/share/elasticsearch/logs
- ./elasticsearch/plugins:/usr/share/elasticsearch/plugins
ports:
- 9201:9200
- 9301:9300
restart: always

moonbox-server:
container_name: moonbox-server
build:
context: ./server
ports:
- 8081:8080
restart: always
depends_on:
- moonbox-mysql
- moonbox-elasticsearch

moonbox-web:
container_name: moonbox-web
build:
context: ./web
ports:
- 9999:9999
restart: always
depends_on:
- moonbox-server
25 changes: 25 additions & 0 deletions docker/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2022 vivo Communication Technology Co., Ltd.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


FROM mysql:5.7

MAINTAINER moonbox
EXPOSE 3306
LABEL version="1.0.1" description="mysql镜像, 初始化moonbox库表" by="moonbox"

ENV MYSQL_DATABASE=moonbox
ENV MYSQL_ROOT_PASSWORD=123456

COPY ./init.sql /docker-entrypoint-initdb.d
132 changes: 132 additions & 0 deletions docker/mysql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
Copyright 2022 vivo Communication Technology Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

CREATE TABLE `tb_record_task_template` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`template_id` varchar(64) NOT NULL DEFAULT '' COMMENT '任务id',
`template_name` varchar(128) NOT NULL DEFAULT '' COMMENT '任务名称',
`type` int(2) NOT NULL DEFAULT '0' COMMENT '任务类型(0:java)',
`app_name` varchar(128) NOT NULL DEFAULT '' COMMENT '应用名称',
`template_config` longtext COMMENT '执行任务配置',
`template_desc` longtext COMMENT '执行任务描述',
`create_user` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人',
`update_user` varchar(32) NOT NULL DEFAULT '' COMMENT '更新人',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`delete_state` int(2) NOT NULL DEFAULT '1' COMMENT '数据删除状态,1为可用,0为删除状态',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_idx_template_id` (`template_id`) USING BTREE,
KEY `idx_create_time` (`create_time`) USING BTREE,
KEY `idx_update_time` (`update_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='录制模板配置表';

CREATE TABLE `tb_task_run_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`task_run_id` varchar(64) NOT NULL DEFAULT '' COMMENT '任务运行id',
`template_id` varchar(64) NOT NULL DEFAULT '' COMMENT '任务id',
`app_name` varchar(128) NOT NULL DEFAULT '' COMMENT '应用名称',
`run_desc` longtext COMMENT '运行描述',
`run_env` varchar(32) NOT NULL DEFAULT '' COMMENT '运行环境信息',
`run_hosts` longtext COMMENT '任务执行机器列表',
`run_status` int(2) NOT NULL COMMENT '0:未开始 1:运行中 2:运行完毕',
`run_config` longtext COMMENT '运行配置',
`run_type` int(11) NOT NULL DEFAULT '0' COMMENT '任务类型(0:录制任务 1:回放任务)',
`create_user` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` varchar(32) NOT NULL DEFAULT '' COMMENT '更新人',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`task_start_time` timestamp NULL DEFAULT NULL COMMENT '任务开始时间',
`task_end_time` timestamp NULL DEFAULT NULL COMMENT '任务结束时间',
`delete_state` int(2) NOT NULL DEFAULT '1' COMMENT '数据删除状态,1为可用,0为删除状态',
`record_run_id` varchar(64) NOT NULL DEFAULT '' COMMENT '录制任务执行id',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_idx_task_run_id` (`task_run_id`) USING BTREE,
KEY `idx_create_time` (`create_time`) USING BTREE,
KEY `idx_update_time` (`update_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='任务执行表';

CREATE TABLE `tb_heartbeat_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`task_run_id` varchar(64) NOT NULL DEFAULT '' COMMENT '任务运行id',
`env` varchar(32) NOT NULL DEFAULT '' COMMENT '环境名称',
`ip` varchar(128) NOT NULL DEFAULT '' COMMENT '机器ip',
`last_heartbeat_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后上报时间--',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_task_run_id_ip` (`task_run_id`,`ip`) USING BTREE,
KEY `idx_last_heartbeat_time` (`last_heartbeat_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='心跳信息表';

CREATE TABLE `tb_special_mock_config` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`app_name` varchar(128) NOT NULL DEFAULT '' COMMENT '应用名称',
`mock_type` int(2) NOT NULL DEFAULT '0' COMMENT '特殊处理类型,1:时间相关类',
`content_json` longtext COMMENT 'json格式内容',
`create_user` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人',
`update_user` varchar(32) NOT NULL DEFAULT '' COMMENT '更新人',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_idx_app_name_mock_type` (`app_name`,`mock_type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='特殊处理表';

CREATE TABLE `tb_task_run_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`task_run_id` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '任务运行id',
`content` longtext COLLATE utf8mb4_bin COMMENT '日志内容',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='日志记录表';

CREATE TABLE `tb_agent_file` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`file_name` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文件名称',
`content` longtext COLLATE utf8mb4_bin COMMENT '文件写入路径',
`digest_hex` varchar(128) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '文件hash值',
`update_user` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '更新人',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_idx_file_name` (`file_name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='agent文件';

CREATE TABLE `tb_replay_diff_config` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`app_name` varchar(128) NOT NULL DEFAULT '' COMMENT '应用名称',
`diff_uri` varchar(512) DEFAULT '' COMMENT '当前接口uri',
`field_path` varchar(255) NOT NULL COMMENT '对比字段或者路径列表',
`diff_scope` int(2) NOT NULL COMMENT '作用范围',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_user` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人',
`update_user` varchar(32) NOT NULL DEFAULT '' COMMENT '更新人',
PRIMARY KEY (`id`),
KEY `idx_update_time` (`update_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='接口uri回放对比配置';


INSERT INTO `tb_agent_file` (file_name, content, digest_hex, update_user, create_time, update_time)
VALUES
("moonbox-agent", "/moonbox/moonbox-agent.tar", "1", "moonbox", "2023/01/01", "2023/01/01"),
("sandbox-agent", "/moonbox/sandbox-agent.tar", "1", "moonbox", "2023/01/01", "2023/01/01");

INSERT INTO tb_record_task_template (template_id,template_name,`type`,app_name,template_config,template_desc,create_user,update_user,update_time,create_time,delete_state) VALUES
('tm_id_d2506554c774ccc89a04b402f41a9705','demo',0,'moon-box-web','{"dubboRecordInterfaces":[],"httpRecordInterfaces":[{"uri":"/api/agent/test/test1","desc":"单个接口测试","sampleRate":10000}],"javaRecordInterfaces":[{"classPattern":"com.vivo.internet.moonbox.web.agent.TestAgentController","methodPatterns":["testJava"],"obtainApplicationContextMethod":"com.vivo.internet.moonbox.service.common.utils.ApplicationContextUtils","desc":"java录制测试","sampleRate":10000}],"recordCount":500,"recordTaskDuration":60,"subInvocationPlugins":["http","dubbo-provider","java-entrance","dubbo-consumer","mybatis","mybatis-plus","redis","ibatis","okhttp","apache-http-client","guava-cache","hibernate-plugin","caffeine-cache","eh-cache","spring-mongo","elasticsearch","local-date-time","java-shuffle"],"sandboxLogLevel":"INFO","repeaterLogLevel":"INFO"}','','admin','admin','2023-02-15 10:33:56.0','2022-11-10 16:18:16.0',1)
;
INSERT INTO tb_special_mock_config (app_name,mock_type,content_json,create_user,update_user,update_time,create_time) VALUES
('moon-box-web',1,'{"sysTimeMockClasses":["com.vivo.internet.moonbox.web.agent.TestAgentController"]}','admin','admin','2023-02-15 10:36:58.0','2023-02-15 10:36:58.0'),
('moon-box-web',2,'[{"className":"com.vivo.internet.nex.repeater.console.interfaces.test.DubboConsumerTest","methodList":["randParam"]}]','admin','admin','2023-02-15 10:37:35.0','2023-02-15 10:37:35.0')
;
39 changes: 39 additions & 0 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2022 vivo Communication Technology Co., Ltd.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


FROM openjdk:8u342

MAINTAINER moonbox
EXPOSE 8080
LABEL version="1.0.1" description="moonbox springboot镜像" by="moonbox"

COPY moon-box-web /moonbox/
COPY moonbox-agent.tar /moonbox/moonbox-agent.tar
COPY sandbox-agent.tar /moonbox/sandbox-agent.tar
COPY moonbox-agent.tar /root/moonbox-agent-download/moonbox-agent-1.tar
COPY sandbox-agent.tar /root/moonbox-agent-download/sandbox-agent-1.tar

RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update

RUN apt-get install dos2unix
RUN apt-get install lsof

RUN apt-get install -y openssh-server
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "root:123456" | chpasswd

CMD /etc/init.d/ssh start; cd /bin; rm sh; ln -s bash sh; java -jar /moonbox/moon-box-web
Binary file added docker/server/moon-box-web
Binary file not shown.
Binary file added docker/server/moonbox-agent.tar
Binary file not shown.
Binary file added docker/server/sandbox-agent.tar
Binary file not shown.
23 changes: 23 additions & 0 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2022 vivo Communication Technology Co., Ltd.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


FROM nginx

MAINTAINER moonbox
EXPOSE 9999
LABEL version="1.0.1" description="nginx镜像, " by="moonbox"

COPY dist /usr/share/nginx/html
COPY default.conf /etc/nginx/conf.d/
34 changes: 34 additions & 0 deletions docker/web/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2022 vivo Communication Technology Co., Ltd.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


server {
listen 9999;
server_name 127.0.0.1;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri /index.html = 404;
}

location /api/ {
proxy_pass http://moonbox-server:8080/api/;
}

error_page 500 502 503 504 /50x.html;
location = /50.html {
root html;
}
}
Binary file added docker/web/dist/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions docker/web/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel="shortcut icon" type=image/x-icon href=static/favicon.ico><title>月光宝盒</title><link href=static/css/addRecord.9fa8fb7c.css rel=prefetch><link href=static/css/addReplay.1261eccb.css rel=prefetch><link href=static/css/addReplay~executionConfig.7c4224c7.css rel=prefetch><link href=static/css/dashboard.a134081f.css rel=prefetch><link href=static/css/dubboDetail.e4e70564.css rel=prefetch><link href=static/css/httpDetail.6813a3f1.css rel=prefetch><link href=static/css/javaDetail.93cfc52a.css rel=prefetch><link href=static/css/mock.c0dbfe98.css rel=prefetch><link href=static/css/playback.a6fa2f8c.css rel=prefetch><link href=static/css/playbackJavaDetail.171a59cc.css rel=prefetch><link href=static/css/playbackJavaDetail~playbackdubboDetail~playbackhttpDetail.68f5a009.css rel=prefetch><link href=static/css/playbackdubboDetail.e529f00a.css rel=prefetch><link href=static/css/playbackhttpDetail.f28be423.css rel=prefetch><link href=static/css/record.393075da.css rel=prefetch><link href=static/js/addRecord.7834ea9f.js rel=prefetch><link href=static/js/addRecord~addReplay~agentfile~diff~dubboDetail~executionConfig~httpDetail~javaDetail~mock~playback~p~159ddad6.da79c3ec.js rel=prefetch><link href=static/js/addRecord~dashboard~dubboDetail~httpDetail~javaDetail~mock~playbackJavaDetail~playbackdubboDetail~pl~0eefbfaf.1e7d0b58.js rel=prefetch><link href=static/js/addReplay.ec2067b4.js rel=prefetch><link href=static/js/addReplay~executionConfig.b594edce.js rel=prefetch><link href=static/js/agentfile.2967715b.js rel=prefetch><link href=static/js/dashboard.3509a797.js rel=prefetch><link href=static/js/diff.24eac40c.js rel=prefetch><link href=static/js/dubboDetail.94ca6d2c.js rel=prefetch><link href=static/js/dubboDetail~httpDetail~javaDetail~playbackJavaDetail~playbackdubboDetail~playbackhttpDetail.6794aeb0.js rel=prefetch><link href=static/js/executionConfig.fdc4060e.js rel=prefetch><link href=static/js/httpDetail.3342c366.js rel=prefetch><link href=static/js/javaDetail.40202180.js rel=prefetch><link href=static/js/mock.64fa2c37.js rel=prefetch><link href=static/js/playback.5722a27d.js rel=prefetch><link href=static/js/playbackJavaDetail.77242ff7.js rel=prefetch><link href=static/js/playbackJavaDetail~playbackdubboDetail~playbackhttpDetail.104f7825.js rel=prefetch><link href=static/js/playbackdubboDetail.d68d7598.js rel=prefetch><link href=static/js/playbackhttpDetail.423347ba.js rel=prefetch><link href=static/js/record.1309a052.js rel=prefetch><link href=static/css/app.2ad668b6.css rel=preload as=style><link href=static/css/chunk-vendors.91d43fda.css rel=preload as=style><link href=static/js/app.2d30b2f7.js rel=preload as=script><link href=static/js/chunk-vendors.fb2906c3.js rel=preload as=script><link rel="shortcut icon" href=favicon.ico><link href=static/css/chunk-vendors.91d43fda.css rel=stylesheet><link href=static/css/app.2ad668b6.css rel=stylesheet></head><body><div id=app></div><script src=static/js/chunk-vendors.fb2906c3.js></script><script src=static/js/app.2d30b2f7.js></script></body></html>
1 change: 1 addition & 0 deletions docker/web/dist/static/css/addRecord.9fa8fb7c.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fd09b30

Please sign in to comment.