fly-apps / fly-laravel

Run your Laravel apps on Fly
42 stars 3 forks source link

Adding a Volume to a Laravel Web App #42

Closed KTanAug21 closed 11 months ago

KTanAug21 commented 1 year ago

Hi Team! I'm planning on adding an option to add volume to the Laravel Fly app:

Question: Should we have a separate command for adding volume? Or should it be included in the launch command? -I'm thinking it should be part of the launch command since it's not a separate app from the laravel web app, unlike mysql, redis, etc( which would be on a separate command right?)


Steps: -The user will be prompted if they want to add a volume to the Laravel Fly App, -Prompt for directory to attach the volume, with default being the storage folder -Prompt for size of volume to attach, not sure about default size yet

KTanAug21 commented 1 year ago

Make sure following considerations be taken into account during implementation: https://fly.io/docs/reference/volumes/#volume-considerations

What about when multiple processes are selected for the web app, wouldnt that create a machine per process(or not?)would those need additional volume as well?

Detect number of processes: Checking the selected processes is enough right?

Johannes-Werbrouck commented 1 year ago

You can add a volume in the fly.toml file, and even specify what processes need a volume, like this:

[mounts]
source = "<volume-name>"
destination = "/storage"
processes = ["app"]

(this code is untested)

This way, you can specify that the web app needs a volume, but the cron service worker does not. If no available volume with name is found, flyctl will automatically create a 1GB volume.

KTanAug21 commented 1 year ago

neat thanks @Johannes-Werbrouck !