Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use submodule instead of copied files from theme #81

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install hugo
env:
HUGO_VER : 0.103.1
HUGO_VER : 0.123.7
run: |
curl -LO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VER}/hugo_${HUGO_VER}_linux-amd64.deb
sudo dpkg -i hugo_${HUGO_VER}_linux-amd64.deb
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "themes/hugo-universal-theme"]
path = themes/hugo-universal-theme
url = https://github.com/devcows/hugo-universal-theme
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# kuksa-website
Sources of the Kuksa website

For development you need to build the files through ```hugo --environment development```

Generated GitHub Pages available at https://eclipse-kuksa.github.io/kuksa-website/.
In addition https://www.eclipse.org/kuksa/ can also be used as link to the generated pages.

## How to build

Make sure to check out the theme submodule

For development you need to build the files through ```hugo --environment development```
```
git submodule update --init
```

You can run a local instance for testing purposes like below.

Expand Down
7 changes: 0 additions & 7 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,3 @@ paginate = 10
[params.about]
enable = true
title = "About Eclipse KUKSA"

[[module.imports]]
path = "github.com/eclipse/kuksa.val"

[[module.imports.mounts]]
source = "doc/quickstart.md"
target = "content/quickstart.md"
210 changes: 210 additions & 0 deletions content/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# KUKSA.val Quickstart

The quickest possible way to get KUKSA.val up and running

*Note: The examples in this document do not use TLS or access control.*

## Starting broker
First we want to run KUKSA.val databroker

```
docker run -it --rm --net=host ghcr.io/eclipse/kuksa.val/databroker:master --insecure
```


## Reading and Writing VSS data via CLI
You can interact with the VSS datapoints using the cli clients. The first option is databroker-cli.

This is, how you start it:

```
docker run -it --rm --net=host ghcr.io/eclipse/kuksa.val/databroker-cli:master
```

Here is how you can use it:

```
client> get Vehicle.Speed
-> Vehicle.Speed: ( NotAvailable )
client> feed Vehicle.Speed 200
-> Ok
client> get Vehicle.Speed
-> Vehicle.Speed: 200.00
client> quit
Bye bye!

```

An alternative is the kuksa-client CLI (based on our Python client library).

Here is how you start it:

```
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-python-sdk/kuksa-client:main
```

Here is how you can use it:


```
Test Client> getValue Vehicle.Speed
{
"path": "Vehicle.Speed"
}

Test Client> setValue Vehicle.Speed 200
OK

Test Client> getValue Vehicle.Speed
{
"path": "Vehicle.Speed",
"value": {
"value": 200.0,
"timestamp": "2023-01-16T12:43:57.305350+00:00"
}
}

Test Client> quit
gRPC channel disconnected.

```

## Reading and Writing VSS data with code

To realize your ideas with KUKSA.val you need to write programs that interact with its API. The easiest way to achieve this is using our Python library.

### Generating data
Create a file `speed_provider.py` with the following content

```python
from kuksa_client.grpc import VSSClient
from kuksa_client.grpc import Datapoint

import time

with VSSClient('127.0.0.1', 55555) as client:
for speed in range(0,100):
client.set_current_values({
'Vehicle.Speed': Datapoint(speed),
})
print(f"Feeding Vehicle.Speed to {speed}")
time.sleep(1)
print("Finished.")
```

Do a `pip install kuksa-client` and start with

```
python ./speed_provider.py
```

### Subscribing data:
Create a file `speed_subscriber.py` with the following content

```python
from kuksa_client.grpc import VSSClient

with VSSClient('127.0.0.1', 55555) as client:

for updates in client.subscribe_current_values([
'Vehicle.Speed',
]):
speed = updates['Vehicle.Speed'].value
print(f"Received updated speed: {speed}")
```

Do a `pip install kuksa-client` and start with

```
python ./speed_subscriber.py
```

## FAQ & Notes
Frequently anticipated questions and tips.

### This is not working on OS X
Unfortunately OS X has a bug that does not allow you to use the Databroker default port 55555. To change when starting the server:

```
docker run -it --rm --net=host ghcr.io/eclipse/kuksa.val/databroker:master --port 55556 --insecure
```

Using the databroker-cli

```
docker run -it --rm --net=host -e KUKSA_DATA_BROKER_PORT=55556 ghcr.io/eclipse/kuksa.val/databroker-cli:master
```

Using kuksa-client CLI

```
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-python-sdk/kuksa-client:main grpc://127.0.0.1:55556
```

### Docker desktop: Host networking not supported
The examples above all used docker's `--net=host` option. That is quite convenient for development, as basically your containers "share" your hosts networking and there is no need for any port publishing.

However when using Docker Desktop on Mac OS or Windows, [host networking is not supported](https://docs.docker.com/network/host/).

One alternative is using a Docker distribution, that does support it even on Mac OS or Windows. [Rancher Desktop](https://rancherdesktop.io) is an alternative that does.

With Docker Desktop you can still forward ports, so this should work:

```
docker run -it --rm --publish 55556:55556 ghcr.io/eclipse/kuksa.val/databroker:master --port 55556 --insecure
```

From your host computer you can now reach databroker at `127.0.0.1:55556`. To connect from another container, you need to use your computers IP address (**not** 127.0.0.1), i.e. to use the client

```
docker run -it --rm -e KUKSA_DATA_BROKER_PORT=55556 -e KUKSA_DATA_BROKER_ADDR=<YOUR_IP> ghcr.io/eclipse/kuksa.val/databroker-cli:master
```

Recent versions of the databroker-cli also support command line arguments, so you can also write

```
docker run -it --rm ghcr.io/eclipse/kuksa.val/databroker-cli:master --server http://<YOUR_IP>:55556
```



### feed/set: Why is my data not updated?
Some VSS points are "sensors", e.g. Vehicle.Speed. You can read/get Vehicle speed, but we are not expecting to be able to influence it via VSS.
Historically components, that gather the actual vehicle speed from some sensors/busses in a vehicle and providing a VSS representation to kuksa.val have been called `feeders`. Hence, to update the current speed in the Rust-cli, you use

```
feed Vehicle.Speed 200
```

while in the Python-cli you use

```
set Vehicle.Speed 200
```

The other thing, that VSS provides you are "actuators" `Vehicle.Body.Trunk.Rear.IsOpen`. The most important thing to remember about actuators: Every actuators is also a sensor, so everything written on top applies as well!
The second-most important thing is: For VSS actuatorss, it is expected that you might be able to influence the state of the real Vehicle by writing to them. So while being used as a sensor, you will get the current position of the Window in the example, you might also want to set the _desired_ position.

You express this in the databroker-cli as

```
set Vehicle.Body.Trunk.Rear.IsOpen true
```

In kuksa-client cli you do

```
Test Client> setValue -a targetValue Vehicle.Body.Trunk.Rear.IsOpen True
```

In the code examples above you would do

```python
client.set_target_values({
'Vehicle.Body.Trunk.Rear.IsOpen': Datapoint(True),
})
```


### All I see is Python, shouldn't this be high-performance?
Our Python library makes it easy to interact with databroker. While this is often sufficient for many applications, you are not limited by it: Databroker's native interface is based on GRPC, a high-performance GRPC framework. GRPC enables you to generate bindings for _any_ language. Check the [GRPC website](https://grpc.io) and take a look at the [databroker interface definitions](https://github.com/eclipse/kuksa.val/tree/master/proto/kuksa/val/v1).
3 changes: 0 additions & 3 deletions go.mod

This file was deleted.

1 change: 1 addition & 0 deletions themes/hugo-universal-theme
Submodule hugo-universal-theme added at 37171f
4 changes: 0 additions & 4 deletions themes/hugo-universal-theme/.eslintignore

This file was deleted.

6 changes: 0 additions & 6 deletions themes/hugo-universal-theme/.eslintrc.yml

This file was deleted.

4 changes: 0 additions & 4 deletions themes/hugo-universal-theme/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions themes/hugo-universal-theme/.travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions themes/hugo-universal-theme/LICENSE

This file was deleted.

Loading