-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to import/export/syncronize content #135
Comments
@fgeyer16 , WDYT? |
I only read from the content-synchronization now, so I do not have any practical "feeling" how it works and what could be the pitfalls. And I am a great fan of Drupal 8's migrate module so my opinion is likely biased ;-). I think the need to do configuration is the advantage and disadvantage of the migrate module at the same time as the easy use of the content-synchronization is its advantage and disadvantage as well. Do we have dev-only content? But I think we will have dev content as well as we have dev config which should not be moved from dev to testing or prod. For config there is the config-split module to define sets of configurations so you can move them separately without the need to sort out the "1 000 not needed config yml files from the 1 000 000 existing config yml files". But for content-synchronization you have to sort them out manually or you have to export content by uuid. And this every time you want to synchronize which is may be very time consuming. While if you use migrate you will have to do time consuming configuration like a view (e.g. all nodes without titles beginning with "DEV" ) and the migration only once. Get real world content into dev Another pitfall I see with content-synchronization is that data models in dev/testing/prod are not necessarily the same. In direction dev->prod they should be. but what if we need real world content in dev e.g. given to test automatic tagging of content, or some cool new feature which needs change in data model (change of field type , new fields or something similarly ). Then content-synchronization will fail, because it assumes that data model is the same. Is it sensible to have two modules to do the same? I think for csis we will need the migrate module anyway to mirror offers (solutions) and show cases from marketplace to csis. In csis they will have only the fields which are needed to show them (title, summary taxonomies and location) and the link to the full content on the marketplace. So this has to be done with migrate. Syncing automatically Automatic syncing is maybe not a scenarion for syncing dev/testing/prod just for completeness: This are my thoughts. As I said at the beginning this is likely biased to favor migrate because I already worked a lot with it, and like it. If you do not manage to write a migration for some content dependent on taxonomies and other stuff you maybe should rethink the data model for less complexity ;-). |
Since we don't want users to enter data into the prod system when is not yet synchronised with the dev system, we temporarily point both csis.myclimateservices.eu and csis-dev.myclimateservices.eu to the dev system. See also #23 (comment) . Once the migration strategy has been implemented, we'll use csis.myclimateservices.eu for the prod system. |
@fgeyer16 you can test the synchronisation now between https://csis-dev.ait.ac.at/ and https://csis.ait.ac.at/ |
I tested the Config Split module mentioned by @fgeyer16 . I think this is what we should use for handling import/export of Drupal configuration, since it allows us to define e.g. which modules to be active only in Dev-environment, or that CSS and JS files should be aggregated on the Prod-Server etc, etc. I will run it on our two new servers with @fgeyer16 and as a start define that the Devel module should only be enabled on Dev. Note: With this module it's possible to handle differences in the configuration which are more or less permanent (like examples above). Managing scenarios like "we added a new field to data packages in Dev but don't want it just yet on Prod in the next synchronization" are practically impossible to handle with this module. |
For the import/export of actual content I'll now look into option 2 proposed by @DenoBeno (content synchronization with drush). I think that should be our preferred way of migrating content, since it's flexible and doesn't require any configuration. Should it sometimes fail (due to changed data models in Dev, etc) we can go the extra mile and configure the migrate module to handle that specific content type. Regarding dev-only content: |
Just an idea: If we commit the configuration into our private GitLab repo we can probably set-up some git-lab pipelines that trigger integration tests and automated deployment. |
Sounds good, but doesn't work... Unfortunately, not even basic functionality via BE (import/export of full site content or individual node) is working correctly. This module seems to have issues with hierarchical taxonomy terms, which it wrongly tries to duplicate. @fgeyer16 let's discuss this today. IMO trying to fix this module will take just as much time as going with the migration module and configure it for every one of our content types. |
Config Split module tested on our 2 new servers and it works as hoped. I'll write a more detailed "best-practice issue" about how to import/export configuration later. Here's just a short summary:
|
As for the import/export of content, after discussion with @DenoBeno and @fgeyer16 I will now look into these two modules: Structure sync and Features |
The Features module is not meant to be used in Drupal 8 for this purpose (as mentioned by its developers). We can use the Structure sync module to import/export our taxonomy terms (countries, cities, study types, hazards, ...). It works similiar to the Config Split module - taxonomy terms are exported as a single yml file into the same sync folder as the configuration. I'll describe the process step-by-step in another "best practice" issue. It features a couple of options for the import and export, but for reasons mentioned below we should always select all taxonomies for export and run the import in Downsides:
@fgeyer16 since you praised the Migrate module so much, I'd like to give it a try for the content syncronization that is still unresolved. Could you please provide a working configuration for just one of our content types, so that I can then more or less copy&paste that for the remaining content types? You seem to have the most experience with that module, so this would probably be the most efficient approach. |
@patrickkaleta a working migration for content types has to be done first, but I have already a working migration for hazard taxonomy which was used to migrate hazards from csis to marketplace: import hazards.txt For content (nodes) we will have to create migrations for taxonomies used by node first. So we will need taxonomy migrations anyway. Please notice that this yaml as it is only will update terms imported by this migration and duplicate existing taxonomy terms which were created not by this migration. Assuming that in future dev and prod of csisi originates from the same systems uuids should be the same so we can update by looking up uuids of existing terms: import hazards lookup.txt I will provide a full content type import in the next days. |
I see, so if we want to use Migrate for our content types, we will have to use it for our taxonomies as well... In that case I guess, we will have the Structure Sync module as a backup solution |
Here is an working example for updating existing and creating new hazards. This needs to be a chain of migrations since we cannot update the icons and terms in one migration properly. Then we can update the hazards: import.hazards.txt |
Ok thanks for the updated files. I will try them out, write a detailed "Best practise" issue for that and start working on the migration files for the necessary content types and taxonomies which we want to synchronize between our two systems. |
So thanks to the latest example files provided by @fgeyer16 I was able to create the migration files for all of our taxonomies (in total 27, two taxonomies were omitted since they are either completely empty or marked as obsolete and therefore not relevant for us right now). They all seem to work, but I can do a proper testing only after I create a couple of migrations for some content nodes as well, since they are referenced by some of the taxonomies ( In addition to that, we then most urgently need the migration file for data packages (and migrations for all its referenced items). I'm hoping to get all of that (writing missing migrations, run proper testing, write a "Best practise" Issue) by the end of this week or early next week. |
I finished the migration files for the GL-step, DP_source and DP_license content types. So, all of the taxonomies can now be synchronized. Now working on the migrations for the Data packages (I completely forgot about all the references in the DP_resources, which of course also will require their own migration scripts), so I'm hoping to have that done by the end of today. Proper testing of the content synchronization should be done by Wednesday. |
I believe it's done. "Best practice" issues for the synchronization are: In short:
Not short:In total, I've created 51 migration files (22 for Nodes, 27 for Taxonomies, 1 for Files and 1 for Paragraphs). Running each of them individually in the correct order during a synchronization would be slow and error-prone, so I suggest to create a simple bash script will all the needed migration commands, which would be executed inside the Docker-container. For testing, I completely removed all content in my local instance and ran the content synchronization. It looked good - data packages and resources seemed to be complete and I was able to create new Studies. The thorough testing I had in mind first (viewing the JSON exports of the REST-Views from the live CSIS and my local CSIS side-by-side) turned out too complex. Certain fields (date created & updated, IDs and reference IDs, ...) won't be the same, so these JSON export won't ever be 100% identical and reading through 50 different exports with well over 1000 items would require too much time. From what I went through, I couldn't find anything that seemed wrong, so I'm confident it works. Maybe the CSIS Testing Team could look into that in more detail? Or probably better, we let them have a look at the system after such a synchronization and see what bugs they are able to find and keep a faulty migration as possible reason in mind. |
I agree. We'll validate by Acceptance Tests. So what are the next steps now? Try to resolve remaining showstopper issues and then
|
Yes, I believe those are the remaining necessary steps. |
done |
As we are moving from a single site to devel/test/public schema, we need to establish some way to syncronize part of the content across sites.
Drush commands documentation looks promissing, but this needs to be tested: https://www.drupal.org/docs/8/modules/content-synchronization/drush-commands
The text was updated successfully, but these errors were encountered: