From b883f6ad31405a80c785e62ef4b663521fd7561f Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Tue, 17 Dec 2024 20:24:02 +0000 Subject: [PATCH] Add instructions for deploying the sample component --- docs/examples/sample.ggLitePython/README.md | 70 +++++++++++++++++++ .../1.0.0/ggLitePython.py | 0 .../recipes/sample.ggLitePython-1.0.0.yaml} | 2 +- misc/dictionary.txt | 1 + 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 docs/examples/sample.ggLitePython/README.md rename docs/examples/{sample-ggLitePython/artifacts/sample-ggLitePython => sample.ggLitePython/artifacts/sample.ggLitePython}/1.0.0/ggLitePython.py (100%) rename docs/examples/{sample-ggLitePython/recipes/sample-ggLitePython-1.0.0.yaml => sample.ggLitePython/recipes/sample.ggLitePython-1.0.0.yaml} (95%) diff --git a/docs/examples/sample.ggLitePython/README.md b/docs/examples/sample.ggLitePython/README.md new file mode 100644 index 000000000..94fa1b887 --- /dev/null +++ b/docs/examples/sample.ggLitePython/README.md @@ -0,0 +1,70 @@ +## Sample Greengrass nucleus lite Python Generic Component + +This demo generic component requests a list of AWS S3 bucket names. + +## Pre-requisite + +This demo has two key requirements for it to work. + +### Pre-installed python3 and python3-venv. + +- As a python demo it requires the python3 interpreter (if not already + installed) as a well as a python3 virtual environment support for a isolated + dependency management. + +- As an alternative method you may deploy the following recipe as a seprate + deployment before deploying given python demo. + +```yaml +--- +RecipeFormatVersion: "2020-01-25" +ComponentName: sample.ggLitePython.prerequisite +ComponentVersion: 1.0.0 +ComponentType: "aws.greengrass.generic" +ComponentDescription: + This a pre-requisite component to sample.gglite.Python component +ComponentPublisher: AWS +ComponentDependencies: +Manifests: + - Platform: + os: linux + runtime: "*" + Lifecycle: + install: + RequiresPrivilege: true + Script: "apt install python3-venv" +``` + +> Python3 isn't mentioned in the recipe as usually linux distributions ship with +> python3 out of the box. + +### S3 bucket permissions(if using cloud deployment) + +- Greengrass's connection kit ships with the least required previlage access for + Greengrass to run which does not include S3 access permissions. + +- Please refer to `Create your component in AWS IoT Greengrass (console)` + section mentioned in + [this aws docs](https://docs.aws.amazon.com/greengrass/v2/developerguide/upload-first-component.html). + +## Deploying the component + +You may deploy the componet the following ways: + +- Performing a local deployment by using the `ggl-cli`. +- Performing a cloud deployment with support of S3: + - Upload `ggLitePython.py` artifact to a S3 bucket. + - Uncomment the `Artifacts` section of recipe. + - Provide S3 url under `Uri` section in recipe. + +## End result + +Once the deployment is successful running the following command to check the log +and see the list of buckets in your S3 that exist in your aws account. + +```shell +$ journalctl -xeau ggl.sample.ggLitePython.service +``` + +> If you do see the list of names then keep on press up arrow key until you see +> `HELLO WORLD` text in your logs diff --git a/docs/examples/sample-ggLitePython/artifacts/sample-ggLitePython/1.0.0/ggLitePython.py b/docs/examples/sample.ggLitePython/artifacts/sample.ggLitePython/1.0.0/ggLitePython.py similarity index 100% rename from docs/examples/sample-ggLitePython/artifacts/sample-ggLitePython/1.0.0/ggLitePython.py rename to docs/examples/sample.ggLitePython/artifacts/sample.ggLitePython/1.0.0/ggLitePython.py diff --git a/docs/examples/sample-ggLitePython/recipes/sample-ggLitePython-1.0.0.yaml b/docs/examples/sample.ggLitePython/recipes/sample.ggLitePython-1.0.0.yaml similarity index 95% rename from docs/examples/sample-ggLitePython/recipes/sample-ggLitePython-1.0.0.yaml rename to docs/examples/sample.ggLitePython/recipes/sample.ggLitePython-1.0.0.yaml index abec97ca3..a7c6e7bfb 100644 --- a/docs/examples/sample-ggLitePython/recipes/sample-ggLitePython-1.0.0.yaml +++ b/docs/examples/sample.ggLitePython/recipes/sample.ggLitePython-1.0.0.yaml @@ -1,6 +1,6 @@ --- RecipeFormatVersion: "2020-01-25" -ComponentName: sample-ggLitePython +ComponentName: sample.ggLitePython ComponentVersion: 1.0.0 ComponentType: "aws.greengrass.generic" ComponentDescription: diff --git a/misc/dictionary.txt b/misc/dictionary.txt index 69687ff2f..d0221f928 100644 --- a/misc/dictionary.txt +++ b/misc/dictionary.txt @@ -121,6 +121,7 @@ uriparser uuid venv WERROR +xeau Xiwyu xlink yapf