[feat] add flags to limit extraction #108
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a number of flags to the
extractcommand.--skipCollectionFiles: do not extract thedirectus_filescollection--skipDownloadFiles: do not download the actual file attachments--syncExtractContent: extract content collections in a serial manner to limit load on instance--limitContentCollections "articles,something_else": only extract named content collectionsMotivation
We have a few very underpowered instances running Directus in a Kubernetes context, with a limit on CPU usage. Some of these have large collections, for example large amounts of image files. Running the template extract will cause the CPU load on these instances to spike over a long time, causing them to crash eventually (either by running out of RAM or by being forcibly stopped by Kubernetes).
To make the template CLI usable without crashing the instances, we had to disable all file related extractions. Thus, these added flags.
Possible Issues
By selectively extracting collections or files, there is a real danger of breaking relations if other collections point to these missing entries. Managing these issues is the responsibility of the user - since these flags are only to be used in specific use cases, it is assumed that the user knows what he or she does...
Edit: just noticed that a similar PR exists. Oh well...