Skip to content
Permalink
Browse files

edited readme

  • Loading branch information
quinnciccoretti
quinnciccoretti committed Jun 5, 2019
1 parent 0cffa83 commit f4e0999f566f357c47f21a1aaf65a76bfdf7872d
Showing with 81 additions and 10 deletions.
  1. +15 −10 README.md
  2. +66 −0 greengo.yaml
@@ -46,15 +46,15 @@ Yeah, manual sucks... I will automate it later. Or, submit your PR!
When runs with no errors, it creates all greengrass group artefacts on AWS
and places certificates and `config.json` for GreenGrass Core in `./certs`
and `./config` for Vagrant to use in provisioning on next step.
2. Provision VM with GreenGrass Core with Vagrant
```
$ vagrant up
```
3. Deploy Greengrass Group to the Core on the VM.
3. Deploy Greengrass Group to the Core on the VM.
```
$ greengo deploy
@@ -64,14 +64,14 @@ Yeah, manual sucks... I will automate it later. Or, submit your PR!
5. **Profit !**

Work on it: create, change or remove Lambda functions, subscriptions, resources, and then update Greengrass.
Work on it: create, change or remove Lambda functions, subscriptions, resources, and then update Greengrass.

```
$ greengo update
```

Apply your changes by deploying it again:

```
$ greengo deploy
```
@@ -89,12 +89,17 @@ Yeah, manual sucks... I will automate it later. Or, submit your PR!
```
$ vagrant destroy
```
For any of the above commands you may specify a different yaml file using
```
$ greengo --config_file <name>.yaml <command>
```
where <name> is the name of your yaml and <command is whatever you wish to run>

> NOTE: If you want to create a new group but keep the Greengrass Core in the same Vagrant VM,
> you must update it with newly generated certificates and `config.json` file
> before deploying the group, and also reset deployment by getting
> the `deployments/group/group.json` back to virgin.
>
>
> To do it: login to the Greengrass Vagrant VM and run `/vagrant/scripts/update_ggc.sh` on the Vagrant VM.
## Details
@@ -103,18 +108,18 @@ Yeah, manual sucks... I will automate it later. Or, submit your PR!
How to be sure ~~everything~~ something works? Follow this:

1. Create greengrass group in AWS IoT: `greengo create`.
2. Prepare GGC on the VM: update certificates, reset `group.json`, restart the `greengrassd`.
2. Prepare GGC on the VM: update certificates, reset `group.json`, restart the `greengrassd`.
3. Deploy with `greengo deploy`. Check:
* Check the deployment status, should be 'Success'
4. Explore Greengrass Core on your vagrant VM.
* Login to Vagrant VM. You should nkow Vagrant but for the off case: `vagrant ssh`.
* 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`.
If the function starts successfully, `runtime.log` will contain a message like
* 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`.
If the function starts successfully, `runtime.log` will contain a message like
```
[2018-03-31T08:48:40.57Z][INFO]-Starting worker arn:aws:lambda:us-west-2:0000000000:function:GreengrassHelloWorld:12
```
* Find and check your own Lambda log under `/greengrass/ggc/var/log/system`.
* Check the greengrassd process: `ps aux | grep greengrassd`.
* Check the greengrassd process: `ps aux | grep greengrassd`.
Depending on deployment you might have several processes.
5. In AWS console, check the MQTT topic with IoT MQTT Test page:
```
@@ -129,7 +134,7 @@ and you gotta pick up the pieces. Remember:

* You are still not worse off doing this manually: you at least have all the `ARN`
and `Id` of all resources to clean-up.
* 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.
* 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.
* 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.

Please pay forward: PR a patch to whatever broke for you to prevent it from happening again.
@@ -0,0 +1,66 @@
# Greeengrass Group definition file
Group:
name: GreengoGroup
Cores:
- name: GreengoGroup_core_1
key_path: ./certs
config_path: ./config
SyncShadow: False

Lambdas:
- name: GreengrassHelloWorld
handler: function.handler
package: lambdas/GreengrassHelloWorld
alias: dev
# role: 'arn:aws:iam::000000000000:role/base_lambda_role' # Use an existing role instead of auto-created one
environment:
foo: bar
greengrassConfig:
MemorySize: 128000 # Kb, ask AWS why
Timeout: 10 # Sec
Pinned: True # Set True for long-lived functions
Environment:
AccessSysfs: False
# ResourceAccessPolicies:
# - ResourceId: 1_path_to_input
# Permission: 'rw'
Variables:
name: value
- name: HWBeta # refer already created Lambda by a name
alias: dev
environment:
foo: bar
greengrassConfig:
MemorySize: 128000 # Kb, ask AWS why
Timeout: 10 # Sec
Pinned: True # Set True for long-lived functions
# the rest of AWS IoT function definition goes here
Subscriptions:
- Source: Lambda::GreengrassHelloWorld
Subject: hello/world
Target: cloud
- Source: cloud
Subject: hello/world
Target: Lambda::GreengrassHelloWorld

Resources:
# For parameter definitions, see http://boto3.readthedocs.io/en/latest/reference/services/greengrass.html#Greengrass.Client.create_resource_definition_version
- Name: path_to_input
Id: resource_1_path_to_input
LocalVolumeResourceData:
SourcePath: /images
DestinationPath: /input
GroupOwnerSetting:
AutoAddGroupOwner: True

Loggers:
# For parameter definitions, see https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/greengrass.html#Greengrass.Client.create_logger_definition
- Component: Lambda # 'GreengrassSystem'|'Lambda'
Id: logger_1 # Arbitrary string
Level: DEBUG # 'DEBUG'|'INFO'|'WARN'|'ERROR'|'FATAL'
Space: 1024 # The amount of file space, in KB, to use if the local file system is used for logging purposes
Type: FileSystem # 'FileSystem'|'AWSCloudWatch'

Devices: # not implemented
- name: ml_take2_thing_1
key_path: ./certs

0 comments on commit f4e0999

Please sign in to comment.
You can’t perform that action at this time.