Search code examples
node.jsgoogle-app-enginegoogle-cloud-platform

How Can I Save my images uploaded in file system for a deploy on google app engine


In my App deployed on Google App Engine I save images uploaded by user in public folder of my File system (using Multer)

Now If I deploy a new version of my app the images uploaded are lost are lost how do I solve this issue

Is there any method with which I can deploy new version of my App keeping the images uploaded Intact?

Basically How can I Backup my File System?


Solution

  • App Engine is a serverless and stateless product. You lost the image if you deploy a new version, but also is the service scale up and down, or if your instance is stopped for maintenance and restarted on other servers (it's the case for Flex app engine which restart at least once a week).

    In this context, your design is not correct for using serverless product. You need to save the file elsewhere, typically in Cloud Storage and to load them from there. If you need to index, search, list your file, it's also a common pattern to save the metadata in a database, Cloud Firestore for example, to easily search the files, and then download them from Cloud Storage.

    Notes: there is no persistent file system, it's in memory file system on serverless environment. You can also have out of memory error if you store too much file.