Purge Data when offline

I was reading Offline updates - Balena Documentation
And Actions and Settings - Balena Documentation
And I was wondering if

  1. It was possible to purge data when the system is disconnected from the Internet
  2. If yes - Can the system after purge restore all configurations including the network configuration?
  3. Also I’ve noticed two types of purges in here: Interacting with the balena Supervisor - Balena Documentation
    What is the difference between the two? POST /v2/applications/:appId/purge vs POST /v1/purge

Hi @shpixel,

Looking at your second question, I think your understanding of a device purge compared to mine might be different. I think of purge from the Supervisor’s point of view, in that the Supervisor purges data on a device by removing all volumes associated with a release and recreating them as empty. It sounds like the purge you’re referring to might be removing all data from a device – could you clarify?

Regarding question 1, when the system is disconnected from the internet, the only way to access the device is to do so from the same local network if the device is running a development OS. If you preload any SSH keys into the device running a production OS, then you can also access an offline device locally provided you have the correct SSH credentials.

Regarding question 3, both those endpoints use the same method under the hood, and they both remove & recreate volumes for a release as mentioned above.

Thanks,
Christina

@cywang117 We have a similar question. What happens if perform an API call to perform a device purge and the device is offline?
Does this request gets enqueued and is later processed once the device is back online?

BTW, whenever we call that API and the device is purged, we see lots of error messages in the Balena supervisor like this:

[event]   Event: Service stop error {"error":{"message":"(HTTP code 409) unexpected - removal of container 43e5c2a476bd0d4224f6189925cc6aecb075542b6696bfb36a427b4050957180 is already in progress ","stack":"Error: (HTTP code 409) unexpected - removal of container 43e5c2a476bd0d4224f6189925cc6aecb075542b6696bfb36a427b4050957180 is already in progress \n    at /usr/src/app/dist/app.js:2:643810\n    at /usr/src/app/dist/app.js:2:643742\n    at Modem.buildPayload (/usr/src/app/dist/app.js:2:643762)\n    at IncomingMessage.<anonymous> (/usr/src/app/dist/app.js:2:643015)\n    at IncomingMessage.emit (node:events:525:35)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"},"service":{"appId":1835772,"serviceId":1087896,"serviceName":"my-service","commit":"1b1889545ad121a8f9341fe792f776b2","releaseId":2610001}}

In the end the device is purged but the amount of error logs is a bit concerning:

[info]    Reported current state to the cloud
[success] Device state apply success
[event]   Event: Purge data success {"appId":xxxxxx}
[api]     POST /v1/purge 200 - 27656.978 ms
[info]    Applying target state
[warn]    Ignoring unsupported or unknown compose fields: containerName
[debug]   Finished applying target state
[success] Device state apply success