appyter-catalog icon indicating copy to clipboard operation
appyter-catalog copied to clipboard

Dynamic appyter-catalog appyter injection

Open u8sand opened this issue 4 years ago • 1 comments

Currently, we construct a static docker-compose with a static ui page. One convenient modification was made when we added traefik which allows us to detect new containers and mount them without needing to stop the ingest. It would be very convenient if the same could be done with the catalog -- that-is, appyters (which have their catalog metadata in a predictable place in each of the docker images) can be automatically added/removed from the catalog when the docker container gets added or removed.

Technically all we'd have to do is detect updates to the docker containers and re-construct public/appyters.json which can be done with

docker ps -q \                   # list all docker containers
  | xargs -I'{}' \               # execute for each docker container
      docker exec -it '{}' \     # run in container
        cat /app/appyter.json \  # produce appyter metadata
      2> /dev/null \             # ignore missing file in non-appyter containers
      | jq -rcs \                # collect json into a compact list
  > static/appyters.json         # update appyters.json

fetch with {cache: 'no-cache'} will still allow us to cache public/appyters.json

u8sand avatar Dec 11 '20 18:12 u8sand

Alternatively we can probably use appyter-catalog-helper to register the appyter on postgrest and use the database for content.

u8sand avatar Dec 18 '20 15:12 u8sand