Skip to content

Latest commit

 

History

History
executable file
·
167 lines (119 loc) · 4.53 KB

compile-running.mdx

File metadata and controls

executable file
·
167 lines (119 loc) · 4.53 KB
title date type weight
TIS编译&运行
2020-03-22
book
10

前言

如要为TIS贡献代码,首先应在本地环境中将TIS运行起来。本文向大家介绍从克隆代码仓库中代码,到编译并且运行TIS的每个步骤。

:::tip 作者开发使用是macOS操作系统,安装过程中需要用到shell脚本,推荐大家也使用macOS操作系统进行开发 :::

克隆代码

一个完整的TIS应用,由以下三个子工程构成:

  1. TIS主干逻辑 https://github.com/datavane/tis
  2. TIS插件 https://github.com/qlangtech/plugins
  3. 前端逻辑 https://github.com/qlangtech/ng-tis

分别将他们clone到本地目录中

    git clone git@github.com:datavane/tis.git

    git clone git@github.com:qlangtech/plugins.git

    git clone git@github.com:qlangtech/ng-tis.git

编译&构建

编译 datavane/tis 项目

cd tis
mvn clean install -Dmaven.test.skip=true -Ptis-repo

:::caution 由于qlangtech/plugins 项目需要依赖 datavane/tis 中的artifact,因此以上Maven执行命令中需要使用install :::

编译 qlangtech/plugins 项目

cd plugins
mvn clean package -Dmaven.test.skip=true -Dappname=all -Ptis-repo

:::caution Java系统参数-Dappname=all 会控制Maven插件执行 assemble-plugin执行,不要遗漏 :::

构建 qlangtech/ng-tis

安装nodejs依赖的包node_modules

cd ng-tis
npm install

安装Angular cli工具(具体版本要与ng-tis/package.json中Angular的依赖版本相一致)

npm install -g @angular/cli@12.2.13

如果之前已经安装了其他版本的@angular/cli,可以先将其删除再安装

npm uninstall -g @angular/cli

启动&调试

安装数据库

  1. 需要准备一个MySQL5.7节点

  2. 执行Sql脚本https://github.com/qlangtech/tis-ansible/blob/master/tis_console_mysql.sql进行tis_console数据库初始化

  3. 本地项目中配置数据库连接信息 配置文件路径:/tis/tis-web-config/config.properties

     tis.datasource.type=mysql
     tis.datasource.url=192.168.28.1
     tis.datasource.port=3306
     tis.datasource.username=root
     tis.datasource.password=111111
     tis.datasource.dbname=tis_console
     zk.host=192.168.28.1:2181/tis/cloud
    
     assemble.host=192.168.28.1
     tis.host=192.168.28.1

    以上配置文件中IP相关都可以配置成本地IP地址

创建Plugin软链接

由于TIS启动会默认到本地目录/opt/data/tis/libs/plugins中加载插件,所以需要将之前plugins项目打包之后生成的plugins软链到 /opt/data/tis/libs/plugins

具体执行命令为:

cd 'path of qlangtech/plugins项目'
for f in `find ./  -name '*.tpi' -print`
do
   echo " ln -s $f "
   ln -s $f /opt/data/tis/libs/plugins/${f##*/}
done ;

启动TIS Console

  1. cd tis/tis-console/src/test/java/

  2. 创建初始化token文件:

       touch /opt/data/tis/system_initialized_token
  3. 运行 StartTISWeb 单元测试

    mvn compile test -Dtest=StartTISWeb

    启动过程需要指定以下JVM参数:

      -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=50001 -Dtis.launch.port=8080

    开启50001的远程调试端口,并且以8080端口运行http servlet

启动TIS Web

  1. cd ng-tis
  2. 编译:
     npm run ng:serve-aot
  3. 运行
  npm run ng:serve-jit --scripts-prepend-node-path=auto
  1. 打开 web 入口:http://localhost:4200/

启动Assemble Web

Assemble节点负责执行TIS Console提交过来批量执行任务

  1. cd tis/tis-assemble/src/test/java/
  2. 运行 StartAssembleWeb 单元测试