-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to Bazel to build the AGW docker containers #14313
Comments
General commentThe proposal contains several separate and independent actions:
There is no dependancy between this two actions, meaning its still possible to separate the services in dedicated containers without changing the build system. Build the containers with BazelThe problems with this part of the proposal are:
The use of the VM for the build had an effect to locked the project to Restructure the containers to a dedicated services per containerThis is actually sounds like this will bring some value to the end user, however the concern on the size of the container is invalid. Docker, thanks to the overlay system, will have only one physical copy of the image for each of the containers that are spawned, so the net effect of the space used remain almost unchanged (the sum of all files in the multiple images will be equal to the files in the single image). The only real benefit will be the shorter time to build, however, since the containers are not build so often, this benefit alone do not justify the effort. All other objectives can be achieved by the current state of the containers. Moving from the host network to a dedicated networkThis is a good proposal and has potential to bring a value to the end user. I suggest to create this as a new proposal so we can discuss it regardless of the decision on the previous two parts. |
Thank you @jordanvrtanoski for posting your analysis and opinion on the proposed changes. Build the containers with Bazel
End user benefits are not the only valuable things for the project. A reliable, easy, fast and efficient build setup and infrastructure is a major cost saver for the community and can ensure that the project is able to deliver the product. Those aspects have been well elaborated in #8338 and #11293.
If the build system is clearly documented (what we intend), the particular approach might be surprising but hopefully not confusing. In particular, the Bazel models are well structured and easy to work with. Also large parts of the AGW are modeled and built with Bazel anyway, such that a new contributor has to work with Bazel in any case.
Actually one main motivation for this proposal was that developers got frustrated because the build times during development took so long. There is no alternative development environment for Docker, and the only way to get quick feedback times at the moment is to use the systemd build.
I think this might be a misunderstanding. We do not plan to introduce a dependency on either the VM or on amd64. Restructure the containers to a dedicated services per container"Restructure the containers to a dedicated services per container" was not so much a goal of the proposal as it is a side effect. If there is a decision to work on "Build the containers with Bazel" then we automatically get dedicated containers for each service. But I agree that there is likely no overall size benefit if the sum over all containers is considered (although this is not sure as the current containers might have some unnecessary dependencies that will no longer be there). I also agree that this is probably no size improvement for the end-user because of the overlay system. However, having dedicated images per service with only the necessary dependencies and nothing else still seems like a good idea, and cleaner, safer and more resilient than the current setup. Since we have Bazel to manage dependencies, using that to construct the containers and not keeping a separate dependency list within Dockerfiles makes things simpler. Especially, with the larger movement of the community towards a containerized AGW. Moving from the host network to a dedicated networkThe item "Moving from the host network to a dedicated network" is listed as a non-goal in the proposal. I agree it is a valuable goal but this is absolutely not trivial and should be discussed separately. It is not affected by whether or not the containers are built with Bazel. |
This proposal is potentially relevant for the Plan towards a fully community based development mode as it eases the maintenance of the containerized AGW, and thus might make it feasible to maintain both the AGW Ubuntu package and the AGW container images. |
There was a vote on 2022-12-15 and not sufficient TSC members participated. |
Switch to Bazel to build the AGW docker containers
Similar to previous efforts towards a unified Bazel build system in #8338 and #11293, we would like to bring forward a proposal for a next step towards that goal: to switch to Bazel for building the AGW containers.
TLDR
Problem
The current state of the AGW container build is problematic:
Solution
We propose to build the AGW containers using Bazel. This includes the following goals:
Notes:
rules_docker
package has some convenience tools for building images based on Ubuntu.Non-goals
Technical details on Bazel caching and rebuild times
The way Bazel handles its cache (which lives in part outside the dev VM, where the containers are currently built) drastically speeds up the process of rebuilding the containers after code changes or after spinning up a new dev VM.
In our testing, we built several containers with Bazel and ran the s1ap integ tests to ensure their functionality.
Even a first build (i.e. without any Bazel cache) is already faster than with docker-compose, but the build times become significantly shorter with the cache available. This cuts the container build time even after destroying and spinning up a new dev VM from 30 to under 5 minutes.
The build times from our testing are summarized in the table below. Services tested are:
Note that the total build times in the last two columns should not be added up, there are common tools and dependencies which are cached and shared between those builds. In our testing, rebuilding all listed containers after setting up a new dev VM took less than 3 minutes.
The text was updated successfully, but these errors were encountered: