bleathem / keynote2015-beacon

Location-scanner multi-foci force-layout using d3.js and Rx.js
8 stars 9 forks source link

New endpoints for mobile integration #25

Open ryanj opened 9 years ago

ryanj commented 9 years ago

mocking out ideas for mobile integration endpoints...

GET /containers

This should return the full list of known demo containers. A kubernetes label can be used to track these instances and to make sure our viz apps are excluded from the result:

[{
  id: 4f903438061c,
  hostname: "http://4f903438061c.containers.example.com",
  env: {}
},
{
  id: 1265e16d0c28,
  hostname: "http://1265e16d0c28.containers.example.com",
  env: {
    user_id: 123456,
    claim: "claimed by ryanj');DROP TABLE CONTAINERS;--"
  }
},
{
  id: ac1d5afd7b69,
  hostname: "http://ac1d5afd7b69.containers.example.com",
  env: {}
},

...

{
  id: 7c89455832dd,
  hostname: "http://7c89455832dd.containers.example.com",
  env: {
    user_id: 234567,
    claim: "claimed by bleathem"
  }
}]

WS GET /changes

Listen to a websocket stream of status updates

GET /container/id

should return a single item

{
  id: 7c89455832dd,
  hostname: "http://7c89455832dd.containers.example.com",
  env: {
    user_id: 234567,
    claim: "claimed by bleathem"
  }
}

PUT /container/id

Set ENV keys for this container in the querystring to claim (or steal):

  /container/7c89455832dd?user_id=INT&claim=urlencoded%20VARCHAR256

DELETE /container/id

Kills the container (using docker kill id), but does not remove the ENV state (stored in kubernetes). K8s should recover the app, including any provided ENV keys.

bleathem commented 9 years ago

How about moving /changes to /container/changes?

ryanj commented 9 years ago

Sounds good. I'm working out API implementation here: https://github.com/ryanj/1k-commander

Up next:

ryanj commented 9 years ago

Sounds like we may be sending PNGs instead of text-based "claims". An admin review queue may be needed.

We can't store PNG data in the ENV. PNG images will be destroyed when the container is deleted.

ryanj commented 9 years ago

Mobile / Feedhenry team is going to own the data validation UI. They'll post the cleaned result directly to a container. All data will be lost when/if the container is destroyed.