Search code examples
phplaravelgoogle-app-enginegoogle-cloud-platformlaravel-scout

How to persist a file across google app engine deployments in flex environment?


I'm using Google App Engine flex PHP environment to run a Laravel php application. I'm trying to implement Scout search, which has two steps for setup:

  1. Index all documents to create a local index file. This is a one time process.
  2. Perform search activities using the index file.

The driver used for the search is TNTSearch.

Due to the distributed nature of the environment, new deployments wipe out the file system to deploy the code, thereby deleting the index file.

I'm looking for an approach to persist the index file across deployments.


Solution

  • App Engine Flexible does not persist data. If you want to use Flexible, you will need to store your data someplace else and load the data on instance creation.

    You do not mention how large the index is. If it is reasonable in size (less than a GB), you can store the index on Cloud Storage and then download the file(s) on startup. Do pay attention to the pricing of data storage, region location, and bandwidth requirements.

    If the data is very small, as in a few MB, include the index as part of your program configuration files. With that method, the index will always be available.

    Otherwise, I would use a different service such as Compute Engine.