Skip to content

Data Model orchestration #10

@beasteers

Description

@beasteers

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-sidecar with REQ_URL and the extension could have a custom endpoint to do the apply)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions