Thanks very much for your comprehensive reply. I am definitely going to try this, and will provide feedback.

Cheers,
Paul Sture

On 23 Feb 2017, at 1:15, Rob Seastrom wrote:

On Feb 22, 2017, at 2:47 PM, Paul Sture <[email protected]> wrote:

On 22 Feb 2017, at 20:08, Rob Seastrom wrote:

Moreover, if you are goofing around with where you get your packages from by modifying /opt/local/etc/pkgin/repositories.conf as I do (I have an nginx cache running so as to be nice to Joyent and get somewhat faster transfers internally on the Nth time that I'm installing a particular package), you need to do the cache freshening *after* you change the source location.

I could really really use a caching solution for pkgin, and I am sure many others could too.

gcc49-4.9.4.tgz for example is 324MB which on my home broadband takes 12-15 minutes. It's senseless to repeat that unnecessarily.

Are you in a position to share your nginx caching config setup?

Sure.  It's at http://www.seastrom.com/pkgsrc_cache/nginx.conf

There is essentially nothing but nginx installed on the VM that does the cacheing.

A few notes:

1) It's dual stacked IPv4/IPv6, hence the pkgsrc/pkgsrc4/pkgsrc6 hostnames so i can let the libraries decide, or force one protocol or the other. If you don't have IPv6 you will likely want to get rid of the "listen [::]..." directives. You'll definitely want to update the hostnames to something that is in namespace that you control (or spoof locally, or whatever). I'm sure there's a way to make this work with naked IP addresses but it never occurred to me to try. If you decide to go that route, be sure to report back with your config changes.

2) Note that I pass through location '/.well-known/acme-challenge' to the Ansible server; this is because I create the letsencrypt.org x.509 certificates there so that they're persisted across regeneration of the VMs that use them. You can get rid of it or point it at your own Ansible jumphost, but pointing it at mine is not going to be useful. Yes, I plan to write up my letsencrypt/ansible setup sometime... when I finish completely integrating it with Ansible and no longer have embarrassing manual shell scripts in the mix. Until then... :-/

3) File cache is in /pkgsrccache (it's just a single line to declare that, so might go missing if you didn't know exactly what you were looking for). I persist it across quarterly nuke-and-rebuild-on-latest-smartmachine exercises via a loopback mount, which is less-well-known than delegated datasets, so i'm including a blob of json from the spec for the vm here:

   "filesystems": [
    {
      "source": "/zones/pkgsrccache",
      "target": "/pkgsrccache",
      "type": "lofs"
    }
   ],

4) You'll want to change the "allow" stanzas to match your local conditions. allowing the whole internet is a poor choice (might not matter much if you're behind a NAT... my cache is not though). Likewise, you don't want to try using my dns resolvers; that won't work for you.

5) Note that this is also set up as images/images4/images6. You can tweak this in the global zone via imgadm sources -a or -d. This setting seems to persist across reboots but i never got around to figuring out where it gets written. Nice if you have more than one physical device hanging around that runs SmartOS (in our BroColo we are around a dozen, between ours personally and friends-and-family).

enjoy!



-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to