ADD: autobuild hugo blog
This commit is contained in:
parent
1e5e3d1e5f
commit
72c60bd5e0
1 changed files with 22 additions and 27 deletions
|
|
@ -1,27 +1,30 @@
|
||||||
_: {
|
_: {
|
||||||
# -----------------------------------------------------------------
|
environment.systemPackages = with pkgs; [
|
||||||
# 1️⃣ Caddy (reverse‑proxy / serveur web statique)
|
hugo
|
||||||
# -----------------------------------------------------------------
|
];
|
||||||
|
systemd.services.hugo-build = {
|
||||||
|
description = "Auto build du blog hugo";
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
WorkingDirectory = "/srv/blog" ;
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.git}/bin/git pull origin master
|
||||||
|
${pkgs.hugo}/bin/hugo --minify build -d /srv/blog/public
|
||||||
|
'';
|
||||||
|
User = "lomig";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemd.timers.hugo-build = {
|
||||||
|
description = "Timer pour rebuild du blog";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig.OnCalendar = "daily" ;
|
||||||
|
};
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
# Caddy démarre en tant qu’utilisateur « caddy ».
|
|
||||||
# On lui donne accès au répertoire du blog via les ACL créées plus haut.
|
|
||||||
# (Pas besoin de config supplémentaire côté OS.)
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
# 2️⃣ Sites gérés par Caddy (Caddyfile intégré)
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"levr.porzh.me" = {
|
"levr.porzh.me" = {
|
||||||
# Le domaine sera automatiquement provisionné avec TLS via ACME
|
|
||||||
# (Let's Encrypt) grâce à l’option `autoHTTPS = true` (défaut).
|
|
||||||
# Aucun certificat manuel n’est requis.
|
|
||||||
|
|
||||||
# Le répertoire contenant les fichiers générés par Hugo
|
|
||||||
|
|
||||||
# (Optionnel) Rediriger HTTP → HTTPS – Caddy le fait déjà,
|
|
||||||
# mais on le rend explicite pour la clarté.
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
@http {
|
@http {
|
||||||
protocol http
|
protocol http
|
||||||
|
|
@ -37,12 +40,4 @@ _: {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
# 3️⃣ Ouverture du firewall (ports 80 et 443)
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
# networking.firewall.allowedTCPPorts = [
|
|
||||||
# 80 # HTTP (pour la redirection ACME)
|
|
||||||
# 443 # HTTPS (site final)
|
|
||||||
# ];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue