-
Notifications
You must be signed in to change notification settings - Fork 19
Description
We currently include the Gatsby lmdb datastore (data.mdb) in the lambda bundle, then move it into the tmp dir at first run, because it needs to be in a writeable filesystem. The problem with this is that for large sites the database can be larger than the maximum lambda deploy size. We could avoid this by instead loading the db from the CDN at first run. This would mean its size would be limited only by the max tmp dir size (512MB), but it would have a cold start cost. It would also mean the db was technically exposed to the internet. However if we create a filename that is very long and random then that is equivalent to password protection. The filename could be bundled inside the lambda instead, along with a hash of the file.
Because of the tradeoff, it would make sense for this to be optional. We could either do it automatically if we see the datastore is larger than a certain size, or we could use an env var and give an error message that suggests enabling it if the db is too large.