Why would you want to operate a Chocolatey proxy and caching server?
Chocolatey.org has strict rate-limiting policies, which means you may start receiving that
dreaded “429 error” in the middle of deploying or upgrading packages.
You can prevent these errors by caching Chocolatey packages in ProGet so that your package
deployment will not be interrupted.
There is a great product that is free to use for this type of need. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.
ProGet is a Self-hosted, Cross-Platform Package & Container Repository that keeps all your
packages in one place, allowing you to scan for vulnerabilities and control who can access
different feeds. It also will provide a proxy and caching agent for the public Chocolatey
repositories.
It takes about 10 minutes of your time to get a fully deployed system going and ready to cache
Chocolatey Packages.
The first thing you want to do is get a Linux box with Docker deployed in the cloud, you can do
it locally if you have the space and bandwidth. I personally like Digital Ocean, it is super quick
and easy to get “droplets” up and running and it is cheap.
In Digital Ocean create a new droplet, give it the bare minimums to start, and you can always resize
it as needed. Select the marketplace and then the Docker-Ubuntu image and then select the basic
shared 1 CPU and the 2 GB VRAM.
Here is the official Docker Guide To Install ProGet
https://docs.inedo.com/docs/installation/linux/docker-guide
Create a Docker Network
First, you’ll need to create a network for the SQL Server and Inedo Product containers to communicate.
docker network create inedo
Create a Docker MSSQL Express Container
Inedo products requires an SQL Server database. You can either host this database externally or simply use an SQL Server Docker image; it doesn’t matter how it’s hosted, as long as your instance can access it.
To start an SQL Server container on the inedo
network you created, use this command:
docker run --name inedo-sql \
-e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=«YourStrong!Passw0rd»' \
-e 'MSSQL_PID=Express' --net=inedo --restart=unless-stopped \
-d mcr.microsoft.com/mssql/server:2019-latest
Once you have an SQL Server instance running, you’ll need to create an empty database.
To create a database called ProGet
on the SQL Server instance running in the inedo-sql container:
Currently the “SQLCMD” is located in /opt/mssql-tools18/bin/sqlcmd. This however can change over time. If you get an error message -> OCI runtime exec failed: exec failed: unable to start container process: exec: "/opt/mssql-tools/bin/sqlcmd": stat /opt/mssql-tools/bin/sqlcmd: no such file or directory
. You should use this command to log into Docker container and verify the folder location of SQLCMD.
docker exec -it inedo-sql /bin/bash
To create the database in the MSSQL docker container, execute the following:
docker exec -it inedo-sql /opt/mssql-tools18/bin/sqlcmd \
-S localhost -U SA -P '«YourStrong!Passw0rd»' \
-Q 'CREATE DATABASE [ProGet] COLLATE SQL_Latin1_General_CP1_CI_AS'
You can create the database however you want, but to avoid issues make sure you specify its collation as SQL_Latin1_General_CP1_CI_AS.
Starting The ProGet Proxy Server
Inedo product’s Docker images contain a web server and a background service. To start your chosen image, use the docker run
command.
docker run -d --name=proget --restart=unless-stopped \
-v proget-packages:/var/proget/packages -p 80:80 --net=inedo \
-e PROGET_SQL_CONNECTION_STRING='Data Source=inedo-sql; Initial Catalog=ProGet; User ID=sa; Password=«YourStrong!Passw0rd»' \
proget.inedo.com/productimages/inedo/proget:latest
Afterwards, you should have a generic ProGet web proxy running and it will need configuration
to secure it and turn it into a proxy and cache server. Open a web browser and go to the external IP address of the new droplet.(http://123.123.123.123)
Acquire a License Key
You’ll need to have a valid license key once you get your Inedo product running. You can request a license key within the software itself, use a license key that you already have, or request one from my.inedo.com. The standard free version requires a KEY, it will acquire the key directly when you register it. There will be some online instructions that you can follow but the big takeaway is first thing to do is secure the web portal. By default, it has permissions set to allow anonymous users the ability to manage the web, add users, and all that good stuff. It allows you to quickly get into the system and start pushing buttons but it’s really poor security so we need to fix that first.