DefangLabs / DefangLabs/defang

Support local volumes

Open
#288 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
166
Forks
24
Avg merge
10h 8m
Merged PRs (30d)
33

Description

Add support for locally mapped volumes. This could be implemented by building a sidecar image from the mapped files.

version: '3'
services:
  nextjs:
    restart: always
    image: caddy:2.7.6
    command: ["caddy", "file-server", "--root", "/static", "--listen", ":80"]
    #x-defang-static-files: /static
    volumes:
      - ./:/static
    ports:
      - target: 80
        published: 8000
        mode: ingress

Currently this emits a warning.


Discussion on what we should do based on customer needs, when do we need volumes?

  1. Dumb static website case, i.e. snake game by vibe coder. Very rarely there is code should be served without a building step, i.e. typescript, react, nextjs etc. This is already covered by current static-website case, or the user would be having a dockerfile for building, which would not require volume mount
  2. Mounting large files at runtime to avoid building huge images, i.e. LLM models. This is no longer needed by the majority, as most people use hosted models
  3. Mounting a volume to read-write files: most likely application needs to persist state as files locally
  • Due to software limitation, not able to use a remote database, or by design, i.e. NATS use case
  • Due to inexperience: It is nearly impossible to share read/write files correctly amongst multiple instances, will not scale

As a result, the most useful volume mount support we can provide for our users are, single instance mount to a disk with RO/RW support. This may also be extended to covers case 1, where a dumb website could be served from it if we implement data copy to the volume.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the warning emitted for locally mapped volumes, then clarify whether the target is sidecar-built local files, single-instance disk mounts with read-only/read-write support, or both. Done should be demonstrated by the provided Compose example working without the current warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
cli, cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.