- Notifications
You must be signed in to change notification settings - Fork4
Infra for the CocoaPods CDN
CocoaPods/cdn.cocoapods.org
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Following the increasing cost and several outages on the Netlify service, it was decided to look for simpler alternatives.
The new build process uses GH Actions to create the static indices and runs roughly every 7 minutes. The result is deployed into a GitHub Pages environment.
Our CDN works by taking theCocoaPods Specs repo and creating static files which tells the CocoaPods CLI what pods and versions exist currently.
The CocoaPods CLI will use the information from files like:
!ProtoCompiler!ProtoCompiler-gRPCPlugin+verify-000110Clock12030112101229Sdk12306DeveCocoa180305Pod19WhereSVProgressHUD1BAIDUSDKSYDemo1PasswordExtension1PasswordExtensionHaha20170610test20180408Test...
There are a set of knownprefixes for all Podspec paths, you take the name of the pod, create a SHA (using md5) of it and take the first three characters.
E,g, for the Podspec name:AppNetworkManager
->222d4d61b20ded1118cedbb42c07ce5f
. So, it lives at2/2/2
.
the CocoaPods CLI can get a list of versions for all pods which live at2/2/2
from these know indices:
AppNetworkManager/1.0.0/1.0.1/1.0.2/1.0.4/1.0.5/1.0.6/1.0.7BIZGrid4plus1CollectionViewLayout/1.0.0ContactsWrapper/0.0.1/0.0.2/0.0.3/0.9/1.0/1.0.1/1.0.2DfPodTest/0.0.1/0.0.2GoogleConversionTracking/1.2.0/2.1.0/3.0.0/3.1.1/3.2.0/3.3.0/3.3.1/3.4.0HZTabbar/0.0.1/0.0.2/0.0.3/0.0.4IAPHelperLV/0.1.0/0.1.1/0.1.2IDLib/0.2.0/0.3.0...
Which means to get a podspec JSON, to ensure the CLI can resolve all your dependencies, then the CLI will make HTTP requests like these:
https://cdn.cocoapods.org/Specs/2/2/2/AppNetworkManager/1.0.0/AppNetworkManager.podspec.json
https://cdn.cocoapods.org/Specs/2/2/2/ContactsWrapper/0.9/ContactsWrapper.podspec.json
https://cdn.cocoapods.org/Specs/2/2/2/IDLib/0.2.0/IDLib.podspec.json
Repeat this process for all the dependencies of your dependencies, and that is enough to be able to download just the Podspecs specs needed for your whole dependency tree. Meaning you don't need to do the full clone of the Specs repo.
This repo is responsible for generatingall_pods.txt
and the sharded indices. That happens inScripts/create_pods_and_versions_index.rb
.
These files get pushed to theGitHub Pages branch of this repo.
We then use CloudFlare CDN to redirect incoming URLs either to this repo's GitHub Pages static site, or to ajsDelivr backed copy of the CocoaPods Specs repo based on this re-direct rule:
cdn.cocoapods.org/Specs/* ->https://cdn.jsdelivr.net/cocoa/Specs/$1
This repo does not contain any redirect code as it's not possible to do so in GitHub Pages.
About
Infra for the CocoaPods CDN
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.