Solved Using Jail host as a cache server for pkg and freebsd-update

Hi all! how are you? :)

I have a Jail host which contains about 50 Jails. During day-to-day operations, I need to install packages, a lot of these packages are the same (nginx, vim-console, etc), it would be really good if I can make the Jail host a pkg cache server, where the Jails can use the host's fetched packages.

Also, since I keep all of my Jails up-to-date, what's the best way to keep a local freebsd-update server? Same as above but for freebsd-update :)

Thanks in advance!
 
Couldn't you just mount /var/cache/pkg into all your jails to share the binary packages over all jails?
Othervise just take a look into man pkg-repo, mount this into your jails and use a url with "file://" in your specific pkg.conf.

I use pkg -c "${path_to_jail}" install -y "${package}", then the pkg is executed on the host and the jails does not even need to bootstrap pkg.
 
You can use a common HTTP & FTP proxy. Ideally, on the same jail set up a /usr/local/share/doc/freebsd/en/articles/freebsd-update-server
2nd, naive solution: null-mount /var/cache/pkg into the jails. pkg(8) looks up packages to fetch from there 1st. Dito: /usr/ports/distfiles.
 
Also, since I keep all of my Jails up-to-date, what's the best way to keep a local freebsd-update server? Same as above but for freebsd-update
I would suggest just setting up a caching proxy for this. Setting up an actually update server is a bit of a pain to set up and maintain. A caching proxy will do the trick just fine.
 
For pkg I ended up using nullfs, which I totally forgot about when posting this, thanks for reminding me :) it's been working like a charm.

For freebsd-update, I have not looked into it much yet, but I'll try a caching proxy, if there's any recommended HowTo, please post below for other people as well.

Marking as Solved.

Thank you all :)
 
For pkg I ended up using nullfs, which I totally forgot about when posting this, thanks for reminding me :) it's been working like a charm. For freebsd-update, I have not looked into it much yet, but I'll try a caching proxy, if there's any recommended HowTo, please post below for other people as well.
SirDice posted a configuration snippet for www/nginx here.
 
Yes, I can also post an Apache config if you're interested. It does the exact same thing as the nginx config I posted. They both set up a virtual host to proxy and cache specifically for update.freebsd.org.
 
Back
Top