-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
I'm trying to deploy directus as part of an automatic CI/CD pipeline (with terraform) so that instances can be brought up and down automatically.
Ideally, I'd like to synchronize directus's snapshot so that it can be instantiated from a github repo. I'm thinking of adding some sidecars such as git-sync and another sidecar that runs npx directus schema snapshot --yes ./snapshot.yaml periodically to dump the current schema so that it can be picked up by git-sync and uploaded to github.
So all that needs to be done to the chart for that part is to add the ability to add sidecars to the deployment.
But the second part is how to apply the snapshot to directus. The obvious answer is to use an initcontainer and to mount the snapshot as a config map, but it would need to be careful to not overwrite changes that a user makes through the UI.
That leads me to think that there is room for an extension that synchronizes the schema with a local file
- Listen to data model change events -> write snapshot to file
- (I don't see data model changes in the events listed 😥)
- Watch for file change events -> apply snapshot
- (Can use
kiwigrid/k8s-sidecarwith REQ_URL and the extension could have a custom endpoint to do the apply)
- (Can use
Then you'd use git-sync to sync the file with github.
I'm wondering if anyone else has a similar use case?
tl;dr - looking for a robust way to sync the directus data model with git