Python: Let’s Encrypt, pip и AWS China – pypi.python.org: Read timed out

Автор: | 02/09/2017
 

PythonВо время обновления сертификатов Let’s Encrypt на EC2 сервере в AWS China – ошибка:

# /opt/letsencrypt/letsencrypt-auto renew
Creating virtual environment...
Installing Python packages...
Had a problem while installing Python packages.

pip prints the following errors:

=====================================================

...
Collecting zope.component==4.2.2 (from -r /tmp/tmp.bo1byNn414/letsencrypt-auto-requirements.txt (line 165))
  Downloading zope.component-4.2.2.tar.gz (546kB)
Exception:
Traceback (most recent call last):
...
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

Решение – использовать китайское зеркало от Aliyun.

Создаём каталог для конфига pip:

[simterm]

# mkdir /root/.pip

[/simterm]

Создаём файл /root/.pip/pip.conf:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

Запускаем повторно:

[simterm]

# /opt/letsencrypt/letsencrypt-auto --verbose renew
...
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/build.domain.cn/fullchain.pem (success)
no renewal failures

[/simterm]

Готово.