passage à squid, de la VM aux dockers
This commit is contained in:
parent
75a4b60f57
commit
f9b16207d8
@ -18,7 +18,7 @@ DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
|
||||
# KAZ specific things
|
||||
#installation de docker, docker-compose et on y fourre le user debian dans le groupe idoine
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose docker-clean git apg curl sudo unzip rsync btrfs-progs ldap-utils # fuse-overlayfs
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose docker-clean git apg curl sudo unzip rsync btrfs-progs ldap-utils # fuse-overlayfs
|
||||
usermod -G docker debian
|
||||
# activation dans alias dans /root/.bashrc
|
||||
sed -i \
|
||||
@ -80,6 +80,27 @@ fi
|
||||
echo -e '#!/bin/sh\n/kaz/bin/container.sh start' >> /etc/rc.local
|
||||
chmod +x /etc/rc.local
|
||||
|
||||
# On sauve le proxy APT
|
||||
proxy=$(/sbin/ip route | awk '/default/ { print $3 }' | head -1)
|
||||
sed -i -e "s/^proxy.*$/proxy=$proxy/" /usr/local/sbin/detect_proxy.sh
|
||||
#echo "export http_proxy=\"http://$proxy:3142\"" > /etc/profile.d/proxy.sh
|
||||
#echo "export https_proxy=\"http://$proxy:3142\"" >> /etc/profile.d/proxy.sh
|
||||
mkdir /root/.docker
|
||||
echo "{
|
||||
\"proxies\":
|
||||
{
|
||||
\"default\":
|
||||
{
|
||||
\"httpProxy\": \"http://$proxy:3142\",
|
||||
\"httpsProxy\": \"http://$proxy:3142\",
|
||||
\"noProxy\": \"*.sns,127.0.0.0/8\"
|
||||
}
|
||||
}
|
||||
}" > /root/.docker/config.json
|
||||
echo "http_proxy=\"http://$proxy:3142\"
|
||||
https_proxy=\"http://$proxy:3142\"
|
||||
" >> /etc/default/docker
|
||||
|
||||
# clear apt cache
|
||||
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get clean
|
||||
|
@ -25,10 +25,16 @@ export DebugLog="${VAGRANT_SRC_DIR}/log/log-vagrant-$(date +%y-%m-%d-%T)-"
|
||||
apt-get --allow-releaseinfo-change update
|
||||
|
||||
# Cache APT
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-cacher # apt-cacher-ng does not work well on bullseye
|
||||
echo "allowed_hosts = *" >> /etc/apt-cacher/apt-cacher.conf
|
||||
service apt-cacher restart
|
||||
#DEBIAN_FRONTEND=noninteractive apt-get install -y apt-cacher # apt-cacher-ng does not work well on bullseye
|
||||
#echo "allowed_hosts = *" >> /etc/apt-cacher/apt-cacher.conf
|
||||
#service apt-cacher restart
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y squid
|
||||
sed -i -e "s/#http_access allow localnet/http_access allow localnet/" /etc/squid/squid.conf
|
||||
echo "cache_dir aufs /var/spool/squid 5000 14 256
|
||||
http_port 3142" >> /etc/squid/squid.conf
|
||||
service squid restart
|
||||
echo "Acquire::http::Proxy \"http://127.0.0.1:3142\";" > /etc/apt/apt.conf.d/01proxy; # utilisation de apt-cacher-ng
|
||||
# Ajouter http://www.squid-cache.org/Doc/config/cache_peer/ à squid pour un proxy upstream
|
||||
|
||||
# MAJ et Install
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
|
||||
|
Loading…
Reference in New Issue
Block a user