Skip to content

dstack-cloud: deploy large / externally-built (verbatim) app-compose.json#717

Merged
kvinwang merged 2 commits into
Dstack-TEE:masterfrom
kvinwang:chore/dstack-cloud-large-app-compose
Jun 7, 2026
Merged

dstack-cloud: deploy large / externally-built (verbatim) app-compose.json#717
kvinwang merged 2 commits into
Dstack-TEE:masterfrom
kvinwang:chore/dstack-cloud-large-app-compose

Conversation

@kvinwang
Copy link
Copy Markdown
Collaborator

@kvinwang kvinwang commented Jun 6, 2026

Summary

Two related changes to scripts/bin/dstack-cloud that let GCP deployments use a large or externally-built app-compose.json — e.g. self-contained apps that embed their payload inline (tools/sca), whose compose-hash is computed over their own serialization.

1. Size the shared FAT disk to fit app-compose.json (bug fix)

The shared disk image was a fixed 8M FAT32. A large app-compose.json (the guest already allows up to 50M) overflows it, so mcopy fails and deploy aborts with a non-obvious error. Now the image is sized from the actual shared-file sizes: floor 8M (small composes unchanged), +4M FAT metadata margin, rounded up to a whole MiB.

2. Support deploying a verbatim app-compose.json (feature)

Add an optional app_compose_file to the app config. When set, its exact bytes become shared/app-compose.json instead of being generated from docker_compose_file. The measured compose-hash is sha256 of the bytes on the shared disk, so an externally-built compose (e.g. from tools/sca) must be shipped verbatim — re-serializing via json.dump would diverge the hash. Generation is refactored into _emit_app_compose() so prepare and deploy stay consistent.

Compatibility

Both are backward-compatible: app_compose_file defaults to empty → existing docker-compose deployments take the exact same path as before. dstack-cloud never reads app-compose.json's fields back, so a verbatim (non-docker-compose) compose doesn't affect any downstream step.

Testing

  • Verbatim mode: shared/app-compose.json is byte-identical to the source (sha256 match), so compose-hash == the external builder's.
  • Fallback (empty field): generates runner: docker-compose as before.
  • Missing app_compose_fileFileNotFoundError (fail-closed).
  • Dynamic disk sizing verified by deploying a ~15M sca app-compose (8M → ~19M shared disk, mcopy succeeds).

kvinwang added 2 commits June 6, 2026 02:12
The shared disk image was a fixed 8M FAT32. A large app-compose.json (e.g. a
self-contained app that embeds its payload inline, up to the 50M guest cap)
overflows it, so mcopy fails and deploy aborts. Size the image from the actual
shared-file sizes instead — floor 8M (small composes unchanged), +4M FAT
metadata margin, rounded up to a whole MiB.
Add an optional App.app_compose_file: when set, its exact bytes become
shared/app-compose.json instead of generating from docker_compose_file. The
measured compose-hash is sha256 of the bytes on the shared disk, so an
externally-built compose (e.g. a self-contained app whose hash is computed over
its own serialization) must be shipped verbatim — re-serializing would diverge
the hash. Generation is refactored into _emit_app_compose() so prepare and
deploy stay consistent. Empty (default) is fully backward-compatible.
Copilot AI review requested due to automatic review settings June 6, 2026 09:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kvinwang kvinwang merged commit 1a4942e into Dstack-TEE:master Jun 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants