Hallo,
Manchmal, wenn ich Updates über die Web-Oberfläche durchführe, fordert Discourse mich auf, Folgendes auszuführen:
cd /var/discourse
git pull
./launcher rebuild app
Da der rebuild-Prozess mehrmals eine Verbindung zu GitHub herstellt und GitHub in China, wo mein Server gehostet wird, teilweise blockiert ist, muss ich einen HTTP/HTTPS-Proxy einrichten, um besseren Zugriff auf GitHub zu erhalten. Hier ist ein Vergleich beim Aufruf von YouTube ohne und mit 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]
Wenn ich jedoch ./launcher rebuild image ausführe, betritt das Skript die App und führt alle Operationen innerhalb von Docker aus, wo die Netzwerkumgebung sich von der des proxied Hosts unterscheidet. Daher kann ich nicht auf YouTube zugreifen, und der rebuild-Vorgang schlägt meistens fehl.
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.
Meine Frage lautet: Was kann ich tun, um den Proxy des Hosts innerhalb von Docker zu nutzen, insbesondere bei ./launcher rebuild app?