Mounting volumes for an Application
2 minute read
We can use the blow command to create volumes and mount the created volumes. Drycc create volume support ReadWriteMany, so before deploying drycc, you need to have a StorageClass ready which can support ReadWriteMany. Deploying drycc, set controller.appStorageClass to this StorageClass.
Use drycc volumes
to mount a volume for a deployed application’s processes.
$ drycc help volumes
Valid commands for volumes:
volumes:create create a volume for the application
volumes:list list volumes in the application
volumes:delete delete a volume from the application
volumes:client the client used to manage volume files
volumes:mount mount a volume to process of the application
volumes:unmount unmount a volume from process of the application
Use 'drycc help [command]' to learn more.
Create a volume for the application
You can create a csi volume with the drycc volumes:create
command.
$ drycc volumes:create myvolume 200M
Creating myvolumes to scenic-icehouse... done
Or use an existing nfs server
$ drycc volumes:create myvolume 200M -t nfs --nfs-server=nfs.drycc.com --nfs-path=/
Creating myvolumes to scenic-icehouse... done
List volumes in the application
After volume is created, you can list the volumes in this application.
$ drycc volumes:list
=== scenic-icehouse volumes
--- myvolumes 200M
Mount a volume
The volume which is named myvolumes is created, you can mount the volume with process of the application,
use the command of drycc volumes:mount
. When volume is mounted, a new release will be created and deployed automatically.
$ drycc volumes:mount myvolumes web=/data/web
Mounting volume... done
And use drycc volumes:list
show mount detail.
$ drycc volumes:list
=== scenic-icehouse volumes
--- myvolumes 200M
web /data/web
If you don’t need the volume, use drycc volumes:unmount
to unmount the volume and then use drycc volumes:delete
to delete the volume from the application.
Before deleting volume, the volume has to be unmounted.
$ drycc volumes:unmount myvolumes web
Unmounting volume... done
$ drycc volumes:delete myvolumes
Deleting myvolumes from scenic-icehouse... done
Use volume client to manage volume files.
Assume the volume which is named myvolumes is created and mounted.
Prepare a file named testfile.
$ echo "testtext" > testfile
Upload. $ drycc volumes:client cp testfile vol://myvolume/ [↑] testfile 100% [==================================================] (5/ 5 B, 355 B/s)
List files in myvolume.
$ drycc volumes:client ls vol://myvolume/
[2024-07-22T15:32:28+08:00] 5 testfile
Delete testfle in myvolume.
$ drycc volumes:client rm vol://myvolume/testfile
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.