-
-
Notifications
You must be signed in to change notification settings - Fork 348
How does CKAN work
Only one part of the CKAN infrastructure runs on your local PC: the client application that manages your game folders. To do this job, it maintains a registry of metadata, as well as a cache of downloads. The client's code lives in the CKAN repository.
The registry is generated from the CKAN-meta repository, which maintains one metadata file for each version of each mod, explaining how to download and install it. Refreshing the client downloads a compressed archive of this repository. To make a mod available to the client, its metadata must be added to this repository.
The cache is downloaded from the same links that are used when installing mods manually. CKAN does not maintain its own hosting servers.
The CKAN team maintains a group of microservices, known as the bot, that crawls known mods looking for new versions. The bot scans the NetKAN repository to find the mods to check, and it downloads the latest versions to inspect them for changes. Any new data it finds is added to the CKAN-meta repository. The bot's code is in the NetKAN-Infra repository, look there for details on how it works.
Mods hosted on SpaceDock are indexed immediately by a webhook trigger when they're updated; other mods are checked every 30 minutes. SpaceDock mods with version files are included in those passes in case their online version files are changed, and all SpaceDock mods are also checked once per day in case anything goes wrong with the webhooks.
If the bot encounters any errors or warnings while checking a mod, it sends them to CKAN Discord and its status page at http://status.ksp-ckan.space/ (refreshed every 5 minutes). This can be used to identify problems with indexing new mod versions. This page's code is in the NetKAN-status repository.
If a mod's license allows it to be redistributed, then the bot will also upload an unmodified copy of it to the Internet Archive as a fallback in case the main host becomes unavailable.
CKAN-meta can be updated manually, as can NetKAN. This is done via pull requests on GitHub. These can be created by anyone, but merged only by members of the CKAN team.
When a mod is added to SpaceDock, the author can check a checkbox to opt in to CKAN, which auto-generates a pull request in the NetKAN repository. This is then reviewed by the team, often revised, and merged to add the mod to the index.
These pull requests are validated by scripts in the xKAN-meta_testing repository, the validation happens mostly by checks built into netkan.exe.
Contact us on the KSP forum or on our Discord server