Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add current droplet guid in apps relationships #3860

Closed
gmllt opened this issue Jun 25, 2024 · 3 comments · Fixed by #3863 or #3960
Closed

Add current droplet guid in apps relationships #3860

gmllt opened this issue Jun 25, 2024 · 3 comments · Fixed by #3863 or #3960

Comments

@gmllt
Copy link
Member

gmllt commented Jun 25, 2024

Issue

There is no way to bundle current droplets and applications using /v3/apps and /v3/droplets.

Context

The only way to retrieve the current droplet of an application via the API is to go through the /v3/apps/:app_guid/droplets/current or /v3/apps/:app_guid/relationships/current_droplet endpoints.

In a context where we want to retrieve all the applications (more than 3000 in my case) and their current droplet, it is therefore necessary to make one request per application (more than 3000 requests).

Possible Fix

Add relationship information with a current droplet in API responses displaying apps.

{
...,
  "relationships": {
    "current_droplet": {
      "data": {
        "guid": "<droplet-guid>"
      }
    }
  },
...
}

This can be added quickly by making the droplet_guid field of the apps table visible via the API, but this field is not updated when the current droplet is deleted and at this point, I don't know how to handle this correctly in the DeleteActionJob.

Example :

  • I push a new application
  • I delete the droplet
  • The droplet_guid field in the database is still here, even if the droplet no longer exists.
@philippthun philippthun linked a pull request Jun 28, 2024 that will close this issue
5 tasks
@philippthun
Copy link
Member

[...] this field is not updated when the current droplet is deleted [...]

The question is, if it should be allowed to delete the current droplet at all?

@stephanme @Gerg @sethboyles - I think it might make sense to add a check to DELETE /v3/droplets/:guid that prevents the deletion of the "current droplet". What do you think?

@philippthun philippthun reopened this Aug 8, 2024
@philippthun philippthun linked a pull request Aug 9, 2024 that will close this issue
5 tasks
@philippthun
Copy link
Member

I've created a PR (#3926) that clears the droplet_guid of an app when the corresponding droplet gets deleted.

@philippthun
Copy link
Member

I've created a PR (#3960) that prevents the deletion of the current app droplet.

@philippthun philippthun linked a pull request Sep 9, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants