Cloudfoundry: how to use the file system

I plan to use the paas cloud services service (from VMWare) to host my node.js application. I saw that it supports mongo and redis at the service level and node.js framework. So far so good.

Now I need to save my media files (images uploaded by users) to the file system. I have metadata stored in Mongo.

I searched the internet but have not yet received good information.

+6
source share
2 answers

You cannot do this for the following reasons:

  • Several host machines are running on your computer. Each of them has its own file systems. Each running process in your application will display a different set of files.
  • The host machines that your particular application runs on can change instantly. In fact, they will change every time you redeploy the application. Each time the process starts on a new host computer, it sees an empty set of files. Each time the process stops on the old machine, all files will be deleted permanently.

You absolutely must solve this problem differently.

  • Save the media files to the MongoDB GridFS file.
  • Store media files in a storage facility such as Amazon S3 or Rackspace cloud files.
+10
source

The file system in most cloud solutions is β€œephemeral”, so you cannot use FS. You will need to use solutions such as S3 / DB for this purpose.

0
source

Source: https://habr.com/ru/post/909824/


All Articles