From 6bd6d033ec152e0e0aa60ff48771f46d723c2d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 7 Jan 2019 17:30:20 +0100 Subject: Add Chloe production and stats --- virtual/eldiron.nix | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'virtual/eldiron.nix') diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix index 3f2ba27..2e1e68d 100644 --- a/virtual/eldiron.nix +++ b/virtual/eldiron.nix @@ -99,9 +99,11 @@ occ ]; + # FIXME: doesn't work with httpd? + security.acme.preliminarySelfsigned = true; security.acme.certs = { - # /!\ To create a new certificate, add first the domain to an - # existing certificate, deploy, and then use it in httpd. + # FIXME: /!\ To create a new certificate, create it before using + # it in httpd "eldiron" = { webroot = "/var/lib/acme/acme-challenge"; email = "ismael@bouya.org"; @@ -159,6 +161,18 @@ "www.piedsjaloux.fr" = null; }; }; + "chloe" = { + webroot = "/var/lib/acme/acme-challenge"; + email = "ismael@bouya.org"; + domain = "osteopathe-cc.fr"; + plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ]; + postRun = '' + systemctl reload httpd.service + ''; + extraDomains = { + "www.osteopathe-cc.fr" = null; + }; + }; # "connexionswing" = { # webroot = "/var/lib/acme/acme-challenge"; # email = "ismael@bouya.org"; @@ -280,11 +294,13 @@ fi ''; }; + # FIXME: initial sync goaccess = '' mkdir -p /var/lib/goaccess mkdir -p /var/lib/goaccess/aten.pro mkdir -p /var/lib/goaccess/ludivinecassal.com mkdir -p /var/lib/goaccess/piedsjaloux.fr + mkdir -p /var/lib/goaccess/osteopathe-cc.fr ''; }; @@ -474,7 +490,7 @@ mypkgs.chloe_dev.apache.vhostConf ]; }) - (withConf "eldiron" // { + (withConf "chloe" // { hostName = "osteopathe-cc.fr"; serverAliases = [ "www.osteopathe-cc.fr" ]; documentRoot = mypkgs.chloe_prod.webRoot; @@ -615,11 +631,14 @@ services.cron = { enable = true; systemCronJobs = let - stats = domain: conf: "${pkgs.gnused}/bin/sed -n '/\\['$(LC_ALL=C ${pkgs.coreutils}/bin/date -d yesterday +'%d\\/%b\\/%Y')'/ p' /var/log/httpd/access_log-${domain} | ${pkgs.goaccess}/bin/goaccess -o /var/lib/goaccess/${domain}/index.html -p ${conf}"; + stats = domain: conf: let + d = pkgs.writeScriptBin "stats-${domain}" "${pkgs.gnused}/bin/sed -n '/\\['$(LC_ALL=C ${pkgs.coreutils}/bin/date -d yesterday +'%d\\/%b\\/%Y')'/ p' /var/log/httpd/access_log-${domain} | ${pkgs.goaccess}/bin/goaccess -o /var/lib/goaccess/${domain}/index.html -p ${conf}"; + in "${d}/bin/stats-${domain}"; in [ "5 0 * * * root ${stats "aten.pro" ./packages/aten_goaccess.conf}" "5 0 * * * root ${stats "ludivinecassal.com" ./packages/ludivinecassal_goaccess.conf}" "5 0 * * * root ${stats "piedsjaloux.fr" ./packages/piedsjaloux_goaccess.conf}" + "5 0 * * * root ${stats "osteopathe-cc.fr" ./packages/chloe_goaccess.conf}" ]; }; }; -- cgit v1.2.3