Ciao,
A volte, quando eseguo gli aggiornamenti tramite l’interfaccia web, Discourse mi dice di eseguire
cd /var/discourse
git pull
./launcher rebuild app
Poiché il processo rebuild si connette a GitHub più volte e GitHub è parzialmente bloccato in Cina, dove è ospitato il mio server, devo configurare un proxy HTTP/HTTPS per accedere meglio a GitHub. Ecco un confronto tra la visita a YouTube senza proxy e con proxy:
root@iosre:/var/discourse# wget https://youtube.com
--2021-06-10 23:55:05-- https://youtube.com/
Resolving youtube.com (youtube.com)... 66.220.152.17, 2001::3d6f:fadc
Connecting to youtube.com (youtube.com)|66.220.152.17|:443... ^C
root@iosre:/var/discourse# export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
root@iosre:/var/discourse# wget https://youtube.com
--2021-06-10 23:56:12-- https://youtube.com/
Connecting to 127.0.0.1:7890... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: https://www.youtube.com/ [following]
--2021-06-10 23:56:13-- https://www.youtube.com/
Connecting to 127.0.0.1:7890... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html'
index.html [ <=> ] 510.58K 813KB/s in 0.6s
2021-06-10 23:56:14 (813 KB/s) - 'index.html' saved [522830]
Tuttavia, quando eseguo ./launcher rebuild image, lo script entra nell’app e esegue tutte le operazioni all’interno di Docker, dove l’ambiente di rete è diverso rispetto all’host con il proxy configurato, e non riesco ad accedere a YouTube, quindi il rebuild fallisce la maggior parte delle volte.
root@iosre:/var/discourse# ./launcher enter app
root@iosre-app:/var/www/discourse# wget https://youtube.com
--2021-06-10 15:59:57-- https://youtube.com/
Resolving youtube.com (youtube.com)... 69.171.248.128, 2001::d238:33c1
Connecting to youtube.com (youtube.com)|69.171.248.128|:443... ^C
root@iosre-app:/var/www/discourse# export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
root@iosre-app:/var/www/discourse# wget https://youtube.com
--2021-06-10 16:00:10-- https://youtube.com/
Connecting to 127.0.0.1:7890... failed: Connection refused.
La mia domanda è: cosa posso fare per utilizzare il proxy dell’host all’interno di Docker, in particolare durante l’esecuzione di ./launcher rebuild app?