|
| 1 | +<!-- |
| 2 | +
|
| 3 | + Licensed to the Apache Software Foundation (ASF) under one |
| 4 | + or more contributor license agreements. See the NOTICE file |
| 5 | + distributed with this work for additional information |
| 6 | + regarding copyright ownership. The ASF licenses this file |
| 7 | + to you under the Apache License, Version 2.0 (the |
| 8 | + "License"); you may not use this file except in compliance |
| 9 | + with the License. You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | + Unless required by applicable law or agreed to in writing, |
| 14 | + software distributed under the License is distributed on an |
| 15 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | + KIND, either express or implied. See the License for the |
| 17 | + specific language governing permissions and limitations |
| 18 | + under the License. |
| 19 | +
|
| 20 | +--> |
| 21 | + |
| 22 | +## Apache InLong dev toolkit |
| 23 | + |
| 24 | +### Overview |
| 25 | + |
| 26 | +The Apache InLong project includes modules such as "Dashboard", "DataProxy", "Manager" and "TubeMQ". |
| 27 | +When debugging in a development environment such as `Intellij IDEA`, |
| 28 | +The environment is difficult to build. |
| 29 | + |
| 30 | +Take the `inlong-manager` as an example, it depends on too many configurations and packages. |
| 31 | +When debugging locally in the IDE, multiple default directories need to be created, which is more complicated. |
| 32 | +So a script is urgently needed to quickly support local debugging. |
| 33 | + |
| 34 | +Also, similar tools are required for local debugging of other modules. |
| 35 | +Temporarily named `InLong dev toolkit`, looking forward to adding more features. |
| 36 | + |
| 37 | +### Use case |
| 38 | + |
| 39 | +#### Help |
| 40 | + |
| 41 | +```shell |
| 42 | +❯ inlong-tools/dev/inlong-dev-toolkit.sh |
| 43 | +#################################################################################### |
| 44 | +# Welcome to use the Apache InLong dev toolkit! # |
| 45 | +# @2022-12-23 20:38:34 # |
| 46 | +#################################################################################### |
| 47 | + |
| 48 | + |
| 49 | +inlong-tools/dev/inlong-dev-toolkit.sh help | h |
| 50 | + :help |
| 51 | + |
| 52 | +inlong-tools/dev/inlong-dev-toolkit.sh manager | m |
| 53 | + :build manager local debugging environment |
| 54 | + |
| 55 | +Have a nice day, bye! |
| 56 | + |
| 57 | +``` |
| 58 | + |
| 59 | +#### Manager |
| 60 | + |
| 61 | +Rely of Manager: |
| 62 | + |
| 63 | +| Directory/File | link target | Rely modules | |
| 64 | +|--------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|---------------------------------| |
| 65 | +| `./plugins` | `inlong-manager/manger-plugins/target/plugins` | `inlong-sort/sort-plugin` | |
| 66 | +| `./inlong-sort/connectors` | - | `inlong-sort/sort-connectors/*` | | |
| 67 | +| `./inlong-sort/connectors/sort-connector-${name}-${project.version}.jar` | `inlong-sort/sort-connectors/${connector.name}/target/sort-connector-${connector.name}-${project.version}.jar` | `inlong-sort/sort-connectors/*` | |
| 68 | +| `./sort-dist.jar` | `sort-dist/target/sort-dist-${project.version}.jar` | `inlong-sort/sort-dist` | |
| 69 | + |
| 70 | +```shell |
| 71 | +❯ inlong-tools/dev/inlong-dev-toolkit.sh m |
| 72 | +Execute action: manager |
| 73 | +# start build manager local debugging environment ... |
| 74 | +current_version: 1.5.0-SNAPSHOT |
| 75 | +associate plugins directory: inlong-manager/manager-plugins/target/plugins |
| 76 | +associate sort dist: inlong-sort/sort-dist/target/sort-dist |
| 77 | +recreate connector dir: inlong-sort/connectors |
| 78 | +All connector names: |
| 79 | +hive mysql-cdc kafka jdbc pulsar iceberg postgres-cdc mongodb-cdc sqlserver-cdc oracle-cdc elasticsearch-6 elasticsearch-7 redis tubemq filesystem doris starrocks hudi |
| 80 | +associate connector: hive |
| 81 | +associate connector: mysql-cdc |
| 82 | +associate connector: kafka |
| 83 | +associate connector: jdbc |
| 84 | +associate connector: pulsar |
| 85 | +associate connector: iceberg |
| 86 | +associate connector: postgres-cdc |
| 87 | +associate connector: mongodb-cdc |
| 88 | +associate connector: sqlserver-cdc |
| 89 | +associate connector: oracle-cdc |
| 90 | +associate connector: elasticsearch-6 |
| 91 | +associate connector: elasticsearch-7 |
| 92 | +associate connector: redis |
| 93 | +associate connector: tubemq |
| 94 | +associate connector: filesystem |
| 95 | +associate connector: doris |
| 96 | +associate connector: starrocks |
| 97 | +associate connector: hudi |
| 98 | +build dev env of manager finished. |
| 99 | +Have a nice day, bye! |
| 100 | +``` |
| 101 | + |
| 102 | +### Development: add more function |
| 103 | + |
| 104 | +#### Public variables |
| 105 | + |
| 106 | +| inner variable | implication | |
| 107 | +|--------------------|-----------------------------------| |
| 108 | +| `script_dir` | the directory of this script file | |
| 109 | +| `script_file_name` | the script file name | |
| 110 | +| `base_dir` | the root directory of project | |
| 111 | + |
| 112 | +#### Step 1. implement function |
| 113 | + |
| 114 | +#### Step 2. register function |
| 115 | + |
| 116 | +Create a global array variable: |
| 117 | + |
| 118 | +- It is recommended to end with `_action`, such as `manager_action`. |
| 119 | +- It must have 4 elements. |
| 120 | +- The 1st element is the long opt command. |
| 121 | +- The 2nd element is the sort opt command. |
| 122 | +- The 3rd element is the details of the function. |
| 123 | +- The 4th element is the function name, which implements in Step 1. |
| 124 | + |
| 125 | +Add the variable to the `actions` array, like: |
| 126 | + |
| 127 | +```shell |
| 128 | +actions=( |
| 129 | + help_action |
| 130 | + manger_action |
| 131 | +) |
| 132 | +``` |
| 133 | + |
| 134 | +#### Step 3. ignore the temporary file |
| 135 | + |
| 136 | +Add temporary files to `.gitignore` |
| 137 | + |
| 138 | +> Notice: must base on project base directory |
0 commit comments