From 6bd6d033ec152e0e0aa60ff48771f46d723c2d7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 7 Jan 2019 17:30:20 +0100 Subject: [PATCH] Add Chloe production and stats --- virtual/eldiron.nix | 27 ++++++-- virtual/packages/chloe.json | 6 +- virtual/packages/chloe.nix | 4 +- virtual/packages/chloe_goaccess.conf | 99 ++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 virtual/packages/chloe_goaccess.conf 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}" ]; }; }; diff --git a/virtual/packages/chloe.json b/virtual/packages/chloe.json index d9cf651..686d751 100644 --- a/virtual/packages/chloe.json +++ b/virtual/packages/chloe.json @@ -1,5 +1,5 @@ { - "tag": "1a2ef9a-master", + "tag": "96fc4eb-master", "meta": { "name": "chloe", "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe", @@ -7,8 +7,8 @@ }, "git": { "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe", - "rev": "1a2ef9acee91792e8096854919f0a2f005a3f481", - "sha256": "1h10d2bgvpkm7yi7sbshfi3h50fx202jgnfwiarq5wm947f9phrn", + "rev": "96fc4eb0099a29b0f9a58fb4eaec4bf14ac65f0a", + "sha256": "0mf15j6z86j2smm2k360cmm5djhcjbs9949pznwi57kw97vkm1s3", "fetchSubmodules": true } } diff --git a/virtual/packages/chloe.nix b/virtual/packages/chloe.nix index 2ca1d6f..7288558 100644 --- a/virtual/packages/chloe.nix +++ b/virtual/packages/chloe.nix @@ -85,7 +85,9 @@ let Require ldap-group cn=chloe.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu ErrorDocument 401 "" - '' else ""} + '' else '' + Use Stats osteopathe-cc.fr + ''} ''; }; activationScript = { diff --git a/virtual/packages/chloe_goaccess.conf b/virtual/packages/chloe_goaccess.conf new file mode 100644 index 0000000..89cff6d --- /dev/null +++ b/virtual/packages/chloe_goaccess.conf @@ -0,0 +1,99 @@ +time-format %H:%M:%S +date-format %d/%b/%Y + +#sur immae.eu +#log-format %v %h %^[%d:%t %^] "%r" %s %b "%R" "%u" $^ + +log-format VCOMBINED +#= %v:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" + +html-prefs {"theme":"bright","layout":"vertical"} + +exclude-ip 188.165.209.148 +exclude-ip 178.33.252.96 +exclude-ip 2001:41d0:2:9c94::1 +exclude-ip 2001:41d0:2:9c94:: +exclude-ip 176.9.151.89 +exclude-ip 2a01:4f8:160:3445:: +exclude-ip 82.255.56.72 + +no-query-string true + +keep-db-files true +load-from-disk true +db-path /var/lib/goaccess/osteopathe-cc.fr + +ignore-panel REFERRERS +ignore-panel KEYPHRASES + +static-file .css +static-file .js +static-file .jpg +static-file .png +static-file .gif +static-file .ico +static-file .jpeg +static-file .pdf +static-file .csv +static-file .mpeg +static-file .mpg +static-file .swf +static-file .woff +static-file .woff2 +static-file .xls +static-file .xlsx +static-file .doc +static-file .docx +static-file .ppt +static-file .pptx +static-file .txt +static-file .zip +static-file .ogg +static-file .mp3 +static-file .mp4 +static-file .exe +static-file .iso +static-file .gz +static-file .rar +static-file .svg +static-file .bmp +static-file .tar +static-file .tgz +static-file .tiff +static-file .tif +static-file .ttf +static-file .flv +#static-file .less +#static-file .ac3 +#static-file .avi +#static-file .bz2 +#static-file .class +#static-file .cue +#static-file .dae +#static-file .dat +#static-file .dts +#static-file .ejs +#static-file .eot +#static-file .eps +#static-file .img +#static-file .jar +#static-file .map +#static-file .mid +#static-file .midi +#static-file .ogv +#static-file .webm +#static-file .mkv +#static-file .odp +#static-file .ods +#static-file .odt +#static-file .otf +#static-file .pict +#static-file .pls +#static-file .ps +#static-file .qt +#static-file .rm +#static-file .svgz +#static-file .wav +#static-file .webp + + -- 2.41.0