On Thu, Apr 14, 2016 at 3:54 PM Nicholas McCarthy <
address@hidden> wrote:
Three points to make about this OOT Docker example.
1) Everything you're doing manually here can be accomplished using pybombs2... and pybombs2 makes itself quite amenable to existing within the Docker image both as an interface to what's already installed on the image and a handy way to install new OOTs and dependencies on top of the image. I would favor using pybombs2 as a basis for gnuradio Docker images... at least that's what I'm doing for myself.
The only argument I have against this is that not doing so (i.e., cataloging the dependencies manually in the Dockerfile) sort of obviates the need for pybombs, in this particular case. The dependencies and build procedures are either encoded in the individual Dockerfiles, which are simply part of the OOT project itself, or they're centralized into pybombs recipes. Their usefulness overlaps somewhat.
Where I see a clear win for pybombs in a Docker recipe is when you want to compile and install multiple OOTs in a single Docker image -- it's painful to "stack" targets to create a catchall image (i.e., uhd -> gnuradio -> gr-air-modes -> gr-ais...), and annoying to cut and paste Dockerfile recipes to concatenate them. It's not an issue from a production standpoint since half the reason to use Docker in production is to isolate services from each other, one image per service (if all your services depend on the same base layer, there's little/no image size overhead). But if you're putting together a single catchall image for folks to muck around with, a pybombs base layer seems like a great way to do that and still keep a sane-ish Dockerfile.
2) Supporting a pybombs2 Docker image is a great way to ensure that pybombs2 builds from a very, very minimal initial Linux installation. Since pybombs2 is newish and experiencing lots of activity, the project might benefit from anchoring itself to nightly Docker builds.
3) How to handle OOTs could be a bit more complicated if you try, as I have, to reduce image size using the pybombs2 "deploy" mechanism. Deploy lets you do two nice things... it optionally strips all the src out of your build automatically (a significant weight reduction step, as you note, but installed .h files remain... sort of like a dev package). It also compresses the rest of your build. As long as you install and then compress in the same Docker RUN call, your UFS layer is small, too. The result saves GBs over the wire (I think?). When you're using Docker to deploy code, image sizes over the wire can be a big deal, and I'd love for it to be convenient enough to start each day off by docker pulling the latest build. The "pybombs" image I posted is a vanilla pybombs2 install with uhd forcebuilt and the source stripped (so it's pretty much a complete gnuradio build, gui and all)... it's ~1.5G to download (Again, I think? Sometimes you have hidden image layers that make things appear smaller than they actually are.) That's big in Docker world from what I've seen, but it's not much of an inconvenience. ~2.5G for the version retaining the source code is a little more glaringly bad. Fortunately, unless you're working on code in the uhd or gnuradio repos, the 1.5G version is totally fine.
For me, these are the "natural" GR versions to support via Docker... I'd be interested in a version more like yours that strips the gui and other modules, too. Maybe it's worth cutting uhd in an image, but 200MB doesn't sound worthwhile at that cost.
I'm interested in experiences/opinions regarding the use of pybombs deploy to compress between intermediate UFS layers. Am I somehow overestimating the savings in image size? Does it seem too complicated, and/or am I overlooking an easier way? Maybe no one cares about image size? (Actually, I know some people who definitely do care, or at least they claim to care. I'm pretty sure I will, too.)
I'd be really interested to see what the OTW savings from deploy are! That seems pretty useful, generally speaking. But remember that Docker Registry already implements image compression over the wire for each of the UFS layers it's sending. So I'd be a little concerned that the additional compression step isn't helping actual transfer times, although optionally removing the src will certainly help.
I don't think building the distribution in explicit layers is very helpful. It's something that seems useful when you hear a description of the UFS, but it seems to wind up being a waste of time. One or several GR images makes sense as a basis for images building OOTs, but what the hell are you going to do with an image that's run pybombs install boost except run pybombs install gnuradio?
Only the incremental layers which have changed need to be sent over the wire. This can be pretty painful if you're building Gnuradio monolithically (i.e., in a single RUN command), and means building a distribution in explicit layers has possibly the largest effect on over-the-wire requirements for users who need daily Docker builds.
--n
As far as OOT modules, that's easy. For instance, a Dockerfile for gr-air-modes could look like this (this is untested, don't get any ideas):
FROM bistromath/gnuradio:3.7.8
RUN apt-get install -y python-zmq
WORKDIR /opt/gr-air-modes
COPY . /opt/gr-air-modes
RUN mkdir build \
&& cd build \
&& cmake ../ \
&& make -j4 \
&& make install
...that's more or less the whole thing, although this particular example is broken for a couple of reasons (no Qt in my base layer, other missing prerequisites). It might be nice to include a Dockerfile template in the OOT example. The nice part about doing OOT modules in this manner is that Gnuradio users could potentially never have to compile Gnuradio -- just write their OOT and base its Dockerfile upon a precompiled Gnuradio base layer. Another benefit is bitrot is all but eliminated, as you're basing your module on top of a versioned base layer rather than master.
The Docker image I put up on Docker Hub is small-ish because it only includes these components (and their prerequisites):
-- * python-support
-- * testing-support
-- * volk
-- * gnuradio-runtime
-- * gr-blocks
-- * gnuradio-companion
-- * gr-fft
-- * gr-filter
-- * gr-analog
-- * gr-digital
-- * gr-channels
-- * gr-uhd
-- * gr-utils
-- * gr-wxgui
It could be a lot smaller if I removed the GR build files (292MB), GR source files (88MB), and UHD source/build (200MB). That would cut it down to somewhat more than half its current size. I like having them there because if I'm working inside the environment I can compile changes incrementally. For a pure deployment system, though, they're unnecessary.
It's possible, albeit messy, to build a Gnuradio distribution in layers and tag the individual layers separately. Because each command in a Dockerfile produces an incremental UFS layer, if you can break the compilation of Gnuradio into separate commands for each component in the Dockerfile, then you can tag the various incremental layers to build different composite Gnuradio distributions. It's probably simpler just to provide a "bells-'n-whistles" version and a "bare bones" version.
If you like, I can see just how small I can reasonably get things. I'd argue, though, that a one-time, couple-of-GB download is a reasonable compromise for the convenience of versioned distribution in all but niche applications (embedded or offline come to mind). In other words, the benefit of getting the wire size down probably doesn't outweigh the effort for most people.