Yesterday I did some changes in dc09.ru infrastructure that caused a long downtime, resolved at 18:51 UTC+3.
Before, there were two VPS each with an IPv4 address (it's expensive) and each with nginx reverse proxy sharing the same TLS certificates from Let's Encrypt by copying certs from 1st server to the 2nd by SSH (it's potentially unsafe and was not tested at all).
Now, nginx with TLS is only on the 1st VPS. As for web services on the 2nd, their TCP ports are forwarded to 1st by OpenSSH thanks to its amazing feature (client is started with `-L` flag from 1st VPS, connects to sshd on 2nd).
IPv4 for the second server can be removed, this will save me 150 RUB per month (it's 3 loafs of bread; or $1.57, but doesn't make sense with the current currency rate), because SSH connection is done over IPv6.
And what caused a downtime? It was Timeweb's buggy control panel and my incompetence in networking, more precisely in properly setting up IPv6 on Alpine. Everything was working only after I had installed dhcpcd instead of trying to configure network manually.
#постмортем
Вчера делал некоторые изменения в инфре dc09.ru, из-за чего долгое время сервер был недоступен, до 18:51 по МСК.
Раньше было 2 впски, каждая с IPv4-адресом (что дорого) и каждая с реверс-прокси nginx, с одинаковыми TLS-сертификатами от Let's Encrypt, которые передавались с первого сервера на второй по ссш (что потенциально небезопасно и вообще не тестировалось).
Теперь nginx с TLS-сертами стоит только на первом VPS. TCP-порты сервисов со второго VPS пробрасываются на первый через OpenSSH благодаря его крутой фиче (на первом запускается клиент с флагом `-L`, подключается к sshd на втором).
IPv4 у второй впски теперь можно убрать, сэкономлю 150 рублей в месяц, ибо SSH-подключение у меня по IPv6.
Причина даунтайма: баганая панель управления у Timeweb и моя некомпетентность в сетях, точнее в правильной настройке IPv6 на Alpine. Заработало только когда я наконец поставил dhcpcd вместо попыток настроить сеть вручную.