Mirror Chocolatey with Artifactory
Asked Answered
M

1

7

JFrog Artifactory supports NuGet sources. How would you configure Chocolatey to point to an Artifactory server instead of chocolatey.org?

Michal answered 21/3, 2018 at 17:44 Comment(0)
M
14

Create a 'remote' repository that points to Chocolatey's NuGet API:

Enter image description here

Then in Chocolatey, configure an alternative source:

choco source list
choco source Add -Name artifactory -Source https://artifactory.example.com/artifactory/api/nuget/chocolatey
choco source enable --name artifactory
choco source disable --name chocolatey

You can leave both sources enabled and Chocolatey will fall back to secondary sources, or you can force all package downloads to come from Artifactory.

Most Chocolatey packages don't bundle the .msi installer inside them; instead the Chocolatey package contains scripts to fetch installers from elsewhere. This solution will only mitigate issues if chocolatey.org becomes unavailable (e.g choco install splunk-universalforwarder will continue to work even if 'chocolatey.org' is offline, but not if 'splunk.com/downloads' is offline).

Michal answered 21/3, 2018 at 17:44 Comment(4)
Keep in mind that this will only mirror the Chocolatey packages. Typically, a Chocolatey Package contains a download URL for an installer, which is downloaded from the internet at installation time. In other words, if your purpose for mirroring packages into artifactory is to allow an offline scenario, this is not going to be enough. For that, you would need to look at internalizing the packages first, and then pushing to artifactory.Rumsey
From what I understand, the intention is to reduce hits to the community repo by caching locally.Chattanooga
Do you have to upload packages directly to this in order to pull them down? Or will it check your repo, if it's not there, pull it from Chocolatey and put it in its repo, then download from your artifactory? i've done what you've shown here, but when i reference artifactory it fails to find the app (obviously cos it's not installed). i thought it would do the latter..?Inference
@Inference it should pull the budget packages automatically. The very first time it caches the budget package chocolaty will sometimes timeout. It always works the second timeMichal

© 2022 - 2024 — McMap. All rights reserved.