|
| 1 | +# Debug server |
| 2 | + |
| 3 | +The project source includes Python code and supporting resources: |
| 4 | + |
| 5 | +- `debug-server.yml` - A template that creates an IAM role for the application. |
| 6 | +- `01-create-role.sh`, etc. - Shell scripts that use the AWS CLI to deploy and manage the application. |
| 7 | + |
| 8 | +Use the following instructions to deploy the sample application. |
| 9 | + |
| 10 | +**Warning** This sample application opens port 8080 on your device to incoming traffic. Review your [network configuration](https://docs.aws.amazon.com/panorama/latest/dev/appliance-network.html) and ensure that only the device and other approved clients can send traffic to this port. |
| 11 | + |
| 12 | +# Requirements |
| 13 | + |
| 14 | +This project uses the following software. |
| 15 | + |
| 16 | +- The Bash shell. For Linux and macOS, this is included by default. In Windows 10, you can install the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) to get a Windows-integrated version of Ubuntu and Bash. |
| 17 | +- [The AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) v1.17 or newer. |
| 18 | +- [jq](https://stedolan.github.io/jq/) to parse JSON responses from AWS services. |
| 19 | +- [Python 3](https://www.python.org/downloads/) |
| 20 | +- [The AWS Panorama application CLI](https://github.com/aws/aws-panorama-cli) |
| 21 | + |
| 22 | +You can use `pip` to install the application CLI: |
| 23 | + |
| 24 | + $ pip install --upgrade panoramacli |
| 25 | + |
| 26 | +# Setup |
| 27 | + |
| 28 | +Download or clone this repository. |
| 29 | + |
| 30 | + $ git clone https://github.com/awsdocs/aws-panorama-developer-guide.git |
| 31 | + $ cd aws-panorama-developer-guide/sample-apps/debug-server |
| 32 | + |
| 33 | +To create a role that grants the application permission to upload metrics, run `1-create-role.sh`. |
| 34 | + |
| 35 | + debug-server$ ./1-create-role.sh |
| 36 | + Waiting for changeset to be created.. |
| 37 | + Waiting for stack create/update to complete |
| 38 | + Successfully created/updated stack - panorama-debug-server |
| 39 | + |
| 40 | +This script uses AWS CloudFormation to create AWS resources, which are defined in the template [debug-server.yml](debug-server.yml). If the CloudFormation stack that contains the resources already exists, the script updates it with any changes to the template or function code. |
| 41 | + |
| 42 | +# Import application |
| 43 | + |
| 44 | +To import the application, run `2-import-app.sh`. |
| 45 | + |
| 46 | + debug-server$ ./2-import-app.sh |
| 47 | + % Total % Received % Xferd Average Speed Time Time Time Current |
| 48 | + Dload Upload Total Spent Left Speed |
| 49 | + 100 4566k 100 4566k 0 0 3673k 0 0:00:01 0:00:01 --:--:-- 3673k |
| 50 | + Sucessfully imported application |
| 51 | + |
| 52 | +This script uses the application CLI to update source paths with your account ID, and downloads the sample model archive. |
| 53 | + |
| 54 | +Next, open the `graphs/my-app/override.json` and replace the placeholder values with your camera and device information. |
| 55 | + |
| 56 | + { |
| 57 | + "nodeGraphOverrides": { |
| 58 | + "nodes": [ |
| 59 | + { |
| 60 | + "name": "camera_node_override", |
| 61 | + "interface": "012345678901::exterior-north.exterior-north" |
| 62 | + }, |
| 63 | + { |
| 64 | + "name": "region_override", |
| 65 | + "interface": "string", |
| 66 | + "value": "us-west-2" |
| 67 | + }, |
| 68 | + { |
| 69 | + "name": "device_ip_override", |
| 70 | + "interface": "string", |
| 71 | + "value": "192.168.99.100" |
| 72 | + }, |
| 73 | + |
| 74 | +You can find your device's IP address in the AWS Panorama console or with the `aws panorama describe-device` command. |
| 75 | + |
| 76 | + $ aws panorama describe-device --device-id device-6272wtqu56awmshv3gxzowewea --query 'CurrentNetworkingStatus' |
| 77 | + |
| 78 | +# Build and deploy |
| 79 | + |
| 80 | +Run the following scripts to build the application, upload it to Amazon S3, and deploy it to a device. |
| 81 | + |
| 82 | + ./3-build-container.sh |
| 83 | + ./4-package-app.sh |
| 84 | + ./5-deploy.sh |
| 85 | + |
| 86 | +The first time you deploy, the `5-deploy.sh` script prompts you to choose a device. It stores the device ID and application instance ID in local files for subsequent deployments. |
| 87 | + |
| 88 | +# Cleanup |
| 89 | + |
| 90 | +To clean up project resources, run `9-delete-role.sh`. |
| 91 | + |
| 92 | + debug-server$ ./9-delete-role.sh |
0 commit comments