Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from open-ness/openness_release_2009
Browse files Browse the repository at this point in the history
Openness release 2009
  • Loading branch information
cjnolan authored Sep 30, 2020
2 parents 31f088c + d21fd1e commit 51a5017
Show file tree
Hide file tree
Showing 116 changed files with 2,582 additions and 613 deletions.
10 changes: 5 additions & 5 deletions applications/cdn-transcode/certs/self-sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# Copyright (c) 2020 Intel Corporation

IMAGE="ovc_self_certificate"
DIR=$(dirname $(readlink -f "$0"))
LINK=$(readlink -f "$0")
DIR=$(dirname "$LINK")
USER="docker"

case "$(cat /proc/1/sched | head -n 1)" in
case "$(head -n 1 /proc/1/sched)" in
*self-sign*)
openssl req -x509 -nodes -days 30 -newkey rsa:4096 -keyout /home/$USER/self.key -out /home/$USER/self.crt << EOL
US
Expand All @@ -26,11 +27,10 @@ EOL
pid="$(docker ps -f ancestor=$IMAGE --format='{{.ID}}' | head -n 1)"
if [ -n "$pid" ] && [ "$#" -le "1" ]; then
echo "bash into running container...$IMAGE"
docker exec -it $pid ${*-/bin/bash}
docker exec -it "$pid" "${*-/bin/bash}"
else
echo "bash into new container...$IMAGE"
args=("$@")
docker run --rm ${OPTIONS[@]} $(env | cut -f1 -d= | grep -E '_(proxy|REPO|VER)$' | sed 's/^/-e /') --entrypoint /home/$USER/self-sign.sh -it "${IMAGE}" "$(hostname -f)"
docker run --rm "${OPTIONS[@]}" "$(env | cut -f1 -d= | grep -E '_(proxy|REPO|VER)$' | sed 's/^/-e /')" --entrypoint /home/$USER/self-sign.sh -it "${IMAGE}" "$(hostname -f)"
fi
;;
esac
Expand Down
5 changes: 3 additions & 2 deletions applications/cdn-transcode/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation

DIR=$(dirname $(readlink -f "$0"))
LINK=$(readlink -f "$0")
DIR=$(dirname "$LINK")

# delete pvs and scs
for yaml in $(find "${DIR}/CDN-Transcode-Sample/deployment/kubernetes" -maxdepth 1 -name "*-pv.yaml" -print); do
for yaml in ${DIR}/CDN-Transcode-Sample/deployment/kubernetes/*-pv.yaml; do
kubectl delete --wait=false -f "$yaml" --ignore-not-found=true 2>/dev/null
done

Expand Down
8 changes: 3 additions & 5 deletions applications/cdn-transcode/ovc-clone-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ cd build

if kubectl get pods -A | grep docker-registry ; then
mName=$(kubectl get nodes | grep master | cut -f 1 -d ' ')
if [ ! -z $mName ]; then
mIP=$(kubectl get node -o 'custom-columns=NAME:.status.addresses[?(@.type=="Hostname")].address,IP:.status.addresses[?(@.type=="InternalIP")].address' | awk '!/NAME/{print $1":"$2}' | grep $mName | cut -f 2 -d':')
if [ ! -z "$mName" ]; then
mIP=$(kubectl get node -o 'custom-columns=NAME:.status.addresses[?(@.type=="Hostname")].address,IP:.status.addresses[?(@.type=="InternalIP")].address' | awk '!/NAME/{print $1":"$2}' | grep "$mName" | cut -f 2 -d':')
fi
echo "mName=$mName mIP=$mIP"
fi

if [ ! -z $mIP ]; then
if [ ! -z "$mIP" ]; then
cmake -DREGISTRY="${mIP}:5000/" ..
else
cmake ..
fi

make || { echo "failed to compile CDN transcode Sample"; exit 2;}
echo "Success: Compiled the CDN Transcode Sample"


8 changes: 5 additions & 3 deletions applications/cdn-transcode/pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Copyright (c) 2020 Intel Corporation

echo "Pre-Installation setup for CDN Transcode Sample"
DIR=$(dirname $(readlink -f "$0"))

LNK=$(readlink -f "$0")
DIR=$(dirname "$LNK")
function create_secret {
kubectl create secret generic self-signed-certificate "--from-file=${DIR}/certs/self.crt" "--from-file=${DIR}/certs/self.key"
}
Expand All @@ -12,9 +14,9 @@ function create_secret {
"$DIR/certs/self-sign.sh"
create_secret 2>/dev/null || (kubectl delete secret self-signed-certificate; create_secret)

for yaml in $(find "$DIR/CDN-Transcode-Sample/deployment/kubernetes/" -maxdepth 1 -name "*-pv.yaml" -print); do
for yaml in "$DIR"/CDN-Transcode-Sample/deployment/kubernetes/*-pv.yaml; do
kubectl apply -f "$yaml"
done

# create volume
$DIR/CDN-Transcode-Sample/deployment/kubernetes/mkvolume.sh
"$DIR/CDN-Transcode-Sample/deployment/kubernetes/mkvolume.sh"
109 changes: 101 additions & 8 deletions applications/eis-experience-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Edge Insights Software (EIS) is the framework for enabling smart manufacturing w
More details about EIS:
[https://www.intel.com/content/www/us/en/internet-of-things/industrial-iot/edge-insights-industrial.html](https://www.intel.com/content/www/us/en/internet-of-things/industrial-iot/edge-insights-industrial.html)

Currently, `eis-experience-kit` supports EIS in version 2.2.
Currently, `eis-experience-kit` supports EIS in version 2.3.1

- [OpenVINO](#openvino)
- [Pre-requisites](#pre-requisites)
- [Installation Process](#installation-process)
- [Getting The Sources](#getting-the-sources)
Expand All @@ -26,14 +25,14 @@ Currently, `eis-experience-kit` supports EIS in version 2.2.
- [Deploy Settings](#deploy-settings)
- [Inventory](#inventory)
- [Playbook Main File](#playbook-main-file)
- [EIS Demo Setting](#eis-demo-setting)
- [RTSP Stream Setting](#rtsp-stream-setting)
- [View Visualizer Setting](#view-visualizer-setting)
- [Installation](#installation)
- [Web Visualizer Display](#web-visualizer-display)
- [Removal](#removal)
- [References](#references)

## OpenVINO
EIS requires OpenVINO Toolkit to be downloaded and installed. It is automated and no user input is required.

More about OpenVINO Toolkit: [https://docs.openvinotoolkit.org/](https://docs.openvinotoolkit.org/)

## Pre-requisites
EIS applications require Network Edge OpenNESS platform to be deployed and working.
Expand Down Expand Up @@ -81,11 +80,105 @@ User needs to set the OpenNESS Master Node IP address. It can be done in `invent
### Playbook Main File
The main file for playbook is `eis_pcb_demo.yml`. User can define here which roles should be run during the build & deployment. They can be switch by using comments for unnecessary roles.

### EIS Demo Setting
eis-experience-kit currently we can configure for Demo type as

- PCB Demo
- Safety Demo

Following flags controll for configuring demo type on `group_vars/all.yml
```sh
demo_type: "safety" -> for Safety Demo
demo_type: "pcb" -> for PCB Demo
```
#### RTSP Stream Setting
Currently RTSP camera steam data can be received follwing source
- rtsp stream from camera-stream pod
- rtsp stream from Linux host
- rtsp stream from Window host

on eis-experience-kit demo default rtsp strem will recive from camera-stream pod.
Follwing flags are contrl for receving receiving rtsp strem on `group_vars/all.yml`

#### Enable rtsp stream from camera-stream pod(Default)
```sh
camera_stream_pod: true
rtsp_camera_stream_ip: "ia-camera-stream-service"
rtsp_camera_stream_port: 8554
```
#### Enable rtsp stream from extrnal Linux/Window host
```sh
camera_stream_pod: false
rtsp_camera_stream_ip: "192.169.1.1" < update Linux/window external rtsp server IP>
rtsp_camera_stream_port: 8554
```

#### Send rtsp stream from external Linux (CentOS)
```sh
yum install -y epel-release https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
yum install -y vlc
sed -i 's/geteuid/getppid/' /usr/bin/vlc
./send_rtsp_stream_linux.sh <file_name> <port_name>
```
#### Send rtsp stream from external Linux (ubuntu)

```sh
apt-get install vlc
sed -i 's/geteuid/getppid/' /usr/bin/vlc
./send_rtsp_stream_linux.sh <file_name> <port_name>
```
#### Send rtsp stream from external Windows Host

```sh
#install vlc player <https://www.videolan.org/vlc/download-windows.html>
#update follwing varaible on send_rtsp_stream_linux.sh
set vlc_path="c:\Program Files (x86)\VideoLAN\VLC"
set file_name="c:\Data\Safety_Full_Hat_and_Vest.avi" < update Demo file name>
set port="8554"
#next run send_rtsp_stream_win.bat file
```

**Note**: Following script and demo video file should copied from ansible host machine

`/eis-experience-kit/scripts/send_rtsp_stream_linux.sh`
`/eis-experience-kit/scripts/send_rtsp_stream_win.bat`
`/opt/eis_repo/IEdgeInsights/VideoIngestion/test_videos/pcb_d2000.avi`
`/opt/eis_repo/IEdgeInsights/VideoIngestion/test_videos/Safety_Full_Hat_and_Vest.avi`


### View Visualizer HOST Server
Currently default setting is enabled for **web_visualizer**.
This setting is `optional` only if we want to view visualizer on any HOST server, Update IP Adddress of host server where we want to see the GUI output, Visualizer container will expose the GUI output on display host.
```sh
display_visualizer_host: true
display_host_ip: "192.168.0.1" < Update Display Host IP>
display_no: "1" <Update Display no>
```

**Note**:
- Display host shoud have GUI/VNC access and check the Display by echo $DISPLAY
update the display on above `display_no`.
- configure `xhost +` on Display host for receiving video GUI

## Installation
After all the configuration is done, script `deploy_eis_pcb_demo.sh` needs to be executed to start the deployment process. No more actions are required, all the installation steps are fully automated.
After all the configuration is done, script `deploy_eis.sh` needs to be executed to start the deployment process. No more actions are required, all the installation steps are fully automated.

## Web Visualizer display

After EIS deployed successfully output can be viewed using

`https://<controller_IP>:5050`

username:`admin`

password:`admin@123`

**Note**:
Open Web Visualizer on google chrome browser, if Your connection is not private show, select Advanced option and proceed to.


## Removal
To clean up the platform from EIS applications `cleanup_eis_pcb_demo.sh` script can be used. It runs Ansible playbook `eis_pcb_demo_cleanup.yml` and processes all the roles defined there. Inventory file is used for getting Controller Node IP.
To clean up the platform from EIS applications `cleanup_eis_deployment.sh` script can be used. It runs Ansible playbook `eis_cleanup.yml` and processes all the roles defined there. Inventory file is used for getting Controller Node IP.

## References
- [Industrial Edge Insights Application on OpenNESS - Solution Overview](https://github.com/open-ness/specs/blob/master/doc/applications/openness_eis.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
source scripts/ansible-precheck.sh # check if ansibles are already installed
# and ready to use

ansible-playbook -vv ./eis_pcb_demo_cleanup.yml --inventory inventory.ini
ansible-playbook -vv ./eis_cleanup.yml --inventory inventory.ini
exit $?
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

source scripts/ansible-precheck.sh # check if ansibles are already installed
# and ready to use
source scripts/task_log_file.sh

ansible-playbook -vv ./eis_sources.yml --inventory inventory.ini

source scripts/eis_repo_config.sh .

ansible-playbook -vv ./eis_pcb_demo.yml --inventory inventory.ini

ansible-playbook -vv ./eis.yml --inventory inventory.ini
exit $?
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@
- role: docker
- role: docker_registry/localhost
- role: common/build
when: build_eis_base_images | default(True)
- role: camera_stream/build
- role: etcd/build
- role: video_ingestion/build
- role: video_analytics/build
- role: visualizer/build
- role: web_visualizer/build

- hosts: controller_group
roles:
- role: machine_setup/k8s_master
- role: common/deploy
- role: camera_stream/deploy
when: camera_stream_pod | default(True)
- role: etcd/deploy
- role: video_analytics/deploy
- role: visualizer/deploy
when: display_visualizer_host | default(False)
- role: web_visualizer/deploy
- role: video_ingestion/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@

- hosts: controller_group
tasks:
- name: Load ETCD vars
include_vars: ./roles/etcd/deploy/defaults/main.yml

- name: Cleanup ETCD
include_tasks: ./roles/etcd/deploy/tasks/cleanup.yaml

- name: Load CameraStream vars
include_vars: ./roles/camera_stream/deploy/defaults/main.yml

Expand All @@ -79,5 +73,11 @@
- name: Cleanup Visualizer
include_tasks: ./roles/visualizer/deploy/tasks/cleanup.yaml

- name: Load ETCD vars
include_vars: ./roles/etcd/deploy/defaults/main.yml

- name: Cleanup ETCD
include_tasks: ./roles/etcd/deploy/tasks/cleanup.yaml

- name: Cleanup Common
include_tasks: ./roles/common/deploy/tasks/cleanup.yaml
18 changes: 17 additions & 1 deletion applications/eis-experience-kit/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,24 @@ docker_registry_ip: "{{ hostvars[groups['controller_group'][0]]['ansible_host']
docker_registry_address: "{{ docker_registry_ip }}:{{ docker_registry_port }}"
docker_registry_dir: "/opt/docker-registry/"

web_visualizer_ip: "{{ hostvars[groups['controller_group'][0]]['ansible_host'] }}"
web_visualizer_port: 5050

eis_version: "{{ lookup('env', 'EIS_VERSION') }}"
etcd_version: "{{ lookup('env', 'ETCD_VERSION') }}"
dev_mode: "{{ lookup('env', 'DEV_MODE') }}"

eis_sources_dir: "/opt/eis_repo"
eis_repo_dir: "/opt/eis_repo"
eis_sources_dir: "/opt/eis_repo/IEdgeInsights"


demo_type: "pcb" # set "pcb" for pcb demo or "safety" for Safety Hat demo.
camera_stream_pod: true # enabled if rtsp stream receive from camera stream pod

rtsp_camera_stream_ip: "ia-camera-stream-service" # set remote rtsp camera IP
rtsp_camera_stream_port: 8554 # set remote rtsp stream port no

display_visualizer_host: false # enabled if visualizer output view on display host.
display_host_ip: "192.168.0.1" # update ip for visualizer HOST GUI.
display_no: "1" # update DISPLAY number for visualizer GUI output

5 changes: 4 additions & 1 deletion applications/eis-experience-kit/host_vars/localhost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ proxy_yum_url: "http://proxy.example.org:3128"
eis_source: "gitclone" # set string as "gitclone" or "release"
release_package_path: "" # provide release package archive path when eis_source set to "release"

eis_env_file: "{{ eis_sources_dir }}/docker_setup/.env"
eis_env_file: "{{ eis_sources_dir }}/build/.env"

os_yum_base_packages: "jq,vim-common,curl,yum-utils,python2-pip,wget,git,python-devel,moreutils"

docker_format_command: !unsafe 'docker images --format "{{.Repository}}:{{.Tag}}"'
build_eis_base_images: true
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ eis_install_path: "/opt/eis"
helm_charts_location: "{{ eis_install_path }}/charts"
eis_integ_path: "{{ eis_install_path }}/etcd/eis_integ"
etcd_certs_location: "{{ eis_install_path }}/etcd/Certificates"

eis_network_policy_path: "{{ eis_install_path }}/network_policy"
zmq_keys_gen_force: false
del_zmq_keys: false

os_yum_base_packages: "python3,python3-pip"
ca_default_bits: "{{ lookup('env', 'SSL_KEY_LENGTH') }}"
Expand All @@ -21,7 +23,7 @@ k8s_eis_namespace: "eis"
san_ca: "DNS:{{ pod_name }}-service"

cert_days: 3650
eis_openssl_cnf: "{{ eis_sources_dir }}/docker_setup/provision/config/openssl.cnf"
eis_openssl_cnf: "{{ eis_sources_dir }}/build/provision/config/openssl.cnf"

rootca_cert_name: "ca_certificate.pem"
rootca_key_name: "ca_key.pem"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
docker_image_name: "ia_camera_stream"
docker_image_tag: "{{ docker_image_name }}:{{ eis_version }}"

cam_stream_source: "{{ eis_sources_dir }}/VideoIngestion/test_videos/pcb_d2000.avi"
pcb_cam_stream_source: "{{ eis_sources_dir }}/VideoIngestion/test_videos/pcb_d2000.avi"
safety_cam_stream_source: "{{ eis_sources_dir }}/VideoIngestion/test_videos/Safety_Full_Hat_and_Vest.avi"
docker_src_folder: "roles/camera_stream/build/files"
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ RUN useradd -m vlcuser
COPY streamstart.sh /tmp/
RUN chmod +x /tmp/streamstart.sh
COPY pcb_d2000.avi /tmp/
ENTRYPOINT ["/tmp/streamstart.sh"]
COPY Safety_Full_Hat_and_Vest.avi /tmp/

24 changes: 22 additions & 2 deletions applications/eis-experience-kit/roles/camera_stream/build/files/streamstart.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation
name="/tmp/pcb_d2000.avi";
sout="#gather:rtp{sdp=rtsp://0.0.0.0:8554/}"

if [[ $# -ne 2 ]] ; then
echo "No of argument are not correct"
exit 1
fi

if [ "$1" == "pcb" ]
then
echo "Set pcb demo rtsp stream file"
name="/tmp/pcb_d2000.avi"

elif [ "$1" == "safety" ]
then
echo "Set Safety Hat demo rtsp stream file"
name="/tmp/Safety_Full_Hat_and_Vest.avi"

else
echo "Wrong argument pass for rtsp stream demo"
exit 1

fi
sout="#gather:rtp{sdp=rtsp://0.0.0.0:$2/}"
su vlcuser -c "cvlc -vvv $name --sout '$sout' --loop --sout-keep"
Loading

0 comments on commit 51a5017

Please sign in to comment.