Skip to content

Dev Environment Setup

dexterdreeeam edited this page Apr 20, 2023 · 4 revisions

This wiki will guide you through the dev environment set, build, and project run. Please refer to CONTRIBUTING.md if you care more about the collaboration model, PR review, or coding conventions.

Prepare your IDE

We recommend using IntelliJ IDEA as the Java/SpringBoot project IDE, and the community edition would suffice. img.png

Select correto-11 JDK in project structure and click apply.
Add-ons including JPA Buddy and PlantUML Integration are strongly recommended.

For code design we leverage the PlantUML as UML tools. Therefore, you can install the PlantUML Integration plugin to preview the design diagrams. For instance, you can view agent side code design in folder: agent/doc/UML.

And for the front-end React powered Web UI, the code lives in react folder, you may take Visual Studio Code as editor. Please refer to the react/README.md to understand the setup procedures.

To learn how to build the code and run tests, follow the instructions in the README.

Set up the dev environment

  1. Install Java SDK link (at least jdk 11, or skip this if you are using the IDEA provided JDK)
  2. Install Python 3.7+ link
  3. Install Android SDK link
  4. Install Node.js link, Win-ARM64
  5. [Optional] Install Appium execute npm install -g appium
  6. [Optional] Install WinAppdriver 1.2.1
  7. [Optional] Install FFmpeg: Download ffmpeg-release-essentials.7z from link, unzip and add bin folder into PATH
  8. Install Gradle as the build tool by using the gradlew/gradlew.bat commandline.
  9. Config Environment Variables - System variables (take this as a reference)
Type Variable Name Example Value
Java JAVA_HOME C:\Program Files\Java\jdk-11.0.14
Java CLASSPATH .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
Java Path %JAVA_HOME%\bin
Java Path %JAVA_HOME%\jre\bin
Python Path C:\Python38
Python Path C:\Python38\Scripts
Android ANDROID_HOME C:\Users\demo\AppData\Local\Android\Sdk
Android ANDROID_PLATFORM_TOOLS C:\Users\demo\AppData\Local\Android\Sdk\platform-tools
Android Path %ANDROID_HOME%
Android Path %ANDROID_PLATFORM_TOOLS%
Node NODE_PATH C:\Users\demo\AppData\Roaming\npm\node_modules
Node Path C:\Users\demo\AppData\Roaming\npm;C:\Program Files\nodejs
Appium APPIUM_BINARY_PATH C:\Users\demo\AppData\Roaming\npm\node_modules\appium\build\lib\main.js
FFmpeg Path C:\Program Files\ffmpeg-4.4.1-essentials_build\bin

Build the front-end project

Go to react folder, & run:

cd react
npm ci
npm run pub

You may refer to the README to learn more about the WebUI project.

Config Hydra Lab Center

If you want to enable OAuth2, please set up an AAD Client in Azure and set the spring.security.oauth2.enabled in application.yml to true. Learn more.

If you want a quick pilot and don't care about the Oauth2 enablement, then simply leave the spring.security.oauth2.enabled with false, and build and run the Hydra Lab center service in localhost with the following commands.

Note: Hydra Lab uses Azure Blob Storage as a cloud file storage solution to persist log files, video, app packages, etc. Please go to your Azure portal and open an Azure blob storage account, and get the connection string, and place it in the env var with the name BLOB_CONNECTION_STR. Then you can run the center jar with the following command:

# In the project root, switch to react folder to build the Web front.
cd react
npm ci
npm run pub
# Get back to the project root, and assemble the center runnable Jar
cd ..
gradlew :center:bootJar
# Run it, and then visit http://localhost:9886/portal/index.html#/
java -jar center/build/libs/center.jar
# Then visit http://localhost:9886/portal/index.html#/auth to generate a new agent ID and agent secret.

5.Config Hydra Lab Agent

Register a agent in Hydra Lab Center and then add modify the application.yml file in Hydra-Lab root folder.

app:
  # register to Hydra Lab Center
  registry:
    # The server hostname:port of Hydra Lab Center. If nginx enabled, switch to port of nginx
    server: {SERVER_HOSTNAME_PORT}
    # The Agent info registered in Hydra Lab Center
    id: {YOUR_REGISTERED_AGENT_ID}
    secret: {YOUR_REGISTERED_AGENT_SECRET}
    # TODO Maybe we can save this effort, user can provide name in the center portal and we can get the name from center.
    name: {YOUR_AGENT_NAME}
    # Agent Type {1 : 1*WINDOWS + n*ANDROIDS , 2 : 1*WINDOWS+1*ANDROID , 3 : iOS}
    agent-type: {YOUR_AGENT_TYPE_INDEX}

image

image

Clone this wiki locally