Greengrass component local deployment doesn't run install lifecycle step

0

Hi, I am developing a set of Greengrass components and using the local deploy method to test them. The components have recipes that have install, startup and shutdown steps. My local deployments are using update-config to change the configuration, and the lifecycle scripts use the configuration values to do their stuff. I have found that although the local deployment appears to succeed, the install script of the components is not being run, so they are not installed correctly. When I do "component details" I can see the the configuration of the component has been updated. What needs to happen for a local deployment to run the install script? If it doesn't run, is there a way to make it run? I know that when the startup lifecycle step doesn't run I can use "component restart" to make it run.

asked 9 months ago323 views
4 Answers
1

Hi, reinstallation on a deployment will be triggered automatically only when the install command in the recipe changes. When you change the configuration and it has been referenced in any lifecycle commands in the component's recipe, the command effectively changes and Greengrass re-runs that command. Based on what you described, you're not referencing the config in the recipe but accessing it in your component process through Greengrass IPC API get_configuration. If you want to receive updates in your component for it you can use another IPC API subscribe_to_configuration_update which sends you a notification every time the configuration you subscribed to changes and you can retrieve the latest configuration again and react to it as appropriate for your application. You don't necessarily need the install command to re-run for that. https://github.com/aws/aws-iot-device-sdk-python-v2/blob/main/awsiot/greengrasscoreipc/clientv2.py#L867 & https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-component-configuration.html#ipc-operation-subscribetoconfigurationupdate

AWS
answered 9 months ago
AWS
EXPERT
reviewed 9 months ago
0

Thanks. Taking a step back, would you say that the local deployment functionality is not yet fully developed, so is a bit unreliable and unpredictable; or that it is just mysterious and after working with it for a while it is possible to understand its philosophy and predict what it will do in response to input? In other words, is local deployment expected to be used as part of a professional development cycle, or am I just wasting my time with it?

answered 9 months ago
  • Local deployments are absolutely supported. What Shagupta is saying is that install will not run unless install changes. So if your recipe is like install: echo hi, that would never reinstall on a configuration change, because nothing changed to require install to run again. install: echo {configuration:/message} would be called again if the message changed. Install will also run if the component version changes.

    For only changing configuration, I can recommend the local debug console component which lets you manually edit your component config without deployments.

0

Hi, thanks for reaching out. Could you share the relevant greengrass deployment & component logs and recipe of the component you're trying to update? To confirm, are you using the create-deployment command for the Greengrass cli with the update-config cli option for this? And have you referenced the config keys in your install command for the component such that it would get interpolated when you make a deployment for updating this config? When you first ran this component, did the install command run properly with the config values that were provided at that time? Having logs, config files and your recipe (with any sensitive information redacted) will help us troubleshoot this. You could also create a support ticket for this if it helps share this information more effectively.

Thanks

AWS
answered 9 months ago
0

Thanks. I'm new to this, so I didn't realise a support ticket was an option. i might pursue that for attaching files. To answer your questions, my deployment command looks like this: /srv/greengrass/bin/greengrass-cli deployment create --recipeDir /path/to/components-0.2.3/recipes --artifactDir /path/to/components-0.2.3/artifacts --merge au.com.redacted.component1=0.2.3 --merge au.com.redacted.component2=0.2.3 --merge au.com.redacted.component3=0.2.3 --merge au.com.redacted.component4=0.2.3 --update-config /path/to/local-update-config.json

The component recipe install step runs a python script, and the python script instantiates a greengrass client object and uses the "get_configuration" function to get the config. So I guess that means the keys are not explicitly listed in the recipe. Is that a requirement? Is the deployment checking for differences, and where?

Yes, I think the first install worked, but subsequent ones did not.

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions