Have an internal repo that's accessible by your deploy servers, which in turn locally caches anything that you might have previously needed to externally fetch.
Have an internal repo that's accessible by your deploy servers, which in turn locally caches anything that you might have previously needed to externally fetch.
bundle package
puts all your app's dependencies in vendor/cache. That can then be put into a git submodule.The problem then becomes the Gemfile and Gemfile.lock, which should really be in that submodule as well. You need to pass flags to bundler commands because it assumes the Gemfile is in the project root.
I think a full solution requires packaging, and using a modified buildpack that skips the bundle step.
Places the gem binaries in vendor/cache, as noted. SCM those.
"While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile."
http://gembundler.com/bundle_install.html
Heroku uses this tree lookup AFAIK.
UPDATE:
For others' edification, the default heroku ruby buildpack respects vendor/cache, but will purge it in the following scenarios:
* if vendor/ruby_version exists
* if vendor/heroku/buildpack_version exists, but vendor/heroku/ruby_version does not
* if the bundler cache exists, but vendor/heroku/ruby_version file specifies a different version of ruby than the one actually being used.To avoid packages sneakily trying to download their own dependencies from the internet we run pip install with a "--proxy http://localhost:9999 argument (where nothing is actually running on that port) so that we'll see an instant failure if something tries to pull a dependency over the network.
The non-existant proxy trick seems useful, I'll have to try that out.
Does anyone know why rubygems does not work this way? I had always just assumed it did (due to the historical intertwining of Ruby and Perl communities).
Personally I'm a big fan of the CPAN approach as it is fairly simply. Just mirror via FTP. It's a nobrainer to setup and run a mirror.
That said, CPAN's master (PAUSE.cpan.org) is a SPOF as well.
What I like is that not a single party is responsible for paying server bills + maintaining the platform. Ruby Central and the team of volunteers do a great job, but in the end, people only care when something breaks.
Instead every big company/university that profits from the Ruby ecosystem should imho run a public rubygems mirror as a contribution to the open source world. That's common practice for other projects, too. Think of all mirrors of the Linux distributions, kernel.org, cpan, python etc.
=> http://slideshare.net/rmoriz/rubygems-behind-the-gems
I also want to mention, that ftp.ruby-lang.org is a single homed box. There is no other official mirror of the MRI/C-Ruby source that can be used as failover or load balancer. This is bad, too.
Here's the docs that describe it:
"While installing gems, Bundler will check vendor/cache and then your system's gems."<and then tries to fetch remotely unless you pass --local>
(I miss the days from when github also hosted a gem repository…)
Solving the authenticity problem alone is probably not fun – tho obviously there is much to be learned from CPAN. Given recent problems there will probably be enough political will to make this happen in the future, though.
If you want to run your own PyPI internally, here's a very simple PyPI server (~150 lines of Python) that I wrote: https://github.com/steiza/simplepypi
What I've personally been looking for is an easy to setup caching proxy for PyPI. Something that is pip-compatible and serves files if it has them but will also fetch and then store packages if it doesn't. That way you could build up a collection of 3rd party packages over time, without having to explicitly manage it.
It probably wouldn't be hard to roll my own with a reverse proxy but it never gets moved to the front burner.
http://djangopypi2.readthedocs.org/en/latest/
For now though we'll probably just create a new git repo with a folder full of source distros (tarballs and zips), as mentioned above.
.NET developers, you can set up a similar cache for NuGet packages to avoid downtime (and reduce bandwidth usage): http://www.hanselman.com/blog/HowToAccessNuGetWhenNuGetorgIs...
> It's something that we in the Python community have already learned due to the historical unreliability of our equivalent package repo, PyPI.
learned sounds a touch condescending to me for some reason. The python community has certainly run into it, but (anecdote time) in my experience people still often rely on pypi for their deploys (but use the --mirrors option to pip).
Encountered may be more appropriate.Thanks for the perspective at any rate. Maybe too much coffee for me this morning? :)