Coder Social home page Coder Social logo

tractr / directus-sync Goto Github PK

View Code? Open in Web Editor NEW
111.0 5.0 5.0 1.5 MB

A CLI tool for synchronizing the schema and configuration of Directus across various environments.

License: Other

TypeScript 98.70% JavaScript 1.20% Shell 0.10%
directus-extension devops directus environments

directus-sync's People

Contributors

bgenia avatar edouarddem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

directus-sync's Issues

Migrate from sqlite to mysql

Hi, was trying to migrate directus from sqlite to mysql. But I'm facing issues doing that with directus sync. Is there a better way to proceed ?

Creation of collection starting "directus_" will break directus (Schema diff and apply API)

Directus: V10.8.3
Self hosted

Behaviour:

The extension creates a collection starting with "directus_".

Problem:

Those collections are checked by directus system itself and they cant be deleted by the front-end admin panel.
The action will also prevent to use endpoint https://docs.directus.io/reference/system/schema.html#apply-schema-difference

suggestion:

use a different name convention in the extension that it does not conflict with "directus_"

"Trigger Flow" operation in flows working incorrectly

Of note: currently running Directus v10.2.1

When a flow includes the "Trigger Flow" operation, the flow UUID that it triggers is stored in the "options" field and is not updated causing the flow to become broken.

Example trigger flow in the operations.json file:

{
    "name": "Trigger Flow",
    "key": "trigger_y2due",
    "type": "trigger",
    "position_x": 48,
    "position_y": 48,
    "options": {
      "flow": "14714bf5-5645-4995-9d2b-8357b98b232d",
      "payload": {
        "data": "{{ $last[0] }}"
      },
      "iterationMode": "serial"
    },
    "resolve": null,
    "reject": null,
    "flow": "b9920111-288b-4200-8b0a-e480ebea19e7",
    "_syncId": "475769af-6e10-48a9-8e2e-83cc625e8686"
  },

I may not fully understand how the linking is working in directus-sync but that 14714bf5 flow ID is also the _syncId of the first operation in the flow that is triggered as well as the (as expected) "operation" field in the triggered flow in the flows.json file.

Per this, it seems like maybe the trigger flow operations are just not getting updated with the newly created triggered flow UUID after creation?

Happy to submit a PR after a bit more understanding of how this linking is working. Would there just need to be a check for flow being a key under options before this idMappers object and then updating it beforehand?

fetch failed: self-signed certificate

Hi,

We are using self hosted Directus:

Directus version: 10.8.3
Self hosted:

image

To replicate the error run Directus in a self-hosted with a self-signed certificate using HTTPS.

The call "pull" : npx directus-sync pull --config-path './directus-sync.config.cjs'

image

The device is in our intranet.. We got our own domain server, so we put the domain directly in the config.

This is our config

Thanks in advance :)

Dangling permissions after Directus upgraded

Hi I am running a Directus app with Docker,
I have a local file directus-sync.config.cjs mounted as a volume to the docker container /directus/directus-sync.config.cjs .
With this setup and on [email protected], directus-sync was doing a great job.

After upgrading to [email protected], I ran diff to see if any changes in schema with --force and DEBUG on.
The directus-sync diff log shows a list of [permissions] Will remove dangling id map.

If I do a push and run diff again, these messages still persist.
At this point, any changes made on directus access control is not recognised by directus-sync.

Wonder if there are any proper steps required for handling Directus upgrade?

Screenshot 2024-03-19 at 3 45 47 pm

Snapshot diff always returns no changes to apply

Hello,

I don't know if I am just too bad to use the tool but I cannot manage to synchronize Directus custom collections and so on that are named in directus-sync snapshot and are exported in snapshot folder.

Environment:
Directus: 10.9.3
directus-extension-sync (on Directus Servers): 0.4.0
directus-sync (on client CLI): 1.0.0 ? npx directus-sync -V => unknown

What I do:

  1. npx directus-sync pull -u https://sourceDirectusURL -e admin@email -p PASSWORD
  2. npx directus-sync diff -u https://targetDirectusURL -e admin@email -p PASSWORD
  3. npx directus-sync push -u https://targetDirectusURL -e admin@email -p PASSWORD

I always got for diff and push commands:
INFO (110897): [snapshot] No changes to apply

For the collections which are exported in collections folder everything is working fine.

I even tried with the --no-split option in case there was a parser bug, but I always got a "no changes to apply" message and my custom collection are not created / updated on the target Directus instance.

Is it a problem with how I use it? Am I not using the right versions?

Using data and config outside of docker

Thanks for this plugin! I'm trying to set it up so that I can add the data to my repository. What I've tried to do is share a folder with the docker container, and add the config to that folder, but I'm getting Missing option directusEmail, is my approach wrong?

Added directus-sync folder to my volumes

  directus:
    build: 
      context: ./ 
    restart: unless-stopped
    ports:
      - "8055:8055"
    volumes:
      - ./directus-sync:/directus-sync
      - ./uploads:/directus/uploads
      - ./extensions:/directus/extensions

Inside the directus-sync folder is the directus-sync.config.js file

I'm running the command inside my docker container using docker exec -ti directus-docker-directus-1 npx directus-sync diff -c ./directus-sync/directus-sync.config.js

Thanks!

Data sync + default data

It would be nice to have an option to sync actual data.
For example for API keys or data that always needs to be the same across deployments.

The other suggestion i have is to add default data.
This could come in handy in an ecommerce system with VAT rules or shipping options.

The only thing to watch out is relations, you cannot assume that every system has the same ids or relations.

Failed to migrate SQLite to MySql

Hi! I have a Directus instance on SQLite3. When I try to migrate to a MySql instance with the --force flag, I get the following error.
Both instances are version 10.9.3.
image

Project logo, public foreground and background

Any suggestions on an easy way to null out specific fields via configuration?

Specifically looking at:

    "project_logo": null,
    "public_foreground": null,
    "public_background": null,

in the settings.json collection file which were in my case set to UUIDs from the media library. Or are you considering situations like this with the custom data backup you mentioned in Discord? Thanks for such a great tool!

Freeze when pushing, how to debug?

I'm trying to push my schema, that I've just pulled, and my server seems to freeze up. I've tried pushes before with other schemas, and it takes a few seconds for info to start showing in the console, however with this schema there's never info in the console and my CPU stays at 100%

Screenshot 2024-02-11 at 16 35 12

I'm using docker, with this command docker exec -ti directus-docker-directus-1 npx directus-sync push

  • When I try a diff using docker exec -ti directus-docker-directus-1 npx directus-sync diff the same thing happens
  • When I add the -d flag, nothing changes, the server freezes before any output is seen

Any idea how I can debug this? Thanks

Bookmarks/Presets

Any thoughts on adding bookmarks/presets as a synced collection? I realize this may be better as a manually enabled collection rather than a default one since the collection can grow quickly but with the help of the onQuery hook filter, I'm hoping to pull out all globally set presets that get applied to a fresh Directus instance and keep them with the schema syncing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.