aboutsummaryrefslogtreecommitdiff
path: root/virtual/eldiron.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-07 17:30:20 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-07 17:30:20 +0100
commit6bd6d033ec152e0e0aa60ff48771f46d723c2d7e (patch)
treecab1ff3ffc183ad272426004895e43f715b4e5d6 /virtual/eldiron.nix
parent7d8b50d392f3aa588518d81b547ffe8cd9364544 (diff)
downloadNix-6bd6d033ec152e0e0aa60ff48771f46d723c2d7e.tar.gz
Nix-6bd6d033ec152e0e0aa60ff48771f46d723c2d7e.tar.zst
Nix-6bd6d033ec152e0e0aa60ff48771f46d723c2d7e.zip
Add Chloe production and stats
Diffstat (limited to 'virtual/eldiron.nix')
-rw-r--r--virtual/eldiron.nix27
1 files changed, 23 insertions, 4 deletions
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 @@
99 occ 99 occ
100 ]; 100 ];
101 101
102 # FIXME: doesn't work with httpd?
103 security.acme.preliminarySelfsigned = true;
102 security.acme.certs = { 104 security.acme.certs = {
103 # /!\ To create a new certificate, add first the domain to an 105 # FIXME: /!\ To create a new certificate, create it before using
104 # existing certificate, deploy, and then use it in httpd. 106 # it in httpd
105 "eldiron" = { 107 "eldiron" = {
106 webroot = "/var/lib/acme/acme-challenge"; 108 webroot = "/var/lib/acme/acme-challenge";
107 email = "ismael@bouya.org"; 109 email = "ismael@bouya.org";
@@ -159,6 +161,18 @@
159 "www.piedsjaloux.fr" = null; 161 "www.piedsjaloux.fr" = null;
160 }; 162 };
161 }; 163 };
164 "chloe" = {
165 webroot = "/var/lib/acme/acme-challenge";
166 email = "ismael@bouya.org";
167 domain = "osteopathe-cc.fr";
168 plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ];
169 postRun = ''
170 systemctl reload httpd.service
171 '';
172 extraDomains = {
173 "www.osteopathe-cc.fr" = null;
174 };
175 };
162 # "connexionswing" = { 176 # "connexionswing" = {
163 # webroot = "/var/lib/acme/acme-challenge"; 177 # webroot = "/var/lib/acme/acme-challenge";
164 # email = "ismael@bouya.org"; 178 # email = "ismael@bouya.org";
@@ -280,11 +294,13 @@
280 fi 294 fi
281 ''; 295 '';
282 }; 296 };
297 # FIXME: initial sync
283 goaccess = '' 298 goaccess = ''
284 mkdir -p /var/lib/goaccess 299 mkdir -p /var/lib/goaccess
285 mkdir -p /var/lib/goaccess/aten.pro 300 mkdir -p /var/lib/goaccess/aten.pro
286 mkdir -p /var/lib/goaccess/ludivinecassal.com 301 mkdir -p /var/lib/goaccess/ludivinecassal.com
287 mkdir -p /var/lib/goaccess/piedsjaloux.fr 302 mkdir -p /var/lib/goaccess/piedsjaloux.fr
303 mkdir -p /var/lib/goaccess/osteopathe-cc.fr
288 ''; 304 '';
289 }; 305 };
290 306
@@ -474,7 +490,7 @@
474 mypkgs.chloe_dev.apache.vhostConf 490 mypkgs.chloe_dev.apache.vhostConf
475 ]; 491 ];
476 }) 492 })
477 (withConf "eldiron" // { 493 (withConf "chloe" // {
478 hostName = "osteopathe-cc.fr"; 494 hostName = "osteopathe-cc.fr";
479 serverAliases = [ "www.osteopathe-cc.fr" ]; 495 serverAliases = [ "www.osteopathe-cc.fr" ];
480 documentRoot = mypkgs.chloe_prod.webRoot; 496 documentRoot = mypkgs.chloe_prod.webRoot;
@@ -615,11 +631,14 @@
615 services.cron = { 631 services.cron = {
616 enable = true; 632 enable = true;
617 systemCronJobs = let 633 systemCronJobs = let
618 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}"; 634 stats = domain: conf: let
635 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}";
636 in "${d}/bin/stats-${domain}";
619 in [ 637 in [
620 "5 0 * * * root ${stats "aten.pro" ./packages/aten_goaccess.conf}" 638 "5 0 * * * root ${stats "aten.pro" ./packages/aten_goaccess.conf}"
621 "5 0 * * * root ${stats "ludivinecassal.com" ./packages/ludivinecassal_goaccess.conf}" 639 "5 0 * * * root ${stats "ludivinecassal.com" ./packages/ludivinecassal_goaccess.conf}"
622 "5 0 * * * root ${stats "piedsjaloux.fr" ./packages/piedsjaloux_goaccess.conf}" 640 "5 0 * * * root ${stats "piedsjaloux.fr" ./packages/piedsjaloux_goaccess.conf}"
641 "5 0 * * * root ${stats "osteopathe-cc.fr" ./packages/chloe_goaccess.conf}"
623 ]; 642 ];
624 }; 643 };
625 }; 644 };