This blog post talks about an approach on how to disable Kentico Continuous Integration when you no longer require using it.
Kentico Continuous Integration
Kentico Continuous Integration (Kentico CI) is a great way of setting up a working environment with Kentico EMS. The setup allows individual users to work on websites using their local machines running with a local database.
The tool is used to serialise most of the Kentico objects from the database into XML files. The serialised XML are a part of the file system; therefore, you can utilise version control systems like Git. Using them can help push and pull these files to transfer data between the members of the development team. Each time you update an object, this is tracked for others to receive your changes.
The recommendation and best practice is to use this on no production environments. Let's look at some of the benefits of using Kentico CI.
Benefits of using Kentico Continuous Integration
Kentico CI is a fabulous tool and has made development on our projects faster and less dependent on a shared environment.
Let's explore the benefits of Kentico CI:
- Allows you to work locally and facilitate faster development
- Avoiding the need to be connected to the internet to carry on with development
- Local database, means you can make changes quicker
- Restore team members work quickly and automatically into your database
- Depending code and object changes are only pushed to others when your happy and they get pushed together
Although within your team disciplines would need to be followed to ensure each member of the team restores Kentico CI in the correct and efficient way.
More information about Kentico CI
Problems you could face when using Kentico CI
While working with Kentico CI you may experience problems during your working environments. Here are some of the challenges you could face:
- Multiple people working on the same feature simultaneously
- Not following the recommended guidelines of how Kentico CI works
- Making sure the restore tool is ran on every occurrence when things could change e.g. Pulling changes from others within the same branch, changes over to another branch etc...
- Renaming of the same page continuously
- People forget to run the restore tool
- People don't check in the Kentico CI files
- People carry on without fixing the restore tool shows errors
- People make changes to database without making it in the Kentico admin area
While Kentico CI may take time to get comfortable with, once mastered it is a powerful tool in local development.
To help with some of the problems you could face, here is a Kentico Continuous Integration Cheatsheet for you to use when working with Kentico CI.
When is it useful to disable Kentico CI?
There can be scenarios where either some of the problems mention above just cause projects to go sour and take longer to resolve and fix Kentico CI errors. Once the tool begins to impact your teams confidence and demands significant time to resolve errors it may be time to rethink.
Another example of when to consider disabling the tool is when it is running on environments where it is not recommended to be used. Such an example could be on the staging and production environments, where you may be using Kentico Content Staging to stage object changes across and do not wish for page and visitor content to be overwritten.
With this in mind, let's look at a solution on how to disable Kentico CI after its been used and activated on a project.
Disabling Kentico Continuous Integration
Here are some of the key components of running Kentico CI:
- The Kentico CI module within the admin area
- The XML serialised object files
- The restore tool within the CMS/bin folder
- The CI_FileMetadata table within the database, which stores the hash metadata for the serialised files
- The Kentico CI configuration file
The most intuitive solution to disable the tool is to enter into the admin area and simply untick the option for Kentico CI. While this an important first step, it is not a solution in its entirety.
All this would do, for anyone who has access to the module, is to prevent the user from performing a re-serialisation of all the objects.
It is important to not assume Kentico CI is fully switched off and your safe from anything Kentico CI related running. You can still run the restore tool, which could remove the latest pages and object changes to a last serialised point. This could be very embarrassing and dangerous on environments where the content is heavily changed by the client.
The next step is to remove all serialised files from the system. This would mean there would no longer be a restore point from what was previously serialised. Again, it would be highly dangerous to leave it at this stage. If anyone ran the restore tool, they would completely delete what you would expect to available in the admin area. What this means is that if there are no serialised files to restore, Kentico CI restore tool will assume it will need to remove what it can to make the empty file system.
We need to do one final step to help with this, but before you proceed, I would recommend cleaning up the CI_Metadata table, but truncating it's content to keep things clean from anything Kentico CI related.
The final and probably the most important step is to remove or rename the Kentico CI configuration file. This is arguably the most important file for Kentico CI, as it not only controls what can and can't be serialised, it is also the go to file when Kentico CI performs a restore. Removing and renaming this file will prevent Kentico CI restore tool from running.
So the steps involved in disabling Kentico CI fully would be:
The restore tool will no longer run without the configuration file and you can be safe from anyone destroying content and objects from an older point.
It is important to note that in Kentico version 12 (which will be released later on in 2018), Kentico CI will no longer delete all objects if there is an empty folder that previously contained the serialised XML files. The restore tool will stop the process and display a message instructing the user of this case. This is a great improvement from Kentico!
Kentico Continuous Integration is an important tool for development teams. However, in some cases after it has been setup and used, it may no longer be appropriate to use. This could be due to the team requirements or environments where Kentico CI is not recommended. This blog post shows you one way of disabling Kentico CI and preventing any data loss if someone accidentally runs the restore tool on your project.