|
1 | 1 | # Seat-adjuster example
|
2 | 2 |
|
| 3 | +:warning: This example is currently not executable from within the vehicle-app-pytthon-sdk's devContainer. Please use the "import example" feature of the related [vehicle-app-python-template repository](https://github.com/eclipse-velocitas/vehicle-app-python-template). Also, building the docker container for this example needs to be done after the import within the Python template's devContainer. |
3 | 4 |
|
4 |
| -## Launch the seat-adjuster example |
5 | 5 |
|
6 |
| -```bash |
7 |
| -cd examples/seat-adjuster/src |
| 6 | +## Run this example from your Python app development repo |
8 | 7 |
|
9 |
| -dapr run --app-id seatadjuster --app-protocol grpc --app-port 50008 --config ../../.dapr/config.yaml --resources-path ../../.dapr/components python3 main.py |
| 8 | +It is possible to import and run this example from your app development repository, which you already have created or could create from our [vehicle-app-python-template repository](https://github.com/eclipse-velocitas/vehicle-app-python-template). |
| 9 | + |
| 10 | +1. Importing the example |
| 11 | + |
| 12 | + Use the VS Code task `Import example app from SDK` (to get there press `Ctrl+Shift+P` and select `Tasks: Run Task`) and choose `seat-adjuster` from the list. |
| 13 | + |
| 14 | + :warning: Make sure you have commited or stash all your possible changes within the `app` folder, because the files of that folder will be overwritten by the files of this example. |
| 15 | + |
| 16 | +2. Running this example with Dapr middleware |
| 17 | + |
| 18 | + Use the VS Code tasks `Local Runtime - Up` and `Local Runtime - Run VehicleApp` to start the necessary runtime components and this app itself. |
| 19 | + |
| 20 | + Alternatively, the app can also be deployed in a k3d runtime - use task `K3D Runtime - Deploy VehicleApp`. |
| 21 | + |
| 22 | + |
| 23 | +## Executing with "native" middleware (without Dapr runtime) |
| 24 | + |
| 25 | +If you like to run this example without using Dapr as middleware, you may need to provide some environment variables to the seat-adjuster process, which define the middleware type being _native_ and where to find the required runtime components: |
| 26 | + |
| 27 | +| Variable name | Default value | Description |
| 28 | +|---------------------------------|----------------------------|------------- |
| 29 | +| `SDV_MIDDLEWARE_TYPE` | `"dapr"` | Defines the middleware type -> set to `"native"` |
| 30 | +| `SDV_MQTT_ADDRESS` | `"mqtt://localhost:1883"` | Address (and port) of the MQTT broker |
| 31 | +| `SDV_VEHICLEDATABROKER_ADDRESS` | `"grpc://localhost:55555"` | Address (and port) of the KUKSA Data Broker |
| 32 | + |
| 33 | + |
| 34 | +## Building a Docker image |
| 35 | + |
| 36 | +This example app provides a Dockerfile to enable creating a Docker container image to run it. |
| 37 | +The image must be build passing the repositories root folder as build context, e.g.: |
| 38 | + |
| 39 | +``` bash |
| 40 | +docker build -f app/Dockerfile . |
| 41 | +``` |
| 42 | + |
| 43 | +:warning: If your build environment works behind (corporate) **proxy**, please remember telling docker your proxy configuration. |
| 44 | +If you've set the respective environment variables, this might work: |
| 45 | + |
| 46 | +``` bash |
| 47 | +docker build -f app/Dockerfile . --build-arg http_proxy --build-arg HTTP_PROXY --build-arg https_proxy --build-arg HTTPS_PROXY --build-arg no_proxy --build-arg NO_PROXY |
10 | 48 | ```
|
0 commit comments