Skip to content

Support local volumes #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #180
lionello opened this issue Apr 19, 2024 · 4 comments
Open
Tracked by #180

Support local volumes #288

lionello opened this issue Apr 19, 2024 · 4 comments
Milestone

Comments

@lionello
Copy link
Member

lionello commented Apr 19, 2024

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.

@lionello
Copy link
Member Author

See also #490

@lionello
Copy link
Member Author

This requires volume support, before we're able to copy the local files into the created volume.

@lionello lionello added this to the V2 milestone Jun 26, 2024
@raphaeltm
Copy link
Collaborator

I'm going to flag that this issue seems to be about mounting files from a local build context into a volume, as opposed to #818 which is about creating a volume that should be populated by the image at runtime/and persisted.

@raphaeltm
Copy link
Collaborator

raphaeltm commented Oct 31, 2024

Though... depending on implementation, I guess these could work similarly:

  • When defang compose up is run, we create a cloud volume (EBS or something)
    • If they're using the ./localdir:/containerdir syntax, we create it based on the ./localdir name
    • If they're using the volumename:/containerdir syntax we create it based on the volumename
  • If they're using the ./localdir:/containerdir syntax, we check if there is anything in the volume
    • If there is, we copy that to the cloud volume

We need to figure out, with the ./localdir:/containerdir syntax, if we just upload the local data the first time the user runs defang compose up or every time.

I suspect we'll need a bunch of warnings to make this usable and safe at the same time.

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

No branches or pull requests

2 participants