]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add assets website for immae
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 16 Jul 2020 01:02:07 +0000 (03:02 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 16 Jul 2020 23:03:17 +0000 (01:03 +0200)
14 files changed:
modules/private/default.nix
modules/private/environment.nix
modules/private/monitoring/plugins/notify_by_slack
modules/private/websites/default.nix
modules/private/websites/papa/maison_bbc_static/index.html
modules/private/websites/tools/assets/default.nix [new file with mode: 0644]
modules/private/websites/tools/assets/static/logger.png [new file with mode: 0644]
modules/private/websites/tools/assets/static/logo.jpg [new file with mode: 0644]
modules/private/websites/tools/assets/static/logo_big.jpg [new file with mode: 0644]
modules/private/websites/tools/assets/static/monitoring.png [new file with mode: 0644]
modules/private/websites/tools/assets/static/photos/ct.jpg [new file with mode: 0644]
modules/private/websites/tools/assets/static/photos/raton.jpg [new file with mode: 0644]
modules/private/websites/tools/tools/dmarc_reports/index.html
modules/private/websites/tools/tools/landing/ldap_password.php

index cf9dc85e23a53efc778316edacbe30a5ff0a771b..2c8ae6c96b621d1889664e0bd8668546a4ad30cf 100644 (file)
@@ -72,6 +72,7 @@ set = {
   teliotortayProd = ./websites/telio_tortay/production.nix;
 
   # Tools
+  assetsTools = ./websites/tools/assets;
   cloudTool = ./websites/tools/cloud;
   commentoTool = ./websites/tools/commento;
   davTool = ./websites/tools/dav;
index 069a344bc04096de285d2ba6f016b51f0e4e2f39..193e95cf81d8cd64b9e0731af9755b617b033e74 100644 (file)
@@ -856,6 +856,16 @@ in
       type = submodule {
         options = {
           contact = mkOption { type = str; description = "Contact e-mail address"; };
+          assets = mkOption {
+            default = {};
+            type = attrsOf (submodule {
+              options = {
+                url = mkOption { type = str; description = "URL to fetch"; };
+                sha256 = mkOption { type = str; description = "Hash of the url"; };
+              };
+            });
+            description = "Assets to provide on assets.immae.eu";
+          };
           davical = mkOption {
             description = "Davical configuration";
             type = submodule {
index b59a40399b0281724592dc3d7db1284ff09be8b3..1b16a0d2d8040a90eb315528164b5d712ec7ef95 100755 (executable)
@@ -3,7 +3,7 @@
 SLACK_CHANNEL="$1"
 SLACK_USERNAME="Naemon"
 SLACK_URL="$2"
-SLACK_USERICON="https://release.immae.eu/monitoring.png"
+SLACK_USERICON="https://assets.immae.eu/monitoring.png"
 
 if [ "$SERVICESTATE" = "CRITICAL" ]; then
   ICON=":exclamation:"
index c366fd29bbb1c9adb4cb159339440a0fe956e5d3..94506c9261065e1c18e15b27abadb7a2435f2b35 100644 (file)
@@ -293,6 +293,7 @@ in
 
       telio_tortay.production.enable = true;
 
+      tools.assets.enable = true;
       tools.cloud.enable = true;
       tools.commento.enable = true;
       tools.dav.enable = true;
index 246a53b6a498e9fbf701e817c2a69d3ffd384d72..78c318cd8a8a50aabf47b9a7b1532711248a798e 100644 (file)
@@ -3,10 +3,10 @@
   <head>
     <title>Pause</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
-    <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.bundle.min.js" integrity="sha256-TQq84xX6vkwR0Qs1qH5ADkP+MvH0W+9E7TdHJsoIQiM=" crossorigin="anonymous"></script>
-    <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8"></script>
-    <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom@0.7.7"></script>
+    <script src="https://assets.immae.eu/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
+    <script src="https://assets.immae.eu/chart.js/2.9.3/Chart.bundle.min.js" integrity="sha256-TQq84xX6vkwR0Qs1qH5ADkP+MvH0W+9E7TdHJsoIQiM=" crossorigin="anonymous"></script>
+    <script src="https://assets.immae.eu/hammerjs/2.0.8/hammer.min.js" integrity="sha256-eVNjHw5UeU0jUqPPpZHAkU1z4U+QFBBY488WvueTm88=" crossorigin="anonymous"></script>
+    <script src="https://assets.immae.eu/chartjs-plugin-zoom/0.7.7/chartjs-plugin-zoom.min.js" integrity="sha256-6S7w9Wue7EBvlJh/Li/cPecjTNN+yBm/AoCePQA9Xi8=" crossorigin="anonymous"></script>
     <style>
       body {
         padding-left: 5px;
diff --git a/modules/private/websites/tools/assets/default.nix b/modules/private/websites/tools/assets/default.nix
new file mode 100644 (file)
index 0000000..0eb476d
--- /dev/null
@@ -0,0 +1,39 @@
+{ lib, pkgs, config, ... }:
+let
+  cfg = config.myServices.websites.tools.assets;
+  assets_urls = lib.mapAttrs (k: v: pkgs.fetchurl v) config.myEnv.tools.assets;
+  assets = pkgs.runCommand "assets" {} (''
+    mkdir -p $out
+    cp -a ${./static}/* $out/
+  '' + builtins.concatStringsSep "\n"
+    (lib.mapAttrsToList (k: v: ''
+      install -D -m644 -T ${v} $out/${k}
+    '') assets_urls));
+in
+{
+  options.myServices.websites.tools.assets = {
+    enable = lib.mkEnableOption "Enable assets website";
+  };
+  config = lib.mkIf cfg.enable {
+    services.websites.env.tools.vhostConfs.assets = {
+      certName = "eldiron";
+      addToCerts = true;
+      hosts = [ "assets.immae.eu" ];
+      root = assets;
+      extraConfig = [
+        ''
+          Use Apaxy "${assets}" "title"
+          <Directory "${assets}">
+            Options Indexes FollowSymlinks
+            AllowOverride None
+            Require all granted
+            Header always set Last-Modified "Tue, 01 Jan 2020 00:00:00 GMT"
+            Header always set Cache-Control "public, max-age=31536000, immutable"
+            Header always set Access-Control-Allow-Origin "*"
+            Header always set Access-Control-Expose-Headers "*"
+          </Directory>
+        ''
+      ];
+    };
+  };
+}
diff --git a/modules/private/websites/tools/assets/static/logger.png b/modules/private/websites/tools/assets/static/logger.png
new file mode 100644 (file)
index 0000000..8e5a2cb
Binary files /dev/null and b/modules/private/websites/tools/assets/static/logger.png differ
diff --git a/modules/private/websites/tools/assets/static/logo.jpg b/modules/private/websites/tools/assets/static/logo.jpg
new file mode 100644 (file)
index 0000000..d642f7d
Binary files /dev/null and b/modules/private/websites/tools/assets/static/logo.jpg differ
diff --git a/modules/private/websites/tools/assets/static/logo_big.jpg b/modules/private/websites/tools/assets/static/logo_big.jpg
new file mode 100644 (file)
index 0000000..d13a79b
Binary files /dev/null and b/modules/private/websites/tools/assets/static/logo_big.jpg differ
diff --git a/modules/private/websites/tools/assets/static/monitoring.png b/modules/private/websites/tools/assets/static/monitoring.png
new file mode 100644 (file)
index 0000000..3065643
Binary files /dev/null and b/modules/private/websites/tools/assets/static/monitoring.png differ
diff --git a/modules/private/websites/tools/assets/static/photos/ct.jpg b/modules/private/websites/tools/assets/static/photos/ct.jpg
new file mode 100644 (file)
index 0000000..ab7876b
Binary files /dev/null and b/modules/private/websites/tools/assets/static/photos/ct.jpg differ
diff --git a/modules/private/websites/tools/assets/static/photos/raton.jpg b/modules/private/websites/tools/assets/static/photos/raton.jpg
new file mode 100644 (file)
index 0000000..a859e1c
Binary files /dev/null and b/modules/private/websites/tools/assets/static/photos/raton.jpg differ
index af29cdf6c61861dd55b85361cc8ea521034a6733..0afc82f3967e11d211e8837d7cec00db59077410 100644 (file)
     </table>
   </div>
 
-  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
+  <script src="https://assets.immae.eu/vue/2.6.11/vue.min.js" integrity="sha256-ngFW3UnAN0Tnm76mDuu7uUtYEcG3G5H1+zioJw3t+68=" crossorigin="anonymous"></script>
   <script src="app.js"></script>
 </body>
 
index 8b1f80f35b85bf88ff1021f6d99f3a98e92354cf..b6079e5449840098cceedc77e55f9732c606175c 100644 (file)
@@ -86,7 +86,7 @@ Immae / Ismaël", "From: " . getenv("CONTACT_EMAIL"));
 <head>
 <title>Password Change Page</title>
 <meta name="viewport" content="width=device-width, initial-scale=1" />
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" integrity="sha256-2YQRJMXD7pIAPHiXr0s+vlRWA7GYJEK0ARns7k2sbHY=" crossorigin="anonymous" />
+<link rel="stylesheet" href="https://assets.immae.eu/skeleton/2.0.4/skeleton.min.css" integrity="sha256-2YQRJMXD7pIAPHiXr0s+vlRWA7GYJEK0ARns7k2sbHY=" crossorigin="anonymous" />
 <style type="text/css">
   body { font-family: Verdana,Arial,Courier New; margin: auto; }