[Solved] Upgrading a Losant Edge Agent

Hi

Its not super clear what the best practice would be for Upgrading the Edge Agent to the latest docker image, on running equipment.

Could you elaborate. I couldn’t find anything specific in the documentation.

Also I have a existing agent and would like to deploy an additional workflow however I can’t as I get this message

[AGENT NAME]
** Some of your selected devices have an agent version lower than the target version for this deployment.**
Deployment to these devices will fail until their agent is upgraded.

Hence the need to upgrade. Is there some way of selecting the Agent Version, as upgrading now is probably not the best time.

Thanks

Because the Edge Agent is a docker image, upgrading to the latest agent is just a matter of executing the docker pull command, and then restarting the agent. The latest tag on our Edge Agent always refers to the latest version we have released, but we also have explicit tags for each individual version. You can read a little more about it here.

As far as the target edge agent version for a workflow, you can read more about it here. You are allowed to “upgrade” the target edge version on a workflow, but never “downgrade” it (as we can’t easily tell if you are (or are not) using features in the workflow that would only be available on newer versions). When you create a new edge workflow, you can pick the initial target version, and it can be as old as you want.

Ahh , I missed the version on creation, was looking for it once it was created. My bad.

Thanks

I thought docker pull would be it, but wanted to make sure I wasn;t missing anything.

The only other thing to be aware of when upgrading is that hopefully you are using a mounted in volume for the agent - that way a new agent image can continue to use the previous local workflow storage and things like that. If you aren’t using a mounted in volume (that you then continue to mount in when you start the new agent image), that kind of data is lost (it is essentially as if you are deploying the agent for the very first time to the device).

I stopped the agent,
then did the sudo docker pull losant/edge-agent:1.5.0
the started the agent.
It’s still reporting v 1.3.1.
Not sure what I’m doing wrong

Hi,

It looks as though you are stopping, pulling, and starting the same container, which could be why you are seeing the same version; the pull will have no affect.

You will need to remove the old container with docker rm, per the Docker documentation, then pull and run a new container with the new version.

docker stop <container-id>
docker rm <container-id>
docker pull ...
docker run ...

In addition, if sudo is being used to pull, it should also be used to stop and start the container to avoid any unexpected behavior.

Hopefully this helps!
Julia

just realized that too.
I think I got it updated now, but in losant “/device/edge compute” it still says 1.4.0

FYI , I’m using the same deviceID, access key and Access secret for my Old Pi that I’m no longer using.
Could that be an issue?.

I just changed that to new access key e.t.c and that didn’t help.

1 Like

One thing you can try is to head over to the workflow page for your Edge workflows, and along the right side you will find “Agent Version,” where you can change your target agent version to be v1.5.0, as seen here:

Additional tips:
If your access key is restricted to specific devices, check to make sure your new device is allowed by the access key, as the scope cannot be edited and your new device might not have permission. If your device is not listed under “Access Restrictions,” a new access key will need to be made.

If you created a new device in Losant for the same Pi, the deviceID within our platform will be different from the previous device’s ID.

I have no luck with this device. Not sure what to do next.
DeviceID: 5c34f1a3eaf910000868d70b

Is it maybe because I have a bunch of attributes tied to this device ?

Can you please also provide the application ID that owns that device?

5c34f019a72f4c00092a0aff

This device hasn’t connected since yesterday at 5:54PM. The platform won’t update the known version until it successfully connects and reports the new version. I would recommend checking the Edge Agent logs to see if there are any connection errors. You can see them by running:

docker logs <container-id>

Found this in the logs.

2019-02-05T23:14:17.190Z [info] Agent Starting…
2019-02-05T23:14:17.210Z [info] Agent Version: 1.5.0
2019-02-05T23:14:17.221Z [error] Losant Edge Agent was unable to start due to the following configuration errors:
Permission denied when attempting to initialize persistent store at path /data/losant-edge-agent-store.db

If you’re mounting in a data volume (recommended), you will have to apply proper permissions so the Edge Agent can read/write to that volume. You can find the command to run here:

https://docs.losant.com/edge-compute/edge-agent-usage/#creating-storage-area

Yup, permissions was part of it, but I didn’t even have the storage path right.
It’s working now.

Thanks