Smart Cities is an edge resource scheduling solution.
This guide setup a cluster network, one switch run with k3s server , one Nvidia Nona run with k3s node.
EdgeFaaS provide API to access the cluster network's capability.
Apache License v2.0
The document describes how to compile demo app from source code, and deploy to device.
$ git clone git clone "https://gerrit.akraino.org/r/a/cassini"
$ cd cassini/smartcities/parsec
$ cargo build --release --features "mbed-crypto-provider,direct-authenticator"
The compiled binary executable is in ./target/release/parsec.
Template of config file is in ./config.toml, it will be modify when deloy.
Template of parsec.service file is in ./systemd-daemon/parsec.service it will be modify when deloy.
$ cd cassini/smartcities/ParsecClient/
$ ./build.sh
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
parsec-client v1.0 aef2a010b6b5 3 months ago 17.3MB
$ sudo docker save aef2a010b6b5 > parsec-client-v1.0-docker-aarch64.tar
The saved parsec-client-v1.0-docker-aarch64.tar will use to delpoy on SONiC and Nvidia Nona.
$ cd cassini/smartcities/NodeAuthServer/
$ go build
$ cd cassini/smartcities/NodeAuthAgent/
$ go build
$ cd cassini/smartcities/CameraClient/
$ go build
$ cd cassini/smartcities/TritonClient/
$ ./build.sh
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
triton
-client v1.0 deaf4b1027ed 3 weeks ago 1.32 GB
$ sudo docker save deaf4b1027ed > triton-client-v1.0-docker-aarch64.tar
The saved triton-client-v1.0-docker-aarch64.tar will use to delpoy on Nvidia Nona.
Baud rate: 115200
Data bit: 8
Parity: None
Stop bits: 1
Contorol: None
$ sudo useradd -m parsec
$ sudo passwd parsec
$ sudo usermod -s /bin/bash parsec
$ sudo groupadd parsec-clients
$ sudo mkdir /var/lib/parsec
$ sudo chown parsec:parsec /var/lib/parsec
$ sudo chmod 700 /var/lib/parsec
$ sudo mkdir /etc/parsec
$ sudo chown parsec:parsec /etc/parsec
$ sudo chmod 700 /etc/parsec
$ sudo mkdir /usr/libexec/parsec
$ sudo chown parsec:parsec /usr/libexec/parsec
$ sudo chmod 700 /usr/libexec/parsec
$ sudo mkdir /home/parsec/run/
$ sudo chown parsec:parsec-clients /home/parsec/run/
$ sudo chmod 750 /home/parsec/run/
$ cd ~
$ pwd
/home/parsec
$ cp xxx/parsec/target/release/parsec /usr/libexec/parsec
$ chmod +x /usr/libexec/parsec/parsec
$ cp xxx/parsec/config.toml /etc/parsec/config.toml
Note: need unmark allow_root = true in config.toml.$ sudo vim /etc/systemd/system/parsec.service
[Unit]
Description=Parsec Service
Documentation=https://parallaxsecond.github.io/parsec-book/parsec_service/install_parsec_linux.html
[Service]
WorkingDirectory=/home/parsec/
ExecStart=/usr/libexec/parsec/parsec --config /etc/parsec/config.toml
[Install]
WantedBy=multi-user.target
$ sudo systemctl enable parsec.service
$ sudo systemctl start parsec.service
$ sudo docker load < parsec-client-v1.0-docker-aarch64.tar
$ sudo docker images
$ sudo docker tag d396f7adeed3 parsec-client:v1.0
$ sudo docker run --restart=always -d -p8300:8300 -v /home/parsec/run:/run/parsec parsec-client:v1.0
$ curl -v -d '{"Name": "GoClient"}' 127.0.0.1:8300/client
$ curl -v -d '{"Name": "GoClient"}' 127.0.0.1:8300/client
$ curl -v -d '{"Name": "GoClient", "KeyName": "MyEncKey"}' 127.0.0.1:8300/keyenc
$ curl -v -X GET -d '{"Name": "GoClient", "KeyName": "MyEncKey"}' 127.0.0.1:8300/key
$ sudo mkdir /usr/libexec/NodeAuth
$ sudo cp xxx/NodeAuthServer /usr/libexec/NodeAuth
$ sudo chmod +x /usr/libexec/NodeAuth/NodeAuthServer
$ sudo vim /etc/systemd/system/NodeAuthServer.service
[Unit]
Description=Node Auth Server
[Service]
WorkingDirectory=/usr/libexec/NodeAuth
ExecStart=/usr/libexec/NodeAuth/NodeAuthServer
[Install]
WantedBy=multi-user.target
$ sudo systemctl enable NodeAuthServer.service
$ sudo systemctl start NodeAuthServer.service
$ curl -sfL https://get.k3s.io | sh -s - --docker
$ sudo cat /var/lib/rancher/k3s/server/node-token$ sudo docker run --name edgefaas --restart=always -d -p8888:8080 registry.gitlab.com/arm-research/smarter/edgefaas/edgefaas:v1-1-0
$ curl 192.168.0.118:8888/mgmt -d "http://192.168.0.104:8080/sysinfo.py"
$ curl 192.168.0.118:8888/mgmt -d "http://192.168.0.104:8080/camera.py"
$ curl 192.168.0.118:8888/mgmt -d "http://192.168.0.104:8080/image.py"
Note: 192.168.0.118 is EdgeFaas device, 192.168.0.104 is PC.
parsec-server-aarch64/
parsec
config.toml
parsec.service
$ sudo useradd -m parsec
$ sudo passwd parsec
$ sudo usermod -s /bin/bash parsec
$ sudo loginctl enable-linger parsec
$ sudo groupadd parsec-clients
$ sudo mkdir /var/lib/parsec
$ sudo chown parsec:parsec /var/lib/parsec
$ sudo chmod 700 /var/lib/parsec
$ sudo mkdir /etc/parsec
$ sudo chown parsec:parsec /etc/parsec
$ sudo chmod 700 /etc/parsec
$ sudo mkdir /usr/libexec/parsec
$ sudo chown parsec:parsec /usr/libexec/parsec
$ sudo chmod 700 /usr/libexec/parsec
$ sudo mkdir /home/parsec/run/
$ sudo chown parsec:parsec-clients /home/parsec/run/
$ sudo chmod 750 /home/parsec/run/
$ cp xxx/parsec-server-aarch64/parsec /usr/libexec/parsec
$ chmod +x /usr/libexec/parsec/parsec
$ cp xxx/parsec-server-aarch64/config.toml /etc/parsec/config.toml
$ mkdir -p ~/.config/systemd/user
$ cp xxx/parsec-server-aarch64/parsec.service ~/.config/systemd/user
$ systemctl --user enable parsec
$ systemctl --user start parsec
$ sudo docker load < parsec-client-v1.0-docker-aarch64.tar
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> d396f7adeed3 2 months ago 16.9MB
$ sudo docker tag d396f7adeed3 parsec-client:v1.0
$ sudo docker run --restart=always -d -p8300:8300 -v /home/parsec/run:/run/parsec parsec-client:v1.0
$ curl -v -d '{"Name": "GoClient"}' 127.0.0.1:8300/client
...
HTTP/1.1 200 OK
...
Blue Print Package Maintenance
N/A
Any software developed by the "Akraino Enterprise Applications on Smart Cities is licensed under the
Apache License, Version 2.0 (the "License");
you may not use the content of this software bundle except in compliance with the License.
You may obtain a copy of the License at <https://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
N/A
N/A