Skip to content

Commit 50489ae

Browse files
marcos-mendezMarcos
andauthored
fix: nginx falhando no firstboot por corrida com 15regen-sslcert (#11)
O nginx pode subir enquanto o hook comum 15regen-sslcert regenera o par cert/chave e ler um par inconsistente (SSL key values mismatch); como o hook só reinicia serviços ativos, o nginx ficava failed até intervenção manual. Duas camadas: drop-in com Restart=on-failure (auto-recupera sozinho ~10s após a regeneração) e restart incondicional do nginx no fim do inithook do opencloud. Co-authored-by: Marcos <m@pop.coop>
1 parent ad24780 commit 50489ae

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ turnkey-opencloud-18.1 (1) turnkey; urgency=low
1515
* Firstboot inithooks: regenerate build-time secrets (opencloud.yaml),
1616
set admin password and domain (interactive or preseeded).
1717

18+
* Fix nginx failing at firstboot (cert/key mismatch race with the common
19+
15regen-sslcert hook): nginx drop-in with Restart=on-failure and an
20+
unconditional nginx restart at the end of the opencloud inithook.
21+
1822
-- POP Solutions <popsolutions.co@gmail.com> Tue, 21 Jul 2026 20:30:00 +0000
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Firstboot: 15regen-sslcert regenerates the TLS cert/key while nginx may be
2+
# starting; reading a mid-regen mismatched pair fails the unit, and the
3+
# regen hook only restarts services that are still active. Keep retrying so
4+
# nginx comes up on its own once the pair is consistent.
5+
[Unit]
6+
StartLimitIntervalSec=0
7+
8+
[Service]
9+
Restart=on-failure
10+
RestartSec=10

overlay/usr/lib/inithooks/bin/opencloud.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ def set_domain(domain: str) -> None:
101101
# unconditional restart: 20regen-opencloud-secrets stopped the service,
102102
# so try-restart would be a no-op and leave OpenCloud down
103103
subprocess.run(["systemctl", "restart", "opencloud"], check=False)
104+
# nginx can fail at boot if it starts while 15regen-sslcert is mid-way
105+
# through regenerating the cert/key pair (mismatch); the common hook only
106+
# restarts services that are still active, so recover it here
107+
subprocess.run(["systemctl", "restart", "nginx"], check=False)
104108

105109

106110
def main():

0 commit comments

Comments
 (0)