while making an an upgrade (Ubuntu 16.04.06, older installation, not updated for at least 2-3 months)
on CLI via “rebuild app”, i was stuck since several hours,
su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'
was rendering a message, that the ssl was failing while fetching files on rubygems.org.
(nevertheless, it was not always the same file which failed, so i assume there was progress during some attempts)
After several reboots of the VM, disabling IPv6 etc, i reduced the MTU for the system to 1280 (just a shot in the dark): Voila!
So some kind of PMTU-detection failed on me.
(in have no explanation, this is just a mention, perhaps for others who are stuck on a similar issue.)