backend.ai icon indicating copy to clipboard operation
backend.ai copied to clipboard

Add "app" vfolder usage mode to compose the container filesystem

Open achimnol opened this issue 3 years ago • 1 comments

Let's make our commonly used kernel runner binaries and applications (such as ttyd, vscode, etc.) "composable", so that we can merge multiple of them and inject the directories/files into the compute containers.

There may be multiple ways to implement a catalog of such "container libraries", but a special type of vfolder should do a good job because:

  • Updating and redistributing an app library is as simple as just updating the app vfolder.
  • Testing and packaging becomes also as simple as just compressing required files.

Things to implement:

  • a new vfolder usage mode: APP (in addition to existing GENERAL, MODEL, DATA)
    • When creating a new container, the agent should take care of extending the container creation arguments such as mount configurations and/or environment variables depending on the usage mode.
    • While #665 involves vfolder backends to specify how the contents of vfolders are provided/sourced, the vfolder usage mode should handle actual population of the files and directories inside the container.
      • Q: Could we use any low-level overlayfs APIs instead of specifying a (potentially long) list of individual mount options of the Docker/CRI container creation API?
      • We need to define the role and responsibility of vfolder backend and vfolder usage mode more clearly.
  • a fast/cached vfolder metadata query API
    • We need to define metadata.json schema to cover app vfolders as well.
    • https://github.com/lablup/backend.ai/blob/f43b7966e9c14f83fba203f532bc9d93e504d900/src/ai/backend/storage/vfs/init.py#L147
      • Currently the put/get APIs for vfolder metadata are only defined in the storage proxy and there is no related APIs exposed in the manager API.
      • Q: Would we need to cache a copy of metadata.json in the vfolders table?

Things to consider in the app vfolder metadata schema:

  • backend-plugin compatibility check (e.g., docker, k8s, ...)
  • image-plugin compatibility check (e.g., only applicable to images with specific tag)
  • declaration of additional service ports & injection of service definition configs by plugins
    • When creating new containers, the image label ai.backend.service-ports should be merged with the plugin-declared service ports and set as the container label.
  • generic mount lists based on package resource paths
    • Depending on the app, it may be a single large directory that contains every dependency or a list of multiple directories and files.
### Tasks
- [ ] #1066 

achimnol avatar Mar 22 '22 02:03 achimnol

where should metadata or service definition configs be located?

fregataa avatar Oct 19 '22 12:10 fregataa