Run component asuser

0

Hi All,

I have a python package, packed as a zip, it is unarchived by greengrass
but greengrass runs the final component as ggc_user
How can I specify the user which has the correct environment variables for which the setup has been done???
Note, that I am not sure, if that even will work, if the environment is correct, as in 'bash' when I run 'env' as that user. But that may be because of lack of linux experience.

Currently I have this deployment.json. Any help appriciated!

{
"targetArn": "arn:aws:iot:eu-west-2:20404040404:thinggroup/mygroup",
"revisionId": "24",
"deploymentId": "d9f4ea87-a6b7-4911-9de7-66caec7467fc",
"deploymentStatus": "ACTIVE",
"iotJobId": "d66414c5-1141-4b7c-b8af-8895a0de0943",
"iotJobArn": "arn:aws:iot:eu-west-2:4949494949:job/d66414c5-1141-4b7c-b8af-8895a0de0943",
"components": {
"com.helmet-detection": {
"componentVersion": "1.0.17",
"configurationUpdate": {
"merge": "{"runWithDefault":{"posixUser":"jetson:ggc_group"}}"
},
"runWith": {}
}
},
"deploymentPolicies": {
"failureHandlingPolicy": "ROLLBACK"
},
"iotJobConfiguration": {},
"creationTimestamp": "2021-11-03T17:00:07.657000+01:00",
"isLatestForTarget": true,
"tags": {}
}

enierop
posta 2 anni fa198 visualizzazioni
6 Risposte
0

Hello,
Please see the "runWith" portion in https://docs.aws.amazon.com/greengrass/v2/developerguide/create-deployments.html.

"runWith" is configurable on a per-component basis. In order to set it, you set the "runWith" key in the deployment under that component's key. It is not configurable as part of the configurationUpdate section of a deployment.

If you wish to change the runWith user for all components and not just a single component, then you will do a configuration update for the aws.greengrass.Nucleus component instead. https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration

Cheers,
Michael

AWS
ESPERTO
con risposta 2 anni fa
0

thank you very much, I cannot seem to set the runWith in the console....

Have tried 'create-deployment' using aws command but no solution
Where do I set this???
Thank you.

"components": {
"com.helmet-detection": {
"componentVersion": "1.0.18",
"runWith": {<------------> todo?}
}
},

enierop
con risposta 2 anni fa
0

Hi,
RunWith is settable in the console too. On the third page when creating a deployment you have a table listing the components to be deployed. Select the radio icon next to the component you wish to change, then click on the configure component button. At the bottom of the modal you can drop down advanced options and then change the runWith user.

Have a look at the API docs for setting the runwith using the CLI: https://docs.aws.amazon.com/greengrass/v2/APIReference/API_CreateDeployment.html

Cheers,
Michael

AWS
ESPERTO
con risposta 2 anni fa
0

Thank you, found that....

Unfortunately the component is still being ran as ggc_user
2021-11-04T08:08:57.115Z [WARN] (Copier) com.helmet-detection: stderr. WARNING:tensorflow:From /home/ggc_user/.local/l

When I do aws greengrassv2 get-deployment I have this...
"com.helmet-detection": {
"componentVersion": "1.0.18",
"configurationUpdate": {
"merge": "{"runWith":{"posixUser":"jetson:ggc_group"}}"
},
"runWith": {}
}

enierop
con risposta 2 anni fa
0

Hi,
You still haven't set the runWith user correctly. You are still setting the "runWith" user as part of the "configurationUpdate", which is not correct; it is a separate key.

You must set runWith in the deployment as shown below.

"com.helmet-detection": {
    "componentVersion": "1.0.18",
    "configurationUpdate": {
    },
    "runWith": {"posixUser": "jetson:ggc_group"}
}
AWS
ESPERTO
con risposta 2 anni fa
0

The point is, that the json I showed was created by the system after setting like

components": {
"com.helmet-detect": {
"componentVersion": "1.0.2",
"runWith": {
"posixUser": "jetson"
}
}
},

But I found out, that at the bottom left, there is a link, I never saw before, where we can enter a user...
This works.

enierop
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande