aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-02-16 14:50:08 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-02-16 14:50:08 +0100
commit7da3ceece7fe6c49046e97f37fc353db9b8a981c (patch)
tree623849d979508b007b1b6e4e42976b64e30b2cf1 /nixops
parente5073addbe397afd596613af469f3308a07c1801 (diff)
downloadNix-7da3ceece7fe6c49046e97f37fc353db9b8a981c.tar.gz
Nix-7da3ceece7fe6c49046e97f37fc353db9b8a981c.tar.zst
Nix-7da3ceece7fe6c49046e97f37fc353db9b8a981c.zip
Move production websites to use stable web directories
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/aten/aten.nix2
-rw-r--r--nixops/modules/websites/aten/default.nix2
-rw-r--r--nixops/modules/websites/capitaines/default.nix10
-rw-r--r--nixops/modules/websites/chloe/chloe.nix6
-rw-r--r--nixops/modules/websites/chloe/default.nix2
-rw-r--r--nixops/modules/websites/commons/adminer.nix8
-rw-r--r--nixops/modules/websites/connexionswing/connexionswing.nix2
-rw-r--r--nixops/modules/websites/connexionswing/default.nix2
-rw-r--r--nixops/modules/websites/default.nix27
-rw-r--r--nixops/modules/websites/emilia/default.nix10
-rw-r--r--nixops/modules/websites/ftp/temp.nix2
-rw-r--r--nixops/modules/websites/ludivine/default.nix2
-rw-r--r--nixops/modules/websites/ludivine/ludivinecassal.nix2
-rw-r--r--nixops/modules/websites/piedsjaloux/default.nix2
-rw-r--r--nixops/modules/websites/piedsjaloux/piedsjaloux.nix2
15 files changed, 53 insertions, 28 deletions
diff --git a/nixops/modules/websites/aten/aten.nix b/nixops/modules/websites/aten/aten.nix
index f986ec1..e27688d 100644
--- a/nixops/modules/websites/aten/aten.nix
+++ b/nixops/modules/websites/aten/aten.nix
@@ -66,7 +66,7 @@ let
66 </Location> 66 </Location>
67 ''} 67 ''}
68 68
69 <Directory ${if environment == "dev" then root else webRoot}> 69 <Directory ${root}>
70 Options Indexes FollowSymLinks MultiViews Includes 70 Options Indexes FollowSymLinks MultiViews Includes
71 AllowOverride All 71 AllowOverride All
72 Require all granted 72 Require all granted
diff --git a/nixops/modules/websites/aten/default.nix b/nixops/modules/websites/aten/default.nix
index f586ed5..41c22ce 100644
--- a/nixops/modules/websites/aten/default.nix
+++ b/nixops/modules/websites/aten/default.nix
@@ -51,7 +51,7 @@ in {
51 services.myWebsites.production.vhostConfs.aten = { 51 services.myWebsites.production.vhostConfs.aten = {
52 certName = "aten"; 52 certName = "aten";
53 hosts = [ "aten.pro" "www.aten.pro" ]; 53 hosts = [ "aten.pro" "www.aten.pro" ];
54 root = aten_prod.webRoot; 54 root = aten_prod.apache.root;
55 extraConfig = [ aten_prod.apache.vhostConf ]; 55 extraConfig = [ aten_prod.apache.vhostConf ];
56 }; 56 };
57 }) 57 })
diff --git a/nixops/modules/websites/capitaines/default.nix b/nixops/modules/websites/capitaines/default.nix
index 7f8f4c6..8073955 100644
--- a/nixops/modules/websites/capitaines/default.nix
+++ b/nixops/modules/websites/capitaines/default.nix
@@ -2,6 +2,8 @@
2let 2let
3 cfg = config.services.myWebsites.Capitaines; 3 cfg = config.services.myWebsites.Capitaines;
4 env = myconfig.env.websites.capitaines; 4 env = myconfig.env.websites.capitaines;
5 webappName = "capitaines_mastodon";
6 root = "/run/current-system/webapps/${webappName}";
5 siteDir = ./mastodon_static; 7 siteDir = ./mastodon_static;
6in { 8in {
7 options.services.myWebsites.Capitaines = { 9 options.services.myWebsites.Capitaines = {
@@ -14,15 +16,19 @@ in {
14 security.acme.certs."capitaines_mastodon" = config.services.myCertificates.certConfig // { 16 security.acme.certs."capitaines_mastodon" = config.services.myCertificates.certConfig // {
15 domain = "mastodon.capitaines.fr"; 17 domain = "mastodon.capitaines.fr";
16 }; 18 };
19 system.extraSystemBuilderCmds = ''
20 mkdir -p $out/webapps
21 ln -s ${siteDir} $out/webapps/${webappName}
22 '';
17 23
18 services.myWebsites.production.vhostConfs.capitaines = { 24 services.myWebsites.production.vhostConfs.capitaines = {
19 certName = "capitaines_mastodon"; 25 certName = "capitaines_mastodon";
20 hosts = [ "mastodon.capitaines.fr" ]; 26 hosts = [ "mastodon.capitaines.fr" ];
21 root = siteDir; 27 root = root;
22 extraConfig = [ 28 extraConfig = [
23 '' 29 ''
24 ErrorDocument 404 /index.html 30 ErrorDocument 404 /index.html
25 <Directory ${siteDir}> 31 <Directory ${root}>
26 DirectoryIndex index.html 32 DirectoryIndex index.html
27 Options Indexes FollowSymLinks MultiViews Includes 33 Options Indexes FollowSymLinks MultiViews Includes
28 Require all granted 34 Require all granted
diff --git a/nixops/modules/websites/chloe/chloe.nix b/nixops/modules/websites/chloe/chloe.nix
index 3b92af3..80e5554 100644
--- a/nixops/modules/websites/chloe/chloe.nix
+++ b/nixops/modules/websites/chloe/chloe.nix
@@ -56,16 +56,16 @@ let
56 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" 56 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
57 </FilesMatch> 57 </FilesMatch>
58 58
59 <Directory ${if environment == "dev" then root else webRoot}> 59 <Directory ${root}>
60 DirectoryIndex index.php index.htm index.html 60 DirectoryIndex index.php index.htm index.html
61 Options -Indexes +FollowSymLinks +MultiViews +Includes 61 Options -Indexes +FollowSymLinks +MultiViews +Includes
62 Include ${if environment == "dev" then root else webRoot}/htaccess.txt 62 Include ${root}/htaccess.txt
63 63
64 AllowOverride AuthConfig FileInfo Limit 64 AllowOverride AuthConfig FileInfo Limit
65 Require all granted 65 Require all granted
66 </Directory> 66 </Directory>
67 67
68 <DirectoryMatch "${if environment == "dev" then root else webRoot}/squelettes"> 68 <DirectoryMatch "${root}/squelettes">
69 Require all denied 69 Require all denied
70 </DirectoryMatch> 70 </DirectoryMatch>
71 71
diff --git a/nixops/modules/websites/chloe/default.nix b/nixops/modules/websites/chloe/default.nix
index d647eb9..f561834 100644
--- a/nixops/modules/websites/chloe/default.nix
+++ b/nixops/modules/websites/chloe/default.nix
@@ -53,7 +53,7 @@ in {
53 services.myWebsites.production.vhostConfs.chloe = { 53 services.myWebsites.production.vhostConfs.chloe = {
54 certName = "chloe"; 54 certName = "chloe";
55 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ]; 55 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
56 root = chloe_prod.webRoot; 56 root = chloe_prod.apache.root;
57 extraConfig = [ chloe_prod.apache.vhostConf ]; 57 extraConfig = [ chloe_prod.apache.vhostConf ];
58 }; 58 };
59 }) 59 })
diff --git a/nixops/modules/websites/commons/adminer.nix b/nixops/modules/websites/commons/adminer.nix
index 891046f..9c4e132 100644
--- a/nixops/modules/websites/commons/adminer.nix
+++ b/nixops/modules/websites/commons/adminer.nix
@@ -32,13 +32,15 @@ let
32 php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" 32 php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer"
33 ''; 33 '';
34 }; 34 };
35 apache = { 35 apache = rec {
36 user = "wwwrun"; 36 user = "wwwrun";
37 group = "wwwrun"; 37 group = "wwwrun";
38 modules = [ "proxy_fcgi" ]; 38 modules = [ "proxy_fcgi" ];
39 webappName = "_adminer";
40 root = "/run/current-system/webapps/${webappName}";
39 vhostConf = '' 41 vhostConf = ''
40 Alias /adminer ${webRoot} 42 Alias /adminer ${root}
41 <Directory ${webRoot}> 43 <Directory ${root}>
42 DirectoryIndex index.php 44 DirectoryIndex index.php
43 Require all granted 45 Require all granted
44 <FilesMatch "\.php$"> 46 <FilesMatch "\.php$">
diff --git a/nixops/modules/websites/connexionswing/connexionswing.nix b/nixops/modules/websites/connexionswing/connexionswing.nix
index dff563f..74a1ad0 100644
--- a/nixops/modules/websites/connexionswing/connexionswing.nix
+++ b/nixops/modules/websites/connexionswing/connexionswing.nix
@@ -129,7 +129,7 @@ let
129 '' else '' 129 '' else ''
130 Use Stats connexionswing.com 130 Use Stats connexionswing.com
131 131
132 <Directory ${webRoot}> 132 <Directory ${root}>
133 Options Indexes FollowSymLinks MultiViews Includes 133 Options Indexes FollowSymLinks MultiViews Includes
134 AllowOverride All 134 AllowOverride All
135 Require all granted 135 Require all granted
diff --git a/nixops/modules/websites/connexionswing/default.nix b/nixops/modules/websites/connexionswing/default.nix
index f176762..f98b349 100644
--- a/nixops/modules/websites/connexionswing/default.nix
+++ b/nixops/modules/websites/connexionswing/default.nix
@@ -53,7 +53,7 @@ in {
53 services.myWebsites.production.vhostConfs.connexionswing = { 53 services.myWebsites.production.vhostConfs.connexionswing = {
54 certName = "connexionswing"; 54 certName = "connexionswing";
55 hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ]; 55 hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ];
56 root = connexionswing_prod.webRoot; 56 root = connexionswing_prod.apache.root;
57 extraConfig = [ connexionswing_prod.apache.vhostConf ]; 57 extraConfig = [ connexionswing_prod.apache.vhostConf ];
58 }; 58 };
59 }) 59 })
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix
index 3db1cfa..c8f7481 100644
--- a/nixops/modules/websites/default.nix
+++ b/nixops/modules/websites/default.nix
@@ -1,6 +1,8 @@
1{ lib, pkgs, config, mylibs, myconfig, ... }: 1{ lib, pkgs, config, mylibs, myconfig, ... }:
2let 2let
3 cfg = config.services.myWebsites; 3 cfg = config.services.myWebsites;
4 www_root = "/run/current-system/webapps/_www";
5 theme_root = "/run/current-system/webapps/_theme";
4 makeService = name: cfg: let 6 makeService = name: cfg: let
5 toVhost = vhostConf: { 7 toVhost = vhostConf: {
6 enableSSL = true; 8 enableSSL = true;
@@ -21,9 +23,9 @@ let
21 hostName = "nossl.immae.eu"; 23 hostName = "nossl.immae.eu";
22 enableSSL = false; 24 enableSSL = false;
23 logFormat = "combinedVhost"; 25 logFormat = "combinedVhost";
24 documentRoot = ../../www; 26 documentRoot = www_root;
25 extraConfig = '' 27 extraConfig = ''
26 <Directory ${../../www}> 28 <Directory ${www_root}>
27 DirectoryIndex nossl.html 29 DirectoryIndex nossl.html
28 AllowOverride None 30 AllowOverride None
29 Require all granted 31 Require all granted
@@ -52,7 +54,7 @@ let
52 fallbackVhost = toVhost { # Should go first, default choice 54 fallbackVhost = toVhost { # Should go first, default choice
53 certName = "eldiron"; 55 certName = "eldiron";
54 hosts = ["eldiron.immae.eu" ]; 56 hosts = ["eldiron.immae.eu" ];
55 root = ../../www; 57 root = www_root;
56 extraConfig = [ "DirectoryIndex index.htm" ]; 58 extraConfig = [ "DirectoryIndex index.htm" ];
57 }; 59 };
58 in rec { 60 in rec {
@@ -290,11 +292,11 @@ in
290 ErrorDocument 502 /maintenance_immae.html 292 ErrorDocument 502 /maintenance_immae.html
291 ErrorDocument 503 /maintenance_immae.html 293 ErrorDocument 503 /maintenance_immae.html
292 ErrorDocument 504 /maintenance_immae.html 294 ErrorDocument 504 /maintenance_immae.html
293 Alias /maintenance_immae.html ${../../www}/maintenance_immae.html 295 Alias /maintenance_immae.html ${www_root}/maintenance_immae.html
294 ProxyPass /maintenance_immae.html ! 296 ProxyPass /maintenance_immae.html !
295 297
296 AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${../../www}/googleb6d69446ff4ca3e5.html 298 AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${www_root}/googleb6d69446ff4ca3e5.html
297 <Directory ${../../www}> 299 <Directory ${www_root}>
298 AllowOverride None 300 AllowOverride None
299 Require all granted 301 Require all granted
300 </Directory> 302 </Directory>
@@ -303,8 +305,8 @@ in
303 apaxy = { 305 apaxy = {
304 extraConfig = '' 306 extraConfig = ''
305 <Macro Apaxy %{folder} %{ignored}> 307 <Macro Apaxy %{folder} %{ignored}>
306 Alias /theme ${./apache/theme} 308 Alias /theme ${theme_root}
307 <Directory ${./apache/theme}> 309 <Directory ${theme_root}>
308 Options -Indexes 310 Options -Indexes
309 AllowOverride None 311 AllowOverride None
310 Require all granted 312 Require all granted
@@ -407,6 +409,15 @@ in
407 ''; 409 '';
408 }; 410 };
409 411
412 system.extraSystemBuilderCmds = let
413 adminer = pkgs.callPackage ./commons/adminer.nix {};
414 in ''
415 mkdir -p $out/webapps
416 ln -s ${../../www} $out/webapps/_www
417 ln -s ${./apache/theme} $out/webapps/_theme
418 ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName}
419 '';
420
410 services.myPhpfpm = { 421 services.myPhpfpm = {
411 phpPackage = pkgs.php; 422 phpPackage = pkgs.php;
412 phpOptions = '' 423 phpOptions = ''
diff --git a/nixops/modules/websites/emilia/default.nix b/nixops/modules/websites/emilia/default.nix
index 5783ed0..4002caa 100644
--- a/nixops/modules/websites/emilia/default.nix
+++ b/nixops/modules/websites/emilia/default.nix
@@ -4,6 +4,8 @@ let
4 env = myconfig.env.websites.emilia; 4 env = myconfig.env.websites.emilia;
5 varDir = "/var/lib/moodle"; 5 varDir = "/var/lib/moodle";
6 siteDir = ./moodle; 6 siteDir = ./moodle;
7 webappName = "emilia_moodle";
8 root = "/run/current-system/webapps/${webappName}";
7 # php_admin_value[upload_max_filesize] = 50000000 9 # php_admin_value[upload_max_filesize] = 50000000
8 # php_admin_value[post_max_size] = 50000000 10 # php_admin_value[post_max_size] = 50000000
9 configFile = '' 11 configFile = ''
@@ -55,13 +57,17 @@ in {
55 system.activationScripts.emilia = '' 57 system.activationScripts.emilia = ''
56 install -m 0755 -o wwwrun -g wwwrun -d ${varDir} 58 install -m 0755 -o wwwrun -g wwwrun -d ${varDir}
57 ''; 59 '';
60 system.extraSystemBuilderCmds = ''
61 mkdir -p $out/webapps
62 ln -s ${siteDir} $out/webapps/${webappName}
63 '';
58 services.myWebsites.production.vhostConfs.emilia = { 64 services.myWebsites.production.vhostConfs.emilia = {
59 certName = "emilia"; 65 certName = "emilia";
60 hosts = [ "saison-photo.org" "www.saison-photo.org" ]; 66 hosts = [ "saison-photo.org" "www.saison-photo.org" ];
61 root = siteDir; 67 root = root;
62 extraConfig = [ 68 extraConfig = [
63 '' 69 ''
64 <Directory ${siteDir}> 70 <Directory ${root}>
65 DirectoryIndex pause.html 71 DirectoryIndex pause.html
66 Options Indexes FollowSymLinks MultiViews Includes 72 Options Indexes FollowSymLinks MultiViews Includes
67 Require all granted 73 Require all granted
diff --git a/nixops/modules/websites/ftp/temp.nix b/nixops/modules/websites/ftp/temp.nix
index 1033121..7f9f681 100644
--- a/nixops/modules/websites/ftp/temp.nix
+++ b/nixops/modules/websites/ftp/temp.nix
@@ -20,7 +20,7 @@ in {
20 root = varDir; 20 root = varDir;
21 extraConfig = [ 21 extraConfig = [
22 '' 22 ''
23 Use Apaxy "${varDir}" "title" 23 Use Apaxy "${varDir}" "title .duplicity-ignore"
24 <FilesMatch ".+"> 24 <FilesMatch ".+">
25 Header set Content-Disposition attachment 25 Header set Content-Disposition attachment
26 </FilesMatch> 26 </FilesMatch>
diff --git a/nixops/modules/websites/ludivine/default.nix b/nixops/modules/websites/ludivine/default.nix
index bcbef51..3dd0ee7 100644
--- a/nixops/modules/websites/ludivine/default.nix
+++ b/nixops/modules/websites/ludivine/default.nix
@@ -46,7 +46,7 @@ in {
46 services.myWebsites.production.vhostConfs.ludivine = { 46 services.myWebsites.production.vhostConfs.ludivine = {
47 certName = "ludivinecassal"; 47 certName = "ludivinecassal";
48 hosts = ["ludivinecassal.com" "www.ludivinecassal.com" ]; 48 hosts = ["ludivinecassal.com" "www.ludivinecassal.com" ];
49 root = ludivinecassal_prod.webRoot; 49 root = ludivinecassal_prod.apache.root;
50 extraConfig = [ ludivinecassal_prod.apache.vhostConf ]; 50 extraConfig = [ ludivinecassal_prod.apache.vhostConf ];
51 }; 51 };
52 }) 52 })
diff --git a/nixops/modules/websites/ludivine/ludivinecassal.nix b/nixops/modules/websites/ludivine/ludivinecassal.nix
index 02614a5..3ffd335 100644
--- a/nixops/modules/websites/ludivine/ludivinecassal.nix
+++ b/nixops/modules/websites/ludivine/ludivinecassal.nix
@@ -121,7 +121,7 @@ let
121 '' else '' 121 '' else ''
122 Use Stats ludivinecassal.com 122 Use Stats ludivinecassal.com
123 123
124 <Directory ${webRoot}> 124 <Directory ${root}>
125 Options Indexes FollowSymLinks MultiViews Includes 125 Options Indexes FollowSymLinks MultiViews Includes
126 AllowOverride All 126 AllowOverride All
127 Require all granted 127 Require all granted
diff --git a/nixops/modules/websites/piedsjaloux/default.nix b/nixops/modules/websites/piedsjaloux/default.nix
index 584e936..54e063d 100644
--- a/nixops/modules/websites/piedsjaloux/default.nix
+++ b/nixops/modules/websites/piedsjaloux/default.nix
@@ -50,7 +50,7 @@ in {
50 services.myWebsites.production.vhostConfs.piedsjaloux = { 50 services.myWebsites.production.vhostConfs.piedsjaloux = {
51 certName = "piedsjaloux"; 51 certName = "piedsjaloux";
52 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ]; 52 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
53 root = piedsjaloux_prod.webRoot; 53 root = piedsjaloux_prod.apache.root;
54 extraConfig = [ piedsjaloux_prod.apache.vhostConf ]; 54 extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
55 }; 55 };
56 }) 56 })
diff --git a/nixops/modules/websites/piedsjaloux/piedsjaloux.nix b/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
index a2d9a12..4caf48a 100644
--- a/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
+++ b/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
@@ -110,7 +110,7 @@ let
110 '' else '' 110 '' else ''
111 Use Stats piedsjaloux.fr 111 Use Stats piedsjaloux.fr
112 112
113 <Directory ${webRoot}> 113 <Directory ${root}>
114 Options Indexes FollowSymLinks MultiViews Includes 114 Options Indexes FollowSymLinks MultiViews Includes
115 AllowOverride All 115 AllowOverride All
116 Require all granted 116 Require all granted