Building Apps
The following commands require a session
Check the Quickstart guide on how to login.
Managing packaged apps¶
Packaging an app¶
Once the application is complete, it must be packaged so it can be locally tested with the emulation system or deployed to a real machine.
This can be achieved with the kelvin app build command.
- This command takes the following options:
--app-dir, the path to the app folder. If not specified, will assume the current directory.--fresh, to indicate whether or not the build process should start from scratch without resorting to cache.
# kelvin app build --app-dir=<app_dir_path> --fresh=<fresh> --verbose
kelvin app build
Success
[kelvin.sdk][2021-07-06 15:06:35][I] Assessing basic application info..
[kelvin.sdk][2021-07-06 15:06:35][I] Valid schema available locally. Using cached version (/Users/rsvieira/.config/kelvin/schemas/2.0.0.json)
[kelvin.sdk][2021-07-06 15:06:36][I] Building "Kelvin type" application "my-app"
[kelvin.sdk][2021-07-06 15:06:36][R] Loading PyPi credentials from file "pip.conf": "https://first.last:******@nexus.kelvininc.com/repository/pypi-kelvin/simple"
[kelvin.sdk][2021-07-06 15:06:37][I] Processing application data types..
[kelvin.sdk][2021-07-06 15:06:37][I] Loading all data type files from directory "/Users/rsvieira/.config/kelvin/datatypes"
[kelvin.sdk][2021-07-06 15:06:37][R] 13 data types loaded from directory "/Users/rsvieira/.config/kelvin/datatypes"
[kelvin.sdk][2021-07-06 15:06:37][I] Retrieving data types for "my-app"
[kelvin.sdk][2021-07-06 15:06:39][R] Successfully logged on registry "demo.kelvininc.com:5000"
[kelvin.sdk][2021-07-06 15:06:39][I] Pulling "demo.kelvininc.com:5000/kelvin-core-python:7.0.1" from "demo.kelvininc.com"
[elapsed: 00:00] - [Layer: 7.0.1] [Pending..]
[kelvin.sdk][2021-07-06 15:06:41][R] Successfully pulled "demo.kelvininc.com:5000/kelvin-core-python:7.0.1" from "demo.kelvininc.com"
[kelvin.sdk][2021-07-06 15:06:41][I] Pulling "demo.kelvininc.com:5000/data-model-builder:6.0.0" from "demo.kelvininc.com"
[elapsed: 00:00] - [Layer: 6.0.0] [Pending..]
[kelvin.sdk][2021-07-06 15:06:42][R] Successfully pulled "demo.kelvininc.com:5000/data-model-builder:6.0.0" from "demo.kelvininc.com"
[kelvin.sdk][2021-07-06 15:06:42][I] Building new image for "my-app:1.0.0". Please wait..
[kelvin.sdk][2021-07-06 15:07:41][R] Image successfully built: "my-app:1.0.0"
Now that the image is built and available in the local system, it is time to see the image management chapter.
Listing built apps¶
Once built, images will be available on the local registry and can be listed with the following command:
kelvin app images list
Success
[kelvin.sdk][2021-01-13 15:21:49][I]
*************************** Existing Apps ***************************
+-----------------+---------------------+
| Applications | Created |
|-----------------+---------------------|
| my-app:1.0.0 | 2021-01-13 14:07:42 |
| my-app:latest | 2021-01-13 14:07:42 |
| injector:0.0.0 | 2021-01-13 13:28:24 |
| injector:latest | 2021-01-13 13:28:24 |
+-----------------+---------------------+
[kelvin.sdk][2021-01-13 15:21:49][I]
*************************** Running Apps ***************************
+------------------------+-----------------+------------------+---------------------------+
| Running applications | Containers | Up and running | Ports (container->host) |
|------------------------+-----------------+------------------+---------------------------|
| my-app:1.0.0 | ['my-app.app'] | True | [tcp:48010->55028] |
+------------------------+-----------------+------------------+---------------------------+
Remove built apps¶
An app can be deleted from the local registry with the kelvin app images remove command.
- This command takes the following argument:
- app-name-with-version, the name and version of the app to remove from the local registry. E.g.
my-app:1.0.0
- app-name-with-version, the name and version of the app to remove from the local registry. E.g.
kelvin app images remove my-app:1.0.0
Success
[kelvin.sdk][2021-01-13 15:30:45][I] Removing packaged application "my-app:1.0.0"
[kelvin.sdk][2021-01-13 15:30:45][I] Stopping containers of "my-app:1.0.0"
[kelvin.sdk][2021-01-13 15:30:55][I] Containers of "my-app:1.0.0" successfully stopped
[kelvin.sdk][2021-01-13 15:30:55][I] Image "my-app:1.0.0" successfully removed
[kelvin.sdk][2021-01-13 15:30:56][I] Stopping containers of "my-app:latest"
[kelvin.sdk][2021-01-13 15:30:56][I] Containers of "my-app:latest" successfully stopped
[kelvin.sdk][2021-01-13 15:30:56][I] Image "my-app:latest" successfully removed
[kelvin.sdk][2021-01-13 15:30:56][R] Successfully removed application: "my-app:1.0.0"
Unpacking built apps¶
Similar to the packaging process, an application can be unpacked and it source code accessed.
If the application resides in the platform registry and you wish to access its source code locally,
first it must be downloaded with the kelvin appregistry download command.
More information on how to download an application from the platform registry:
Check the Download an application from the platform registry.
The complete list of app images (locally built or downloaded from the platform registry) can be consulted with the kelvin app images list command.
Considering the application is now available on the local registry, the unpacking operation can be achieved with the kelvin app images unpack command.
- This command takes the following arguments:
- app_name, the name of the app to unpack.
- output_dir, the directory into which the application will be unpacked.
kelvin app images unpack my-app:1.0.0 myout-dir/
Success
[kelvin.sdk][2021-01-13 15:50:35][I] Unpacking application "my-app:1.0.0" to directory "myoutput-dir"
[kelvin.sdk][2021-01-13 15:50:41][R] Application "my-app:1.0.0" successfully unpacked to "myoutput-dir"
The output directory should have the following structure:
myoutput-dir
├── app.yaml
├── build/
├── app.yaml
└── datatype/
├── raw_float32__2-0-0.yml
├── ...
└── raw_text__2-0-0.yml
├── data/
├── datatype/
├── docs/
├── my_app/
├── __init__.py
└── my_app.py
├── requirements.txt
├── run_app
├── setup.py
├── venv/
├── tests/
├── __init__.py
└── test_application.py
└── wheels/