{ "info": { "author": "Dmitri Zimine", "author_email": "dz_removethis@stackstorm.com", "bugtrack_url": null, "classifiers": [], "description": "# Boilerplate for AWS IoT Greengrass\n[![Build Status](https://travis-ci.org/dzimine/greengo.svg?branch=master)](https://travis-ci.org/dzimine/greengo)\n![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)\n![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)\n[![PyPI version](https://badge.fury.io/py/greengo.svg)](https://badge.fury.io/py/greengo)\n\n Greengo: a starter project to bring up (and clean-up!) AWS Greengrass setup for play and profit. If you followed the [GreenGrass Getting Started Guide](https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html), here you find it automated, as code.\n\n> Work In Progress !\n\nDescribe your Greengrass group in `group.yaml`, write Lambda functions and device clients, provision Greengrass Core in Vagrant VM, deploy, and clean up.\n\nInspired by [aws-iot-elf (Extremely Low Friction)](https://github.com/awslabs/aws-iot-elf) and [aws-greengrass-group-setup](https://github.com/awslabs/aws-greengrass-group-setup).\n\n## Pre-requisits\n\n* A computer with Linux/MacOS, Python, git (dah!)\n* [Vagrant](https://www.vagrantup.com/docs/installation/) with [VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n* AWS CLI [installed](http://docs.aws.amazon.com/cli/latest/userguide/installing.html) and [configured](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html). Consider using [named profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html).\n\n\n## Set it Up\n\nInstall `greengo` from PyPI:\n\n```\n$ pip install greengo\n```\n\nManually [*] download GreenGrassCore binary and place it in the `./downloads` directory.\nSign in to the AWS Management Console, navigate to the AWS IoT console,\nand download the AWS Greengrass\nCore Software from [Software section](https://us-west-2.console.aws.amazon.com/iotv2/home?region=us-west-2#/\nsoftware/greengrass).\nYeah, manual sucks... I will automate it later. Or, submit your PR!\n\n\n## Play\n\n1. Create GreenGrass Group definition in AWS\n\n Fancy yourself with the group definitions in `group.yaml`, and run `greengo`:\n\n ```\n $ greengo create\n ```\n When runs with no errors, it creates all greengrass group artefacts on AWS\n and places certificates and `config.json` for GreenGrass Core in `./certs`\n and `./config` for Vagrant to use in provisioning on next step.\n \n\n2. Provision VM with GreenGrass Core with Vagrant\n\n ```\n $ vagrant up\n ```\n\n3. Deploy Greengrass Group to the Core on the VM. \n\n ```\n $ greengo deploy\n ```\n\n4. Check that everything works - see the [\"Check\" section](#check-the-deployment) below.\n\n5. **Profit !**\n\n6. Work on it: create, change or remove Lambda functions, subscriptions, resources, and then update Greengrass. \n\n ```\n $ greengo update\n ```\n\nApply your changes by deploying it again:\n\n ```\n $ greengo deploy\n ```\n\n\n7. Clean-up when done playing.\n\n Remove the group definitions on AWS:\n\n ```\n $ greengo remove\n ```\n\n Ditch the Vagrant VM:\n\n ```\n $ vagrant destroy\n ```\n\n> NOTE: If you want to create a new group but keep the Greengrass Core in the same Vagrant VM,\n> you must update it with newly generated certificates and `config.json` file\n> before deploying the group, and also reset deployment by getting\n> the `deployments/group/group.json` back to virgin.\n> \n> To do it: login to the Greengrass Vagrant VM and run `/vagrant/scripts/update_ggc.sh` on the Vagrant VM.\n\n## Details\n\n### Check the deployment\nHow to be sure ~~everything~~ something works? Follow this:\n\n1. Create greengrass group in AWS IoT: `greengo create`.\n2. Prepare GGC on the VM: update certificates, reset `group.json`, restart the `greengrassd`. \n3. Deploy with `greengo deploy`. Check:\n * Check the deployment status, should be 'Success'\n4. Explore Greengrass Core on your vagrant VM.\n * Login to Vagrant VM. You should nkow Vagrant but for the off case: `vagrant ssh`.\n * Check the GGC logs `runtime.log` and `python_runtime.log` under `/greengrass/ggc/var/log/system`. Runtime log should have a line about starting your lambda, or an error why the funtion is not started. In many cases (like not enough memory for Lambda), the deployment is 'Success' but the function fails to start. The errors can only be seen in the `runtime.log`. \n If the function starts successfully, `runtime.log` will contain a message like \n ```\n [2018-03-31T08:48:40.57Z][INFO]-Starting worker arn:aws:lambda:us-west-2:0000000000:function:GreengrassHelloWorld:12\n ```\n * Find and check your own Lambda log under `/greengrass/ggc/var/log/system`.\n * Check the greengrassd process: `ps aux | grep greengrassd`. \n Depending on deployment you might have several processes. \n5. In AWS console, check the MQTT topic with IoT MQTT Test page:\n ```\n REGION=`aws configure get region`; open https://$REGION.console.aws.amazon.com/iot/home?region=$REGION#/test\n ```\n Subscribe to the topic (e.g., `hello/world`), see the messages sent by the Greengrass Lambda function.\n\n\n### When something goes wrong\nAt this time `greengo` is just a prototype, a work-in-progress. Therefore it's not *if* but *when* somethings throws out, leaving the setup in half-deployed,\nand you gotta pick up the pieces. Remember:\n\n* You are still not worse off doing this manually: you at least have all the `ARN`\nand `Id` of all resources to clean-up.\n* DON'T DELETE `.gg/gg_state.json` file: it contains references to everything you need to delete. Copy it somewhere and use the `Id` and `Arn` of created resources to clean up the pieces. \n* Do what it takes to roll forward - if you're close to successful deployment, or roll-back - to clean things up and start from scratch.\n\nPlease pay forward: PR a patch to whatever broke for you to prevent it from happening again.\n\n## Development\n\nClone the project, set up your environment, install dependencies and setup `greengo` CLI in dev mode:\n\n```\n$ git clone https://github.com/dzimine/greengo.git\n$ cd greengo\n$ virtualenv venv\n\n$ . venv/bin/activate\n$ pip install -r requirements.txt\n$ pip install -e .\n```\n\nRun the unit tests:\n\n```\npytest -s\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/dzimine/greengo", "keywords": "AWS,IoT,Greengrass,Lambda", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "greengo", "package_url": "https://pypi.org/project/greengo/", "platform": "", "project_url": "https://pypi.org/project/greengo/", "project_urls": { "Homepage": "http://github.com/dzimine/greengo" }, "release_url": "https://pypi.org/project/greengo/1.0.7/", "requires_dist": null, "requires_python": "", "summary": "AWS Greengrass file-based setup tool", "version": "1.0.7" }, "last_serial": 5209245, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "f0a5843a1748e5090e7095a85d1f1c0a", "sha256": "ea46ba89fab40597f15a811153e4fef3e1193563b9a3d23674812f1c70bddb24" }, "downloads": -1, "filename": "greengo-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f0a5843a1748e5090e7095a85d1f1c0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10340, "upload_time": "2018-04-21T22:29:39", "url": "https://files.pythonhosted.org/packages/f5/0e/86d77f62a372f732ec09de569911cd5df35e3fcecf49fe850fd5b44a220a/greengo-1.0.1.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "15f393c80dc089b31d7c1be018833264", "sha256": "af92316453854ee89dceeacafbceb54197efd9b00c5e965a84d79debb95dbf64" }, "downloads": -1, "filename": "greengo-1.0.4.tar.gz", "has_sig": false, "md5_digest": "15f393c80dc089b31d7c1be018833264", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10533, "upload_time": "2018-04-21T22:35:39", "url": "https://files.pythonhosted.org/packages/52/6f/2851db0140409dffbab0d173e350fc4a6457498fec0ef51920ad70a1f4ab/greengo-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "de89b55adeebbf776f250355b47873b8", "sha256": "341c72368a85eb5e3550878765c29143850467099a021b3349c17eac856853d8" }, "downloads": -1, "filename": "greengo-1.0.5.tar.gz", "has_sig": false, "md5_digest": "de89b55adeebbf776f250355b47873b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10598, "upload_time": "2018-04-21T22:51:59", "url": "https://files.pythonhosted.org/packages/56/4e/c49742e777291edd1aa7d26982185d30f3b1ff2d7f1ab381d6f79f25f7a0/greengo-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "768e521adf83d879789fb6ab95c8e89f", "sha256": "8686e2175ab7012769241a5d693f495a48f6db0734ed182c0ce261ca14a5e5df" }, "downloads": -1, "filename": "greengo-1.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "768e521adf83d879789fb6ab95c8e89f", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 12838, "upload_time": "2018-11-06T23:08:48", "url": "https://files.pythonhosted.org/packages/f7/5e/b0192aa5012903247e58927a881405a99ccf903faf46bc7a9fbc0e9f6b90/greengo-1.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd6c7f279a2e8d8a1eb3145a2438aa4e", "sha256": "bc92ba3d4d2c2ac666adca957295e08af8fbcf972a60221b94d26612ecfb5115" }, "downloads": -1, "filename": "greengo-1.0.6.tar.gz", "has_sig": false, "md5_digest": "cd6c7f279a2e8d8a1eb3145a2438aa4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14745, "upload_time": "2018-11-06T23:06:16", "url": "https://files.pythonhosted.org/packages/a9/b9/8deeba25c8dfb8fe71e3c69e9e2794f8286f0801c81d2b385ccf02c7e2d7/greengo-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "94fd80cd7d9c7d71482fc38029a4ed36", "sha256": "aa5c6d051504e9608b33dd1864ab101d39db1ee7d55af77d01b0808ab8ce6ef0" }, "downloads": -1, "filename": "greengo-1.0.7.tar.gz", "has_sig": false, "md5_digest": "94fd80cd7d9c7d71482fc38029a4ed36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15247, "upload_time": "2019-04-30T17:02:59", "url": "https://files.pythonhosted.org/packages/9e/a9/ed89a47775bcb25e1c44ca74e3b6020d19eee7edee78559eebe73b4558f3/greengo-1.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "94fd80cd7d9c7d71482fc38029a4ed36", "sha256": "aa5c6d051504e9608b33dd1864ab101d39db1ee7d55af77d01b0808ab8ce6ef0" }, "downloads": -1, "filename": "greengo-1.0.7.tar.gz", "has_sig": false, "md5_digest": "94fd80cd7d9c7d71482fc38029a4ed36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15247, "upload_time": "2019-04-30T17:02:59", "url": "https://files.pythonhosted.org/packages/9e/a9/ed89a47775bcb25e1c44ca74e3b6020d19eee7edee78559eebe73b4558f3/greengo-1.0.7.tar.gz" } ] }