]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move Émilia's website
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 29 Jan 2019 22:42:06 +0000 (23:42 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 29 Jan 2019 22:42:06 +0000 (23:42 +0100)
nixops/modules/websites/default.nix
nixops/modules/websites/emilia/default.nix [new file with mode: 0644]
nixops/modules/websites/emilia/moodle/pause.html [new file with mode: 0644]

index 4a6a26fae37dc2cd739fd59fbfe7fa78083c83fd..7bd1ac5fe89d0ee77dc54c9b825dc50c69288a0e 100644 (file)
@@ -91,6 +91,7 @@ in
     ./piedsjaloux
     ./connexionswing
     ./tellesflorian
+    ./emilia
     ./ftp/jerome.nix
     ./ftp/nassime.nix
     ./ftp/florian.nix
@@ -195,6 +196,7 @@ in
     services.myWebsites.Nassime.production.enable = cfg.production.enable;
     services.myWebsites.Florian.production.enable = cfg.production.enable;
     services.myWebsites.DeniseJerome.production.enable = cfg.production.enable;
+    services.myWebsites.Emilia.production.enable = cfg.production.enable;
 
     services.myWebsites.Chloe.integration.enable = cfg.integration.enable;
     services.myWebsites.Ludivine.integration.enable = cfg.integration.enable;
diff --git a/nixops/modules/websites/emilia/default.nix b/nixops/modules/websites/emilia/default.nix
new file mode 100644 (file)
index 0000000..5783ed0
--- /dev/null
@@ -0,0 +1,73 @@
+{ lib, pkgs, config, myconfig, mylibs, ... }:
+let
+    cfg = config.services.myWebsites.Emilia;
+    env = myconfig.env.websites.emilia;
+    varDir = "/var/lib/moodle";
+    siteDir = ./moodle;
+    # php_admin_value[upload_max_filesize] = 50000000
+    # php_admin_value[post_max_size] = 50000000
+    configFile = ''
+      <?php  // Moodle configuration file
+
+      unset($CFG);
+      global $CFG;
+      $CFG = new stdClass();
+
+      $CFG->dbtype    = 'pgsql';
+      $CFG->dblibrary = 'native';
+      $CFG->dbhost    = '${env.postgresql.host}';
+      $CFG->dbname    = '${env.postgresql.database}';
+      $CFG->dbuser    = '${env.postgresql.user}';
+      $CFG->dbpass    = '${env.postgresql.password}';
+      $CFG->prefix    = 'mdl_';
+      $CFG->dboptions = array (
+        'dbpersist' => 0,
+        'dbport' => '${env.postgreesql.port}',
+        'dbsocket' => '${env.postgresql.password}',
+      );
+
+      $CFG->wwwroot   = 'https://www.saison-photo.org';
+      $CFG->dataroot  = '${varDir}';
+      $CFG->admin     = 'admin';
+
+      $CFG->directorypermissions = 02777;
+
+      require_once(__DIR__ . '/lib/setup.php');
+
+      // There is no php closing tag in this file,
+      // it is intentional because it prevents trailing whitespace problems!
+      '';
+in {
+  options.services.myWebsites.Emilia = {
+    production = {
+      enable = lib.mkEnableOption "enable Emilia's website";
+    };
+  };
+
+  config = lib.mkIf cfg.production.enable {
+    security.acme.certs."emilia" = config.services.myCertificates.certConfig // {
+      domain = "saison-photo.org";
+      extraDomains = {
+        "www.saison-photo.org" = null;
+      };
+    };
+
+    system.activationScripts.emilia = ''
+      install -m 0755 -o wwwrun -g wwwrun -d ${varDir}
+      '';
+    services.myWebsites.production.vhostConfs.emilia = {
+      certName    = "emilia";
+      hosts       = [ "saison-photo.org" "www.saison-photo.org" ];
+      root        = siteDir;
+      extraConfig = [
+        ''
+        <Directory ${siteDir}>
+          DirectoryIndex pause.html
+          Options Indexes FollowSymLinks MultiViews Includes
+          Require all granted
+        </Directory>
+          ''
+      ];
+    };
+  };
+}
diff --git a/nixops/modules/websites/emilia/moodle/pause.html b/nixops/modules/websites/emilia/moodle/pause.html
new file mode 100644 (file)
index 0000000..8b99c59
--- /dev/null
@@ -0,0 +1,48 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Pause</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <style>
+      body {
+        padding-left: 5px;
+        padding-right: 5px;
+        text-align: center;
+        margin: auto;
+        font: 20px Helvetica, sans-serif;
+        color: #333;
+      }
+      h1 {
+        margin: 0px;
+        font-size: 40px;
+      }
+      article {
+        display: block;
+        max-width: 650px;
+        margin: 0 auto;
+        padding-top: 30px;
+      }
+      article + article {
+        border-top: 1px solid lightgrey;
+      }
+      article div {
+        text-align: justify;
+      }
+      a {
+        color: #dc8100;
+        text-decoration: none;
+      }
+      a:hover {
+        color: #333;
+      }
+    </style>
+  </head>
+  <body>
+    <article>
+      <h1>Site web en pause&nbsp;!</h1>
+      <div>
+        <p>Le site et les cours de photographie sont actuellement en pause.</p>
+      </div>
+    </article>
+  </body>
+</html>