12. App Build, Stage, Deploy, Run, and Debug
Bazel build will build the targets, but you need to include configuration files, libraries, and executables to deploy the comp apps. Here are scripts in uli_sdk/build directory coming to help:
12.1 App Build
The script, build/app_build.sh, builds the app package for the target machine, x86_64 or jetpack44. Here is the usage:
Usage: ./build/app_build.sh [–out_path build_output] -p [bazel_target_of_package] -d [x86_68 | jetpack44]
Defaults: –out_path ~/uli_build
For example:
- builds the dash_board app package for x86_64 target machine.
% ./build/app_build.sh -d x86_64 -p //apps/dash_board:dash_board-pkg
- builds the nm app package for jetpack44 target machine.
% ./build/app_build.sh -d jetpack44 -p //apps/nm:nm-pkg
12.2 App Stage
The script, build/app_stage.sh, stages the build outputs of app packages to the stage directory. Here is the usage:
Usage: ./build/app_stage.sh [–out_path build_directory] [–stage_path stage_directory] [–clean] -d [x86_64 | jetpack44] package …
Defaults: –out_path ~/uli_build
–stage_path ~/uli_stage
For example:
- stage the dash_board app package for the target machine x86_64 to the stage directory
% ./build/app_stage.sh -d x86_64 //apps/dash_board:dash_board-pkg
- stage the nm app package for the target machine jetpack44 to the stage directory
% ./build/app_stage.sh -d jetpack45 //apps/nm:nm-pkg
- cleans the stage area for the target machine jetpack44
% ./build/app_stage.sh -d jetpack45 –clean
12.3 App Deploy
The script, build/app_deploy.sh, deploys the app packages in the stage directory to the deploy directory of the target machine. Here is the usage:
Usage: ./build/app_deploy.sh -h [localhost | remote_host_ip] [–remote_user remote_user] [–stage_path stage_directory] -d device [–xconfig]
Defaults: –remote_user ovt
–stage_path ~/uli_stage
For example:
- deploys the app packages in the stage area for the target machine x86_64 to the local host:
% ./build/app_deploy.sh -d x86_64 -h localhost
- deploys the app packages in the stage area for the target machine jetpack44 to the host 192.168.50.122 for remote user “foo”:
% ./build/app_deploy.sh -d jetpack45 -h 192.168.50.122 –remote_user foo
Note that this command copies the executables and configurations from the stage directory. It will erase the configurations. Append –xconfig if you want to retain the configurations:
% ./build/app_deploy.sh -d jetpack45 -h 192.168.50.122 –remote_user foo –xconfig
12.4 Run
To run a Uli SDK app, it is needed to have the <app_name>.cfg and <app_name>.json files in the working directory.
The <app_name>.cfg contains configurations for the logging level and the name of the JSON configuration file, <app_name>.json.
The JSON configuration file is to configure the services. When the comp app is deployed, an empty <app_name>.json file is also copied to the deploy directory. However, a JSON file with default configurations can be obtained by running the comp app with –params switch.
For example, the following fills the default configurations to dash_board.json file.
% cd uli_deploy
% ./dash_board –params
Refer to the service documentations for the definitions of the parameters in the json configuration file.
12.5 Debug
You can setup VS Code to debug comp apps. Two steps are needed:
- add a task to tasks.json for building the app with debug and not stripping the symbols.
- add a configuration to launch.json, which uses the task created in 1). Refer to Appendix B for examples of the task and configuration to debug dash_board.
Once set up the task and configuration, you can run the configuration from the “run” icon in the VS Code.