Skip to content

Commit

Permalink
Initialize the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand committed Aug 17, 2022
0 parents commit 3a23f95
Show file tree
Hide file tree
Showing 74 changed files with 12,917 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

# Controls when the workflow will run
on:
release:
types: [published]
workflow_dispatch:

env:
registry_name: ghcr.io
image_name: ${{ github.repository_owner }}/azureperceptdemo
module_path: ./src/modules/AzurePerceptDemo

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- name: amd64
platformName: linux/amd64
- name: arm64v8
platformName: linux/arm64/v8

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: true

- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1

- name: Docker Login
# You may pin to the exact commit or the version.
uses: docker/login-action@v2.0.0
with:
registry: ${{ env.registry_name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push ${{ matrix.arch.name }}
# You may pin to the exact commit or the version.
uses: docker/build-push-action@v2.7.0
with:
builder: ${{ steps.buildx.outputs.name }}
# Build's context is the set of files located in the specified PATH or URL
context: ${{ env.module_path }}
# Path to the Dockerfile
file: "${{ env.module_path }}/Dockerfile.${{ matrix.arch.name }}"
# Push is a shorthand for --output=type=registry
push: true
# List of SSH agent socket or keys to expose to the build
ssh: # optional
# List of tags
tags: ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-${{ matrix.arch.name }}
platforms: ${{ matrix.arch.platformName }}

publish:
runs-on: ubuntu-latest
needs: build
steps:
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1

- name: Docker Login
# You may pin to the exact commit or the version.
uses: docker/login-action@v2.0.0
with:
registry: ${{ env.registry_name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create the manifest
run: docker manifest create ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }} --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-amd64 --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-arm64v8

- name: Publish the manifest
run: docker manifest push ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}

- name: Create the manifest
run: docker manifest create ${{ env.registry_name }}/${{ env.image_name }}:latest --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-amd64 --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-arm64v8

- name: Publish the manifest
run: docker manifest push ${{ env.registry_name }}/${{ env.image_name }}:latest
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Kevin BEAUGRAND

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.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Azure Percept Demo

This project is a sample demonstrating the use of Azure Percept data acquisition and rendering to a web page.

The Web application is executing an Angular 14 SPA hosted by an Azure IoT Edge module executed directly on the Azure Percept device.
The IoT Edge module streams the Percept predictions from the Edge Hub to the Angular application via WebSockets.

The Angular application displays the Eye video stream from WebStream module (from Motion Jpeg stream) to the Web page.

## Demo

## Usage

To use the module, you need to deploy the following Azure IoT Edge module:

```json
"AzurePerceptDemo": {
"restartPolicy": "always",
"settings": {
"image": "kbeperceptdemoacr.azurecr.io/azureperceptdemo:0.0.1-arm64v8",
"createOptions": "{\"ExposedPorts\":{\"8080/tcp\":{},\"8081/tcp\":{}},\"HostConfig\":{\"PortBindings\":{\"8080/tcp\":[{\"HostPort\":\"8080\"}],\"8081/tcp\":[{\"HostPort\":\"8081\"}]}}}"
},
"status": "running",
"type": "docker"
}
```

### Edge Hub routing

```json
"routes": {
"AzureEyeModuleToIoTHub": "FROM /messages/modules/azureeyemodule/outputs/* INTO $upstream",
"AzureEyeModuleToPerceptDemo": "FROM /messages/modules/azureeyemodule/outputs/* INTO BrokeredEndpoint(\"/modules/AzurePerceptDemo/inputs/inputMessage\")"
},
```

## License

This project is licensed under the MIT License (see [./LICENSE.md](LICENSE.md)) for more details.
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config/
.env
47 changes: 47 additions & 0 deletions src/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "AzurePerceptDemo Remote Debug (Node.js)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceRoot}/modules/AzurePerceptDemo",
"remoteRoot": "/app",
"protocol": "inspector"
},
{
"name": "AzurePerceptDemo Local Debug (Node.js)",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/modules/AzurePerceptDemo/app.js",
"console": "integratedTerminal",
"env": {
"EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
"EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
}
},
{
"name": "AzurePerceptDemo Remote Debug (Node.js)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceRoot}/modules/AzurePerceptDemo",
"remoteRoot": "/app",
"protocol": "inspector"
},
{
"name": "PerceptSimulator Local Debug (Node.js)",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/modules/PerceptSimulator/app.js",
"console": "integratedTerminal",
"env": {
"EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
"EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
}
}
]
}
128 changes: 128 additions & 0 deletions src/deployment.debug.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"$schema-template": "4.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.1",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {}
}
},
"systemModules": {
"edgeAgent": {
"type": "docker",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.2",
"createOptions": {}
}
},
"edgeHub": {
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.2",
"createOptions": {
"HostConfig": {
"PortBindings": {
"5671/tcp": [
{
"HostPort": "5671"
}
],
"8883/tcp": [
{
"HostPort": "8883"
}
],
"443/tcp": [
{
"HostPort": "443"
}
]
}
}
}
}
}
},
"modules": {
"AzurePerceptDemo": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.AzurePerceptDemo.debug}",
"createOptions": {
"ExposedPorts": {
"9229/tcp": {},
"8080/tcp": {},
"8081/tcp": {}
},
"HostConfig": {
"PortBindings": {
"9229/tcp": [
{
"HostPort": "9229"
}
],
"8080/tcp": [
{
"HostPort": "8080"
}
],
"8081/tcp": [
{
"HostPort": "8081"
}
]
}
}
}
}
},
"PerceptSimulator": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.PerceptSimulator.debug}",
"createOptions": {
"ExposedPorts": {
"9229/tcp": {}
},
"HostConfig": {
"PortBindings": {
"9229/tcp": [
{
"HostPort": "9229"
}
]
}
}
}
}
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.1",
"routes": {
"PerceptSimulatorToPerceptDemo": "FROM /messages/modules/PerceptSimulator/* INTO BrokeredEndpoint(\"/modules/AzurePerceptDemo/inputs/inputMessage\")",
"PerceptDemoToUpstream": "FROM /messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO $upstream"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}
Loading

0 comments on commit 3a23f95

Please sign in to comment.