bcc-code / directus-schema-sync

The better way to sync your Directus schema and data between environments
Apache License 2.0
90 stars 4 forks source link

Allow for unattended installation of extension for CI and development #33

Closed HDDTHR closed 1 month ago

HDDTHR commented 3 months ago

As of right now, anyone wanting to setup directus-schema-sync will have to install it using npx, then restart it to set the SCHEMA_SYNC environment variable to start syncing.

I propose that a SCHEMA_SYNC_AUTO_INSTALL environment variable be added to automatically install the extension.

I created an example github repository demonstrating how this could be used.

martin-braun commented 1 month ago

I wonder why this is necessary. I do install schema-sync in a deployment scenario too. Your CI/CD pipeline can deploy the files and npm ci, npx directus bootstrap --skipAdminInit and finally npx directus schema-sync install followed by npx directus schema-sync import.

If this is part of your deployment, you don't even need the SCHEMA_SYNC env variable and personally I would even refrain from using it. Being explicit about imports and exports gives me peace, knowing that only my own automation can break things, not someone else's.

HDDTHR commented 1 month ago

@martin-braun Honestly, my primary focus was on deploying my setup with docker compose, as it's what I use most of the time for CI, but your suggestion is logical. I envisioned that the developer would set things up similar to the example repository above, but if they use some other CI solution, it would work even better.

I think I'll be closing this pull request <3