-
Notifications
You must be signed in to change notification settings - Fork 237
FEAT: Disable APT-Cacher by default #249
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
Conversation
f9eaa91
to
4c31f58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall - but I'm seeking feedback from others whether this should be feature gated in case people have a reason to use the system apt-cacher-ng
I think it would be better to have the apt-cacher container run when it is explicitly asked for. I don't think it should be on enabled by default. Additionally, the changes made here are in In general, I don't really like this approach. It is already possible to specify the host running apt-cacher using |
That's fair. I removed apt-cacher and just let the fix for ESM and also to plug with the network host As we are now using docker network host, we dont need to change the MIRROR_DEFAULT in case of Docker |
@achow101 makes a good point. However, it would still be nice to have a Dockerfile / startup script for a |
Or if you don't feel like that should go into this PR, could you change the PR title / description to reflect the new scope? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage not updated, open --disable-apt-cacher
should be added.
21d345b
to
54ccd5a
Compare
Based on this comment, #249 (comment), I change to disable apt-cacher by default |
Hello! So the whole purpose of this fix was to be able to easily launch a GITIAN build either locally or on a CI. Here is my work: https://github.com/micaelmalta/gitian-builder-dogecoin You can have here a DEMO of a working CI: https://cirrus-ci.com/build/4704793919750144 |
Sorry for the delay reviewing. I would prefer not to change the default, since I believe most existing users of Gitian do use apt-cacher. Let's have it continue to be on by default and the flag would be to disable. |
[I don't have important usage/knowledge of the soft, used with dogecoin only.] At first, without thinking about existing users, what would be the best between enable or disable In the scenario In case if |
The main use-case for Gitian has been developers that do regular releases. Also, in the case of CI, I believe that caching should be on (with persistent storage), so as to not abuse the OS repositories. |
I'm a fan of this feature. Whatever the default is (on or off), I'm ok with, so long as it can be turned on/off at will. The ability to turn it off is important for macOS. My modest PR here: #252, which is related, just turns it off unconditionally for the macOS case.... |
Regarding #227 (comment), I suspect a communication issue where everyone was waiting on each other :) I suggested some changes to his code to have apt cacher used by default, see micaelmalta#1. |
@@ -208,7 +219,7 @@ WORKDIR /home/$DISTRO | |||
CMD ["sleep", "infinity"] | |||
EOF | |||
|
|||
docker build --pull -f $OUT.Dockerfile -t $OUT . | |||
docker build --network host --pull -f $OUT.Dockerfile -t $OUT . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, this only works on Linux. if this is desired, it has to be behind a flag or a conditional based on the host OS.
(this also relates to the change above, which points to 127.0.0.1 unconditionally)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to investigate the purpose of this, why he had to specify the host network and the relation with apt-cacher. Try to understand why he had to play with MIRROR_DEFAULT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, if I'm right, it's related to the configuration of apt-cacher when you're using docker.
He's just using adding conditionally the following line in make-base-vm
:
gitian-builder/bin/make-base-vm
Line 201 in 32b1145
RUN echo 'Acquire::http { Proxy "$MIRROR_BASE"; };' > /etc/apt/apt.conf.d/50cacher |
So, I guess if mirrors configurations were working with apt-cacher before, not touching to those configurations when disabling apt-cacher shouldn't be a problem ?
Would keeping MIRROR_DEFAULT
and docker network like it was be a solution ?
@@ -37,6 +37,6 @@ case $VMSW in | |||
echo "Gitian-${2}" > var/target.vmname | |||
;; | |||
DOCKER) | |||
docker run -d --name gitian-target base-$SUFFIX:latest > /dev/null | |||
docker run --network host -d --name gitian-target base-$SUFFIX:latest > /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above regarding this being Linux only
I guess lxc & kvm are using cacher ? In the current state, isn't it used for them even with |
Yes, lxc & kvm were using apt-cacher. Added this commit https://github.com/AbcSxyZ/gitian-builder/commit/f9a993ec2b28dc1a55382542e41c60e5c793b0b9 to disable apt cacher for them to my PR on @micaelmalta's repo. I'm wondering if leaving |
@@ -193,12 +197,19 @@ if [ $DOCKER = "1" ]; then | |||
base_image="$DISTRO:$SUITE" | |||
fi | |||
|
|||
apt_cacher="" | |||
if [ "$APT_CACHER" = 1 ]; then | |||
apt_cacher="RUN echo 'Acquire::http { Proxy "$MIRROR_BASE"; };' > /etc/apt/apt.conf.d/50cacher" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line introduces a syntax error when using apt-cacher.
Within the 50cacher
file of the Dockerfile, will render :
Acquire::http { Proxy http://172.17.0.1:3142; };
instead of
Acquire::http { Proxy "http://172.17.0.1:3142"; };
Need to escape quotes : { Proxy \"$MIRROR_BASE\"; }
.
Fixed in 525e33a
CONTEXT
apt-cacher is not working with all OS (ex: MacOS)
PROPOSAL
Option to enable apt-cacher in a docker container
Use docker network host to access it
OTHER FIX
Ubuntu ESM Infra is not available, delete it from sources_list