diff --git a/.env b/.env deleted file mode 100644 index d3a33c8..0000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -GRAFANA_PORT=3000 -EVAM_PORT=8080 -EVA_DEFAULT_PORT=8082 -EVA_REACT_PORT=8083 -SIGNALLING_PORT=8443 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index bd08b55..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,84 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '28 2 * * 3' - -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} - permissions: - # required for all workflows - security-events: write - - # only required for workflows in private repositories - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - language: [ 'javascript-typescript', 'python' ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml deleted file mode 100644 index c02910e..0000000 --- a/.github/workflows/scorecard.yml +++ /dev/null @@ -1,72 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. They are provided -# by a third-party and are governed by separate terms of service, privacy -# policy, and support documentation. - -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: '33 13 * * 4' - push: - branches: [ "master" ] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read - - steps: - - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecard on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: true - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - - name: "Upload artifact" - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 - with: - name: SARIF file - path: results.sarif - retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard. - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 - with: - sarif_file: results.sarif diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4743c6c..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.idea -eii/.env diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..b60c133 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,131 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +CommunityCodeOfConduct AT intel DOT com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..afee039 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +# Contributing + +### License + +Multimodal Data Visualization is licensed under the terms in [LICENSE](./LICENSE). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms. + +### Sign your work + +Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/LICENSE b/LICENSE index 082ff4a..afdf0b1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,202 @@ -MIT License - -Copyright (c) 2022 Intel Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c)2022 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://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. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index e45cc00..0000000 --- a/README.md +++ /dev/null @@ -1,32 +0,0 @@ -## Multimodal Data Visualization Microservice - -This repository contains the source code for Multimodal Data Visualization Microservice used for the [Multimodal Data Visualization Use Case](https://www.intel.com/content/www/us/en/developer/articles/technical/multimodal-data-visualization.html). - -### Build the base image - -Complete the following steps to build the base image: - -1. Run the following command: - - ```sh - docker-compose -f docker-compose-build.yml build - ``` - -### Run the base image - -Complete the following steps to run the base image: - -1. Clone this [repo](https://github.com/intel/multimodal-data-visualization). -2. Configure Host IP 'export HOST_IP=< HOST-IP-address >' -3. Run the `docker-compose up` command. - -### Perform the following steps to run Grafana in EVAM mode: -1. Go to [http://:3000](http://localhost:3000) to access Grafana. -2. On the **Home Dashboard** page, on the left corner, click the Dashboards icon. -3. Click the **Manage Dashboards** tab, to view the list of all the preconfigured dashboards. -4. Select **Video Analytics Dashboard**, to view the data from the Edge Video Analytics Microservice. - -### Run Multimodal Data Visualization Microservice in Open EII mode - -To run Multimodal Data Visualization Microservice in the Open EII mode, refer to the [README_OEI](README_OEI.md). - diff --git a/README_OEI.md b/README_OEI.md deleted file mode 100644 index 49e35ae..0000000 --- a/README_OEI.md +++ /dev/null @@ -1,89 +0,0 @@ -# Contents -- [Contents](#contents) - - [Multimodal Data Visualization Microservice for Open EII](#multimodal-data-visualization-microservice-for-open-eii) - - [Prerequisites](#prerequisites) - - [Run the containers](#run-the-containers) - - [Grafana](#grafana) - -## Multimodal Data Visualization Microservice for Open EII - -The Multimodal Data Visualization Microservice is a microservice that can visualize the video streaming and time series data. Two containers runs as a part of this microservice, multimodal-data-visualization and multimodal-data-visualization-streaming. multimodal-data-visualization-streaming container gets the ingested frames and inference results from the MsgBus subscriber and render the video to the webpage. This webpage is embedded in Grafana to visualize the video stream and other time series data on the same dashboard. This directory provides a Docker compose -and config file to use Multimodal Data Visualization Microservice with the Open Edge Insights software stack. - ->**Note:** In this document, you will find labels of ‘Edge Insights for Industrial (EII)’ for filenames, paths, code snippets, and so on. Consider the references of EII as Open EII. This is due to the product name change of EII as Open EII. - -## Prerequisites - -As a prerequisite for Multimodal Data Visualization Microservice, complete the following steps: - -1. Run the following commands to get the Open EII source code: - - ```sh - repo init -u "https://github.com/open-edge-insights/eii-manifests.git" - repo sync - ``` - - >**Note:** For more details, refer [here](https://github.com/open-edge-insights/eii-manifests). - -2. Complete the prerequisite for provisioning the Open EII stack by referring to the -[README.md](https://github.com/open-edge-insights/eii-core/blob/master/README.md#provision). - -3. Run the following commands to set the environment, build the `ia_configmgr_agent` container: - - ```sh - cd [WORK_DIR]/IEdgeInsights/build - - # Execute the builder.py script - python3 builder.py -f usecases/video-streaming.yml - ``` - -## Run the containers - -To pull the prebuilt Open EII container images and Multimodal Data Visualization Microservice images from Docker Hub and run the containers in the detached mode, run the following command: - -```sh -# Start the docker containers -docker-compose up -d -``` - -> **Note:** -> -> The prebuilt container image for the [Multimodal Data Visualization Microservice](https://hub.docker.com/r/intel/edge_video_analytics_microservice) -> gets downloaded when you run the `docker-compose up -d` command, if the image is not already present on the host system. - -### Interfaces section - -In the Open EII mode, the endpoint details for the Open EII service you need to subscribe from are to be provided in the **Subscribers** section in the [config](config.json) file. -For more details on the structure, refer to the [Open EII documentation](https://github.com/open-edge-insights/eii-core/blob/master/README.md#add-oei-services). - - -### Grafana -Once the Microservice is up, Grafana can be accessed on http://:3000. It supports various storage backends for the time-series data (data source). Open Edge Insights (OEI) uses InfluxDB as the data source. Grafana connects to the InfluxDB data source which has been preconfigured as a part of the Grafana setup. The 'ia_influxdbconnector' and ia_webservice service must be running for Grafana to be able to collect the time-series data and stream the video respectively. After the data source starts working, you can use the preconfigured dashboard to visualize the incoming data. You can also edit the dashboard as required. -The following are the configuration details for Grafana: - -- [dashboard.json](../multimodal-data-visualization/eii/dashboard.json): This is the dashboard json file that is loaded when Grafana starts. It is preconfigured to display the time-series data. - -- [dashboard.yml](../multimodal-data-visualization/eii/dashboard.yml): This is the config file for all the dashboards. It specifies the path to locate all the dashboard json files. - -- [datasource.yml](../multimodal-data-visualization/eii/datasource.yml): This is the config file for setting up the data source. It has various fields for data source configuration. - -- [grafana.ini](../multimodal-data-visualization/eii/grafana.ini): This is the config file for Grafana. It specifies how Grafana should start after it is configured. - ->**Note:** You can edit the contents of these files based on your requirement. - - -### Perform the following steps to run Grafana for a video use case: - -1. Ensure that the endpoint of the publisher, that you want to subscribe to, is mentioned in the **Subscribers** section of the [config](config.json) file. -2. On the **Home Dashboard** page, on the left corner, click the Dashboards icon. -3. Click the **Manage Dashboards** tab, to view the list of all the preconfigured dashboards. -4. Select **EII Video and Time Series Dashboard**, to view multiple panels with topic names of the subscriber as the panel names along with a time-series panel named `Time Series`. -5. Hover over the topic name. The panel title will display multiple options. -6. Click **View** to view the subscribed frames for each topic. - ->**NOTE:** -> -> 1. Changing gridPos for the video frame panels is prohibited since these values are altered internally to support multi instance. -> 2. Grafana does not support visualization for GVA, CustomUDF streams - - diff --git a/charts/.helmignore b/charts/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/Chart.yaml b/charts/Chart.yaml deleted file mode 100644 index de83af5..0000000 --- a/charts/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -appVersion: "3.0" -description: A Helm chart for deploying multimodal data visualization service in k8s -name: multimodal-data-visualization -type: application -version: "3.0" diff --git a/charts/Jenkinsfile b/charts/Jenkinsfile deleted file mode 100644 index 685d859..0000000 --- a/charts/Jenkinsfile +++ /dev/null @@ -1,176 +0,0 @@ -pipeline { - - agent { - node { - label 'aws-ec2' - } - } - - environment { - MC_URL = 'https://esh-mc.intel.com' // API url to validate branch exists in mc - HELMCHART_ID = '62d5313d1a93fe00214d908e' // ID associated with the Service Layer - HELMCHART_NAME = 'Multimodal_Data_Visualization_Helm_Chart' // Name which goes to Service Layer - HELMCHART_FILE_NAME = 'Multimodal_Data_Visualization_Helm_Chart' //Installation file name associated in the repo - AWS_S3_BUCKET = 'eshs3bucket' // AWS S3 BUCKET NAME - AWS_S3_REGION = 'us-west-2' // AWS REGION NAME - AWS_S3_SOURCE = 'esh/jenkins' // AWS SOURCE Path for Jenkins upload - AWS_S3_CRED = 'AWS_S3_Upload' // AWS Global Credentials in Jekins - CURRENT_DATE = sh(script: 'date +%Y%m%d', returnStdout: true).trim() - GITLAB_LOGIN = credentials('Intel-Gitlab') - } - - stages { - stage('Setup') { - steps { - sh ''' - echo "--------------------------------------------" - echo " Agent setup " - echo "--------------------------------------------" - while pgrep apt > /dev/null; do - sleep 11 - done - sudo apt-get update - echo "--------------------------------------------" - ''' - } - } - - stage('Install certs') { - steps { - sh ''' - wget https://gitlab.devtools.intel.com/dse-public/devops-scripts/-/raw/master/install-certs.sh --no-check-certificate - chmod a+x install-certs.sh - ./install-certs.sh - ''' - } - } - - stage('Create Package') { - steps { - sh '''#!/bin/bash - echo "--------------------------------------------" - echo " Creating ${HELMCHART_NAME} tgz" - echo "--------------------------------------------" - echo "Helm Chart Name: ${HELMCHART_NAME}" - echo "Helm Chart ID: ${HELMCHART_ID}" - echo "Helm Chart File: ${HELMCHART_FILE_NAME}" - rm -rf .git* build - - echo "-------------Copy dependencies--------------" - rsync -av --exclude IntelSHA2RootChain-Base64 --exclude __MACOSX --exclude IntelSHA2RootChain-Base64.tgz --exclude IntelSHA2RootChain-Base64.zip \ - --exclude '*.crt' --exclude '*certs*' --exclude 'Jenkinsfile' ./ ${HELMCHART_ID} - cd ${HELMCHART_ID} - echo "---------------Create tgz-------------------" - touch ${HELMCHART_ID}.tgz - tar --exclude=${HELMCHART_ID}.tgz -zcvf ${HELMCHART_ID}.tgz . - retval=$? - if [ $retval -ne 0 ]; then - echo "Failed create helm tgz" - exit $retval - fi - echo "--------------------------------------------" - ''' - } - } - stage('Push to S3'){ - steps{ - script { - def res = ""; - withAWS(region:"${AWS_S3_REGION}",credentials:"${AWS_S3_CRED}") { - def identity=awsIdentity();//Log AWS credentials - echo "--------------------------------------------" - echo " Pushing ${HELMCHART_NAME} to DAL" - echo "--------------------------------------------" - echo "${HELMCHART_NAME} : ${HELMCHART_ID}.tgz" - - - def MC_VERSION = sh(script: "wget --server-response --method POST --timeout=0 --header 'Content-Type: application/json' \ - --ca-directory=/etc/ssl/certs/ --no-proxy --no-check-certificate \ - --body-data '{\"id\":\"'${HELMCHART_ID}'\",\"version\":\"'$GIT_BRANCH'\"}' \ - \${MC_URL}/helmchart/validateVersion 2>&1 | grep \"HTTP/\" | awk '{print \$2}'", returnStdout: true).trim(); - - echo "ID: $HELMCHART_ID, version: $GIT_BRANCH" - - echo "----------------mc version is : ${}MC_VERSION ------------" - - if ( MC_VERSION != '200' ) { - echo "-------Push to S3 skipped-------" - echo "--------------------------------------------" - sh(script: "exit 0") - } - def TGZ_FILE_PATH = pwd(); - - echo TGZ_FILE_PATH; - res = s3Upload(file:"${TGZ_FILE_PATH}/${HELMCHART_ID}/${HELMCHART_ID}.tgz", bucket:"${AWS_S3_BUCKET}", path:"${AWS_S3_SOURCE}/helm/${HELMCHART_ID}.tgz"); - } - if ( res != "s3://${AWS_S3_BUCKET}/${AWS_S3_SOURCE}/helm/${HELMCHART_ID}.tgz" ) { - error("AWS S3 Upload Failed."); - } - - echo "-----------Generate MD5sum------------------" - def MD5SUM = sh(script: "md5sum \${HELMCHART_ID}/\${HELMCHART_ID}.tgz | cut -d ' ' -f1",returnStdout:true).trim();; - if ( !MD5SUM ){ - error("Failed to generate md5sum") - } - echo "original md5sum: ${MD5SUM}" - } - } - } - stage('Update MD5Sum'){ - steps{ - script { - def TGZ_FILE_PATH = pwd(); - - withAWS(region:"${AWS_S3_REGION}",credentials:"${AWS_S3_CRED}") { - def identity=awsIdentity();//Log AWS credentials - echo "--------------------------------------------" - echo " Downloading ${HELMCHART_NAME} from S3" - echo "--------------------------------------------" - echo "${HELMCHART_NAME} : ${HELMCHART_ID}.tgz" - - sh(script: "sudo mkdir -p \${TGZ_FILE_PATH}/\${HELMCHART_ID}/download",returnStdout:true); - res = s3Download(file:"${TGZ_FILE_PATH}/${HELMCHART_ID}/download/${HELMCHART_ID}.tgz", bucket:"${AWS_S3_BUCKET}", path:"${AWS_S3_SOURCE}/helm/${HELMCHART_ID}.tgz", force:true) - } - echo "-----------Generate MD5sum------------------" - def MD5SUM = sh(script: "md5sum \${HELMCHART_ID}/download/\${HELMCHART_ID}.tgz | cut -d ' ' -f1",returnStdout:true).trim(); - if ( !MD5SUM ){ - error("Failed to generate md5sum") - } - echo "md5sum(s3): ${MD5SUM}" - - echo "--------------Post MD5sum-------------------" - def RETVAL = sh(script: "wget --method POST --timeout=0 --header 'Content-Type: application/json' --body-data '{\"id\":\"'$HELMCHART_ID'\",\"hashValue\":\"'$MD5SUM'\"}' \${MC_URL}/helmchart/updateMD5Hash --ca-directory=/etc/ssl/certs/ --no-proxy --no-check-certificate",returnStatus:true); - if ( RETVAL != 0 ) { - error("Failed to post md5sum"); - } - echo "--------------------------------------------" - } - } - } - - } - - post { - success { - emailext( - attachmentsPattern: "bandit_report.txt, pep8_output.txt", - replyTo: '$DEFAULT_REPLYTO', - subject: "Status of pipeline: ${currentBuild.fullDisplayName}", - body: "${env.BUILD_URL} has result ${currentBuild.result}", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - updateGitlabCommitStatus state: 'success' - } - - failure { - emailext( - replyTo: '$DEFAULT_REPLYTO', - subject: "Status of pipeline: ${currentBuild.fullDisplayName}", - body: "${env.BUILD_URL} has result ${currentBuild.result}", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - updateGitlabCommitStatus state: 'failed' - } - } - -} diff --git a/charts/LICENSE b/charts/LICENSE deleted file mode 100644 index 00c57d1..0000000 --- a/charts/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2022 Intel Corporation -SPDX-License-Identifier: MIT - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/charts/README.md b/charts/README.md deleted file mode 100644 index d3a4679..0000000 --- a/charts/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# Multimodal Data Visualization Helm chart - -This chart can be used to deploy [ Multimodal Data Visualization](https://www.intel.com/content/www/us/en/developer/articles/technical/multimodal-data-visualization.html) on Kubernetes cluster using Helm CLI. - -## Usage - -### Pre-requisite. - -1. Install a [Kubernetes](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/) cluster. - -2. Install [Helm](https://helm.sh) CLI. Please refer to Helm's [documentation](https://helm.sh/docs/) to get started. - -3. Add the system's host IP address in values.yaml file of EVAM helm chart folder. - -4. Install [ EVAM Helm Chart](https://www.intel.com/content/www/us/en/developer/articles/technical/video-analytics-service.html) by following the steps mentioned this document under `Tutorial 4`. - -5. Add the system's host IP address in values.yaml file of multimodal data visualization helm chart folder. - -### Deployment - -- Once the prerequisites are completed properly, install the chart as follows: - - ```console - helm install multimodal-data-visualization ./multimodal-data-visualization-chart-3.0/ - ``` -- Check the status of deployed application: - - Command:- - - ```console - helm ls - ``` - - Output:- - - ```console - NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION - evam default 1 2022-07-26 20:58:04.895323101 +0530 IST deployed evam-0.7.2 0.7.2 - multimodal-data-visualization default 1 2022-07-26 20:59:04.918583632 +0530 IST deployed multimodal-data-visualization-3.0 3.0 - ``` - Command:- - - ```console - kubectl get pods - ``` - Output:- - - ```console - NAME READY STATUS RESTARTS AGE - evam-deployment-57477d7d96-9t6xd 1/1 Running 0 4m7s - mqtt-deployment-5577b74dc-k27xg 1/1 Running 0 4m7s - multimodal-data-visualization-deployment-6459c7c47f-mz6lt 1/1 Running 0 3m9s - multimodal-data-visualization-streaming-deployment-78fdbd8wlwpc 1/1 Running 0 3m9s - ``` - -### Sending Pipeline Server Requests - - ```console - curl localhost:30007/pipelines/object_detection/person_vehicle_bike -X POST -H \ - 'Content-Type: application/json' -d \ - '{ - "source": { - "uri": "https://github.com/intel-iot-devkit/sample-videos/blob/master/person-bicycle-car-detection.mp4?raw=true", - "type": "uri" - }, - "destination": { - "metadata": { - "type": "file", - "path": "/tmp/results.txt", - "format": "json-lines" - }, - "frame": { - "type": "webrtc", - "peer-id": "peerid_1" - } - } - }' - ``` -### Perform the following steps to run Multimodal-Data-Visualization helm chart in EVAM mode: -1. Go to http://:30000 to access Multimodal-Data-Visualization. -2. On the Home Dashboard page, on the left corner, click the Dashboards icon. -3. Click the Manage Dashboards tab, to view the list of all the preconfigured dashboards. -4. Select Video Analytics Dashboard, to view the data from the Edge Video Analytics Microservice. -5. Click the Refresh button on the webRTC Stream panel to get the streaming for running pipelines. - -### Perform the following steps to run Multimodal-Data-Visualization helm chart in Standalone mode: - -- Set the environment variable `MODE` in values.yaml file as empty present in Multimodal-Data-Visualization.folder. - - ```console - MODE: - ``` -- install the helm chart as follows: - - ```console - helm install multimodal-data-visualization ./multimodal-data-visualization-chart-3.0/ - ``` - - Go to http://:30000 to access Multimodal-Data-Visualization. - - - Select `Sample Visualization Dashboard`, to view the streaming on the Dashboard. diff --git a/charts/templates/_helpers.tpl b/charts/templates/_helpers.tpl deleted file mode 100644 index 83b70b7..0000000 --- a/charts/templates/_helpers.tpl +++ /dev/null @@ -1,63 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "chart.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "chart.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "chart.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "chart.labels" -}} -helm.sh/chart: {{ include "chart.chart" . }} -{{ include "chart.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "chart.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "chart.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "chart.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} - diff --git a/charts/templates/multimodal-data-visualization-deployment.yaml b/charts/templates/multimodal-data-visualization-deployment.yaml deleted file mode 100644 index faa4576..0000000 --- a/charts/templates/multimodal-data-visualization-deployment.yaml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chart.fullname" . }}-deployment - labels: - {{- include "chart.labels" . | nindent 4 }} -spec: - selector: - matchLabels: - {{- include "chart.selectorLabels" . | nindent 6 }} - strategy: - type: Recreate - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "chart.selectorLabels" . | nindent 8 }} - spec: - hostname: multimodal-data-visualization - containers: - - image: "{{ .Values.visualizationImage.repository }}:{{ .Values.visualizationImage.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.visualizationImage.pullPolicy }} - name: deployment - env: - - name: MODE - value: "{{ .Values.env.MODE }}" - - name: HOST_IP - value: "{{ .Values.env.HOST_IP }}" - - name: KUBERNETES_ENV - value: "{{ .Values.env.KUBERNETES_ENV }}" - ports: - - containerPort: 3000 - name: grafana-port - volumeMounts: - - mountPath: /tmp - name: multimodal-data-visualization - volumes: - - name: multimodal-data-visualization - persistentVolumeClaim: - claimName: multimodal-data-visualization - diff --git a/charts/templates/multimodal-data-visualization-persistentvolume.yaml b/charts/templates/multimodal-data-visualization-persistentvolume.yaml deleted file mode 100644 index cb3f1ac..0000000 --- a/charts/templates/multimodal-data-visualization-persistentvolume.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: multimodal-data-visualization-volume - labels: - type: local -spec: - storageClassName: manual - capacity: - storage: 500Mi - accessModes: - - ReadWriteOnce - hostPath: - path: "/tmp/" \ No newline at end of file diff --git a/charts/templates/multimodal-data-visualization-persistentvolumeclaim.yaml b/charts/templates/multimodal-data-visualization-persistentvolumeclaim.yaml deleted file mode 100644 index 27497f0..0000000 --- a/charts/templates/multimodal-data-visualization-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - app: multimodal-data-visualization - name: multimodal-data-visualization -spec: - storageClassName: manual - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/charts/templates/multimodal-data-visualization-service.yaml b/charts/templates/multimodal-data-visualization-service.yaml deleted file mode 100644 index def433e..0000000 --- a/charts/templates/multimodal-data-visualization-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chart.fullname" . }}-deployment - labels: - {{- include "chart.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - name: grafana-port - port: 3000 - targetPort: 3000 - nodePort: 30000 - selector: - {{- include "chart.selectorLabels" . | nindent 4 }} diff --git a/charts/templates/multimodal-data-visualization-streaming-deployment.yaml b/charts/templates/multimodal-data-visualization-streaming-deployment.yaml deleted file mode 100644 index dc4729b..0000000 --- a/charts/templates/multimodal-data-visualization-streaming-deployment.yaml +++ /dev/null @@ -1,62 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: multimodal-data-visualization-streaming-deployment - labels: - app: multimodal-data-visualization-streaming -spec: - selector: - matchLabels: - app: multimodal-data-visualization-streaming - strategy: - type: Recreate - template: - metadata: - labels: - app: multimodal-data-visualization-streaming - spec: - hostname: multimodal-data-visualization-streaming - securityContext: - runAsUser: 1999 - runAsGroup: 1999 - fsGroup: 1999 - containers: - - image: "{{ .Values.visualizationStreamingImage.repository }}:{{ .Values.visualizationStreamingImage.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.visualizationStreamingImage.pullPolicy }} - name: deployment - ports: - - containerPort: 8082 - name: ui-default-port - - containerPort: 8443 - name: signalling-port - - containerPort: 8083 - name: react-port - env: - - name: MODE - value: "{{ .Values.env.MODE }}" - volumeMounts: - - mountPath: /etc/nginx/sites-enabled - name: multimodal-data-visualization-streaming-tmpfs0 - - mountPath: /usr/share/nginx - name: multimodal-data-visualization-streaming-tmpfs1 - - mountPath: /var/log/nginx - name: multimodal-data-visualization-streaming-tmpfs2 - - mountPath: /var/cache/nginx - name: multimodal-data-visualization-streaming-tmpfs3 - - mountPath: /var/lib/nginx - name: multimodal-data-visualization-streaming-tmpfs4 - - mountPath: /run - name: multimodal-data-visualization-streaming-tmpfs5 - volumes: - - name: multimodal-data-visualization-streaming-tmpfs0 - emptyDir: {} - - name: multimodal-data-visualization-streaming-tmpfs1 - emptyDir: {} - - name: multimodal-data-visualization-streaming-tmpfs2 - emptyDir: {} - - name: multimodal-data-visualization-streaming-tmpfs3 - emptyDir: {} - - name: multimodal-data-visualization-streaming-tmpfs4 - emptyDir: {} - - name: multimodal-data-visualization-streaming-tmpfs5 - emptyDir: {} diff --git a/charts/templates/multimodal-data-visualization-streaming-service.yaml b/charts/templates/multimodal-data-visualization-streaming-service.yaml deleted file mode 100644 index 65c177c..0000000 --- a/charts/templates/multimodal-data-visualization-streaming-service.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: multimodal-data-visualization-streaming-svc - labels: - app: multimodal-data-visualization-streaming -spec: - type: {{ .Values.service.type }} - ports: - - name: ui-default-port - port: 8082 - targetPort: 8082 - nodePort: 30009 - - name: signalling-port - port: 8443 - targetPort: 8443 - nodePort: 30006 - - name: react-port - port: 8083 - targetPort: 8083 - nodePort: 30008 - selector: - app: multimodal-data-visualization-streaming diff --git a/charts/values.yaml b/charts/values.yaml deleted file mode 100644 index 0f151b4..0000000 --- a/charts/values.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# Default values for visualization_service. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - - -env: - HOST_IP: - MODE: EVA - KUBERNETES_ENV: true - -replicaCount: 1 - -visualizationStreamingImage: - repository: intel/multimodal-data-visualization-streaming - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "3.0" - -visualizationImage: - repository: intel/multimodal-data-visualization - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "3.0" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "multimodal-data-visualization-template" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: NodePort - port: 80 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific -tls: [] -# - secretName: chart-example-tls -# hosts: -# - chart-example.local - -resources: {} -# We usually recommend not to specify default resources and to leave this as a conscious -# choice for the user. This also increases chances charts run on environments with little -# resources, such as Minikube. If you do want to specify resources, uncomment the following -# lines, adjust them as necessary, and remove the curly braces after 'resources:'. -# limits: -# cpu: 100m -# memory: 128Mi -# requests: -# cpu: 100m -# memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - #targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} -tolerations: [] -affinity: {} diff --git a/docker-compose-build.yml b/docker-compose-build.yml deleted file mode 100644 index cdadee0..0000000 --- a/docker-compose-build.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Intel Corporation. - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -version: '3.6' - -services: - multimodal-data-visualization-streaming: - build: - context: $PWD/multimodal-data-visualization-streaming - args: - EII_VERSION: "v3.0" - EII_UID: "1999" - EII_USER_NAME: "eiiuser" - UBUNTU_IMAGE_VERSION: "20.04" - EII_SOCKET_DIR: "/opt/intel/eii/sockets" - PKG_SRC: "https://github.com/open-edge-insights/eii-manifests/releases/download/v3.0" - image: intel/multimodal-data-visualization-streaming:3.0 - - multimodal-data-visualization: - build: - context: $PWD/multimodal-data-visualization - args: - EII_VERSION: "v3.0" - GRAFANA_VERSION: "9.0.2" - EII_UID: "1999" - EII_USER_NAME: "eiiuser" - ALPINE_VERSION: "3.15" - EII_SOCKET_DIR: "/opt/intel/eii/sockets" - PKG_SRC: "https://github.com/open-edge-insights/eii-manifests/releases/download/v3.0" - image: intel/multimodal-data-visualization:3.0 diff --git a/docker-compose-eva.yml b/docker-compose-eva.yml deleted file mode 100644 index 71ae7d6..0000000 --- a/docker-compose-eva.yml +++ /dev/null @@ -1,82 +0,0 @@ -version: '3.6' - -services: - edge_video_analytics_microservice: - image: intel/edge_video_analytics_microservice:0.7.2 - container_name: edge_video_analytics_microservice - environment: - - ENABLE_WEBRTC=true - - WEBRTC_SIGNALING_SERVER=ws://${HOST_IP}:8443 - - no_proxy=$no_proxy - - http_proxy=$http_proxy - - https_proxy=$https_proxy - - RUN_MODE=EVA - - DETECTION_DEVICE=CPU - depends_on: - - multimodal-data-visualization-streaming - - multimodal-data-visualization - env_file: - - .env - ports: - - ${EVAM_PORT}:${EVAM_PORT} - volumes: - - "./../Edge_Video_Analytics_Resources/pipelines/:/home/pipeline-server/pipelines/" - - "./../Edge_Video_Analytics_Resources/models:/home/pipeline-server/models/" - - "./../Edge_Video_Analytics_Resources/resources:/home/pipeline-server/resources/" - - multimodal-data-visualization-streaming: - image: intel/multimodal-data-visualization-streaming:3.0 - container_name: multimodal-data-visualization-streaming - hostname: multimodal-data-visualization-streaming - read_only: true - restart: unless-stopped - ipc: "none" - tmpfs: - - /etc/nginx/sites-enabled:uid=1999,gid=1999 - - /usr/share/nginx:uid=1999,gid=1999 - - /var/log/nginx:uid=1999,gid=1999 - - /var/cache/nginx:uid=1999,gid=1999 - - /var/lib/nginx:uid=1999,gid=1999 - - /run:uid=1999,gid=1999 - security_opt: - - no-new-privileges - environment: - MODE: "EVA" - healthcheck: - test: [ "CMD-SHELL", "exit", "0" ] - interval: 5m - env_file: - - .env - ports: - - ${EVA_DEFAULT_PORT}:${EVA_DEFAULT_PORT} - - ${SIGNALLING_PORT}:${SIGNALLING_PORT} - - ${EVA_REACT_PORT}:${EVA_REACT_PORT} - - multimodal-data-visualization: - image: intel/multimodal-data-visualization:3.0 - container_name: multimodal-data-visualization - hostname: multimodal-data-visualization - read_only: true - restart: unless-stopped - ipc: "none" - security_opt: - - no-new-privileges - healthcheck: - test: ["CMD-SHELL", "exit", "0"] - interval: 5m - volumes: - - "vol_temp_grafana:/tmp" - environment: - HOST_IP: ${HOST_IP} - MODE: "EVA" - env_file: - - .env - ports: - - ${GRAFANA_PORT}:${GRAFANA_PORT} - -volumes: - vol_temp_grafana: - driver: local - driver_opts: - type: tmpfs - device: tmpfs diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 963ac97..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: '3.6' - -services: - multimodal-data-visualization-streaming: - image: intel/multimodal-data-visualization-streaming:3.0 - container_name: multimodal-data-visualization-streaming - hostname: multimodal-data-visualization-streaming - read_only: true - restart: unless-stopped - ipc: "none" - tmpfs: - - /etc/nginx/sites-enabled:uid=1999,gid=1999 - - /usr/share/nginx:uid=1999,gid=1999 - - /var/log/nginx:uid=1999,gid=1999 - - /var/cache/nginx:uid=1999,gid=1999 - - /var/lib/nginx:uid=1999,gid=1999 - - /run:uid=1999,gid=1999 - security_opt: - - no-new-privileges - healthcheck: - test: [ "CMD-SHELL", "exit", "0" ] - interval: 5m - env_file: - - .env - ports: - - ${EVA_DEFAULT_PORT}:${EVA_DEFAULT_PORT} - - ${SIGNALLING_PORT}:${SIGNALLING_PORT} - - ${EVA_REACT_PORT}:${EVA_REACT_PORT} - - multimodal-data-visualization: - image: intel/multimodal-data-visualization:3.0 - container_name: multimodal-data-visualization - hostname: multimodal-data-visualization - read_only: true - restart: unless-stopped - ipc: "none" - security_opt: - - no-new-privileges - healthcheck: - test: ["CMD-SHELL", "exit", "0"] - interval: 5m - volumes: - - "vol_temp_grafana:/tmp" - environment: - HOST_IP: ${HOST_IP} - env_file: - - .env - ports: - - ${GRAFANA_PORT}:${GRAFANA_PORT} - -volumes: - vol_temp_grafana: - driver: local - driver_opts: - type: tmpfs - device: tmpfs diff --git a/multimodal-data-visualization-streaming/.dockerignore b/multimodal-data-visualization-streaming/.dockerignore deleted file mode 100644 index e69de29..0000000 diff --git a/multimodal-data-visualization-streaming/.gitignore b/multimodal-data-visualization-streaming/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/multimodal-data-visualization-streaming/Dockerfile b/multimodal-data-visualization-streaming/Dockerfile deleted file mode 100644 index 23cd1b7..0000000 --- a/multimodal-data-visualization-streaming/Dockerfile +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2022 Intel Corporation -# SPDX-License-Identifier: MIT - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -ARG UBUNTU_IMAGE_VERSION -FROM ubuntu:${UBUNTU_IMAGE_VERSION} as builder - -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /app -RUN apt-get update && apt-get install -y --no-install-recommends python3 \ - python3-dev \ - python3-pip \ - cmake \ - wget \ - git - -ARG EII_VERSION -RUN git clone https://github.com/open-edge-insights/eii-core.git \ - --branch ${EII_VERSION} --single-branch - -ARG PKG_SRC -RUN wget ${PKG_SRC}/eii-utils-3.0.0-Linux.deb && \ - wget ${PKG_SRC}/eii-messagebus-3.0.0-Linux.deb && \ - wget ${PKG_SRC}/eii-configmanager-3.0.0-Linux.deb - -# Install python dependencies -COPY ./requirements.txt /app/requirements.txt -RUN pip3 install --user -r requirements.txt; - -# Build EVAM UI -COPY ./eva ./eva -RUN wget -qO- https://deb.nodesource.com/setup_14.x | bash - && \ - apt install -y nodejs - -RUN cd eva && \ - npm install && \ - npm run build - -RUN git clone https://github.com/dlstreamer/pipeline-server - -#Build standalone app with configurable URL from grafana dasboard. -COPY ./sample ./sample -RUN cd sample && \ - npm install && \ - npm run build - - -RUN apt-get remove --auto-remove --purge -y python3-pip \ - nodejs cmake wget git \ - python3-dev \ - python3-pip - -# Build the runtime image -FROM ubuntu:$UBUNTU_IMAGE_VERSION as runtime -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /app -RUN apt-get update && apt-get install -y nginx python3 libglib2.0-0 \ - libgl1-mesa-glx libcjson-dev \ - libzmq3-dev python3-distutils python3-setuptools - -COPY --from=builder /app/pipeline-server/samples/webrtc/signaling /app/signaling_server -RUN rm -f /app/signaling_server/Dockerfile -RUN rm -f /app/signaling_server/requirements.signaling.txt -RUN rm -f /app/signaling_server/build.sh - -COPY . . -RUN chmod a+x run.sh -COPY --from=builder /app/eva/build /app/eva/build -COPY --from=builder /app/sample/build /app/sample/build -COPY --from=builder /app/eii-* /app/ -COPY --from=builder /app/eii-core/common/util/*.py util/ -COPY --from=builder /root/.local/lib /app/.local/lib -COPY --from=builder /root/.local/bin /app/.local/bin - -# Installation of utils, eiimessagebus and configmgr debian packages -RUN dpkg -i /app/eii-utils-3.0.0-Linux.deb && \ - dpkg -i /app/eii-messagebus-3.0.0-Linux.deb && \ - dpkg -i /app/eii-configmanager-3.0.0-Linux.deb - -ARG EII_UID -ARG EII_USER_NAME -RUN groupadd $EII_USER_NAME -g $EII_UID && \ - useradd -r -u $EII_UID -g $EII_USER_NAME $EII_USER_NAME - -RUN sed -i '/modules-enabled/d' /etc/nginx/nginx.conf; -RUN chown -R ${EII_USER_NAME}:${EII_USER_NAME} /app /opt /etc/nginx/sites-enabled - -ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/lib:/app -ENV PATH ${PATH}:/app/.local/bin -ENV PYTHONPATH $PYTHONPATH:/usr/local/lib/python3.8/dist-packages:/app/.local/lib/python3.8/site-packages:/app -USER $EII_USER_NAME - -ENTRYPOINT ["./run.sh"] - diff --git a/multimodal-data-visualization-streaming/Readme.md b/multimodal-data-visualization-streaming/Readme.md deleted file mode 100644 index d35e154..0000000 --- a/multimodal-data-visualization-streaming/Readme.md +++ /dev/null @@ -1,5 +0,0 @@ -## Multimodal Data Visualization Streaming - -Multimodal Data Visualization Streaming is part of Multimodal Data Visualization microservice which helps in streaming the processed video to the Webpage. This URL where the streaming is happening is used in Grafana based Visualization service for Visualization. -For e.g., in EVAM mode, it uses WebRTC framework to get the processed video from Edge Video Analytics service and stream it to the Web Page. This Web page is embedded in Grafana Dashboard using the AJAX panel to visualize the stream along with the other metrics related to Video Processing. -Similarly, in EII mode, the Webservice gets the ingested frames and inference results from the MsgBus subscriber and render the video to the webpage. This webpage is then used in Grafana for Visualization. diff --git a/multimodal-data-visualization-streaming/eii/config.json b/multimodal-data-visualization-streaming/eii/config.json deleted file mode 100644 index 2e47385..0000000 --- a/multimodal-data-visualization-streaming/eii/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "config": { - "cert_type": ["pem", "zmq"], - "influxdb": { - "dbname": "datain" - }, - "port": 5003, - "dev_port": 5004, - "draw_results": "true", - "labels" : { - "camera1_stream_results": { - "0": "MISSING", - "1": "SHORT" - }, - "native_safety_gear_stream_results": { - "1": "safety_helmet", - "2": "safety_jacket", - "3": "Safe", - "4": "Violation" - }, - "py_safety_gear_stream_results": { - "1": "safety_helmet", - "2": "safety_jacket", - "3": "Safe", - "4": "Violation" - - }, - "gva_safety_gear_stream_results": { - "1": "safety_helmet", - "2": "safety_jacket", - "3": "Safe", - "4": "Violation" - } - - } - }, - "interfaces": { - "Subscribers": [ - { - "Name": "default", - "Type": "zmq_tcp", - "EndPoint": "ia_video_analytics:65013", - "PublisherAppName": "VideoAnalytics", - "Topics": [ - "camera1_stream_results" - ] - }, - { - "Name": "default", - "Type": "zmq_tcp", - "EndPoint": "ia_influxdbconnector:65034", - "PublisherAppName": "InfluxDBConnector", - "Topics": [ - "point_classifier_results" - ] - } - ] - } -} - diff --git a/multimodal-data-visualization-streaming/eii/docker-compose.yml b/multimodal-data-visualization-streaming/eii/docker-compose.yml deleted file mode 100644 index 263a4d0..0000000 --- a/multimodal-data-visualization-streaming/eii/docker-compose.yml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) 2022 Intel Corporation. - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -version: '3.6' - -services: - multimodal-data-visualization-streaming: - image: intel/multimodal-data-visualization-streaming:3.0 - container_name: multimodal-data-visualization-streaming - hostname: multimodal-data-visualization-streaming - read_only: true - restart: unless-stopped - ipc: "none" - security_opt: - - no-new-privileges - healthcheck: - test: ["CMD-SHELL", "exit", "0"] - interval: 5m - tmpfs: - - /etc/nginx/sites-enabled:uid=1999,gid=1999 - - /usr/share/nginx:uid=1999,gid=1999 - - /var/log/nginx:uid=1999,gid=1999 - - /var/cache/nginx:uid=1999,gid=1999 - - /var/lib/nginx:uid=1999,gid=1999 - - /run:uid=1999,gid=1999 - - /tmp:uid=1999,gid=1999 - - /opt:uid=1999,gid=1999 - environment: - AppName: "MultiModalVisualizationStreaming" - DEV_MODE: ${DEV_MODE} - no_proxy: "${ETCD_HOST}" - NO_PROXY: "${ETCD_HOST}" - ETCD_HOST: ${ETCD_HOST} - ETCD_CLIENT_PORT: ${ETCD_CLIENT_PORT} - ETCD_PREFIX: ${ETCD_PREFIX} - HOST_IP: ${HOST_IP} - MODE: "EII" - networks: - - eii - volumes: - - "vol_eii_socket:${SOCKET_DIR}" - - ./Certificates/MultiModalVisualizationStreaming:/run/secrets/MultiModalVisualizationStreaming:ro - - ./Certificates/rootca/cacert.pem:/run/secrets/rootca/cacert.pem:ro - ports: - - 5004:5004 - - 5003:5003 - -volumes: - vol_temp_grafana: - driver: local - driver_opts: - type: tmpfs - device: tmpfs diff --git a/multimodal-data-visualization-streaming/eii/server.conf b/multimodal-data-visualization-streaming/eii/server.conf deleted file mode 100644 index 1f11778..0000000 --- a/multimodal-data-visualization-streaming/eii/server.conf +++ /dev/null @@ -1,9 +0,0 @@ -server { - listen $PORT; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_buffering off; - proxy_pass http://127.0.0.1:$INTERNAL_PORT; - } -} diff --git a/multimodal-data-visualization-streaming/eii/server.py b/multimodal-data-visualization-streaming/eii/server.py deleted file mode 100644 index 0b38da6..0000000 --- a/multimodal-data-visualization-streaming/eii/server.py +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright (c) 2019 Intel Corporation. - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -"""Grafana Service -""" - -import os -import threading -import queue -import secrets -import shlex -from flask import Flask, render_template, Response, request, session -import cv2 -import numpy as np -import math -import subprocess -import cfgmgr.config_manager as cfg -from util.log import configure_logging -from util.common import Visualizer - -TEXT = 'Disconnected' -TEXTPOSITION = (10, 110) -TEXTFONT = cv2.FONT_HERSHEY_PLAIN -TEXTCOLOR = (255, 255, 255) - -# Config manager initialization -ctx = cfg.ConfigMgr() -app_cfg = ctx.get_app_config() -dev_mode = ctx.is_dev_mode() -topics_list = [] -topic_config_list = [] -queue_dict = {} - -# Initializing logger -log = configure_logging(os.getenv('PY_LOG_LEVEL', 'DEBUG').upper(), __name__, - dev_mode) - -# Visualization related variables -FRAME_QUEUE_SIZE = 10 - -# Initializing flask related variables -NONCE = secrets.token_urlsafe(8) -APP = Flask(__name__) - -# For Secure Session Cookie -APP.config.update(SESSION_COOKIE_SECURE=True, - SESSION_COOKIE_SAMESITE='Lax') -APP.secret_key = os.urandom(24) -try: - # Initializing subscriber for multiple streams - num_of_subs = ctx.get_num_subscribers() - if num_of_subs > 0: - for index in range(0, num_of_subs): - sub_ctx = ctx.get_subscriber_by_index(index) - msgbus_config = sub_ctx.get_msgbus_config() - topic = sub_ctx.get_topics()[0] - # Adding topic & msgbus_config to - # topic_config tuple - topic_config = (topic, msgbus_config) - topic_config_list.append(topic_config) - topics_list.append(topic) - queue_dict[topic] = queue.Queue(maxsize=FRAME_QUEUE_SIZE) -except Exception as e: - log.warning(f"No subscriber instances found {e}") - - -def msg_bus_subscriber(topic_name, logger, json_config): - """msg_bus_subscriber is the ZeroMQ callback to - subscribe to classified results - """ - visualizer = Visualizer(queue_dict, logger, - labels=json_config["labels"], - draw_results=json_config["draw_results"]) - - for topic_config in topic_config_list: - - topic, msgbus_cfg = topic_config - - if topic_name == topic: - callback_thread = threading.Thread(target=visualizer.callback, - args=(msgbus_cfg, topic,)) - callback_thread.start() - break - - -def get_blank_image(text): - """Get Blank Images - """ - blank_image_shape = (130, 200, 3) - blank_image = np.zeros(blank_image_shape, dtype=np.uint8) - cv2.putText(blank_image, text, TEXTPOSITION, - TEXTFONT, 1.5, TEXTCOLOR, 2, cv2.LINE_AA) - _, jpeg = cv2.imencode('.jpg', blank_image) - final_image = jpeg.tobytes() - return final_image - - -def get_image_data(topic_name): - """Get the Images from Zmq - """ - logger = configure_logging(os.environ['PY_LOG_LEVEL'].upper(), - __name__, dev_mode) - try: - final_image = get_blank_image(TEXT) - msg_bus_subscriber(topic_name, logger, app_cfg) - while True: - if topic_name in queue_dict.keys(): - if not queue_dict[topic_name].empty(): - frame = queue_dict[topic_name].get() - ret, jpeg = cv2.imencode('.jpg', frame) - del frame - final_image = jpeg.tobytes() - del jpeg - else: - raise Exception(f"Topic: {topic_name} doesn't exist") - - yield (b'--frame\r\n' - b'Content-Type: image/jpeg\r\n\r\n' + final_image + - b'\r\n\r\n') - except KeyboardInterrupt: - log.exception('Quitting due to keyboard interrupt...') - except Exception as err: - log.exception(f'Error during execution: {err}') - - -def set_header_tags(response): - """Local function to set secure response tags""" - response.headers['Content-Type'] = 'text/html; charset=utf-8' - response.headers['X-Content-Type-Options'] = 'nosniff' - response.headers['X-Frame-Options'] = 'SAMEORIGIN' - response.headers['X-XSS-Protection'] = '1; mode=block' - response.headers['Strict-Transport-Security'] = 'max-age=1024000;\ - includeSubDomains' - return response - - -@APP.route('/') -def index(): - """Video streaming home page.""" - - response = APP.make_response(render_template('index.html', - nonce=NONCE)) - return set_header_tags(response) - - -@APP.route('/topics', methods=['GET']) -def return_topics(): - """Returns topics list over http - """ - return Response(str(topics_list)) - - -@APP.route('/', methods=['GET']) -def render_image(topic_name): - """Renders images over http - """ - if topic_name in topics_list: - return Response(get_image_data(topic_name), - mimetype='multipart/x-mixed-replace;\ - boundary=frame') - - return Response("Invalid Request") - - -def main(): - # Multi instance variables - nginx_conf_path = "/etc/nginx/sites-enabled/" - server_cert_name = "/opt/server.crt" - server_key_name = "/opt/server.key" - server_content = "" - if not dev_mode: - nginx_server_prod_conf = "/app/eii/server_prod.conf.template" - server_cert = app_cfg["server_cert"] - server_key = app_cfg["server_key"] - - # Since Python SSL Load Cert Chain Method is not having option to load - # Cert from Variable. So for now we are going below method - - server_cert_temp = open(server_cert_name, "w") - server_key_temp = open(server_key_name, "w") - - server_cert_temp.write(server_cert) - server_cert_temp.seek(0) - - server_key_temp.write(server_key) - server_key_temp.seek(0) - - server_cert_temp.close() - server_key_temp.close() - with open(nginx_server_prod_conf, "r") as _file: - server_content = _file.read() - server_content = server_content.replace("$CERT_FILE", server_cert_name) - server_content = server_content.replace("$CERT_KEY", server_key_name) - - else: - with open("/app/eii/server.conf") as _file: - server_content = _file.read() - - # All browser security limitations retrict flask from serving - # more than 6 requests - # Hence, running a Gunicorn server instance for every 6 streams - - internal_port = 3000 - if dev_mode: - port = app_cfg['dev_port'] - else: - port = app_cfg['port'] - - processes = [] - for i in range(0, (math.ceil(num_of_subs / 6))): - if not dev_mode: - command = f"gunicorn -w6 --timeout 0 -b 0.0.0.0:{internal_port} --certfile={server_cert_name} " \ - f"--keyfile={server_key_name} server:APP" - else: - command = f"gunicorn -w6 --timeout 0 -b 0.0.0.0:{internal_port} server:APP" - command = shlex.split(command) - content = server_content.replace("$PORT", str(port)) - content = content.replace("$INTERNAL_PORT", str(internal_port)) - with open(os.path.join(nginx_conf_path, f"server_{port}.conf"), "w") as _file: - _file.write(content) - internal_port = internal_port + 1 - port = port + 1 - process = subprocess.Popen(command) - processes.append(process) - - for process in processes: - process.wait() - - -if __name__ == "__main__": - main() - - - diff --git a/multimodal-data-visualization-streaming/eii/server_prod.conf.template b/multimodal-data-visualization-streaming/eii/server_prod.conf.template deleted file mode 100644 index 9d67ab5..0000000 --- a/multimodal-data-visualization-streaming/eii/server_prod.conf.template +++ /dev/null @@ -1,13 +0,0 @@ -server { - listen $PORT ssl default_server; - listen [::]:$PORT ssl; - - ssl_certificate $CERT_FILE; - ssl_certificate_key $CERT_KEY; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_set_header Host $host; - proxy_pass https://127.0.0.1:$INTERNAL_PORT; - } -} diff --git a/multimodal-data-visualization-streaming/eii/templates/index.html b/multimodal-data-visualization-streaming/eii/templates/index.html deleted file mode 100644 index 8fc679b..0000000 --- a/multimodal-data-visualization-streaming/eii/templates/index.html +++ /dev/null @@ -1,87 +0,0 @@ - - -EdgeInsights - Grafana Visualizer - - - - - - - - - - - - -
- -


-
- -
- - -
- -