aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-06 17:57:28 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-06 17:57:28 +0100
commit34e2fd14c7091f85b667667cb2b74c1b75e005db (patch)
tree27219178ed14f05cf8f017b426796f93d389fdf6
parent2f2b578bee0ab204a2e626ec9f7ca5c290634456 (diff)
downloadNix-34e2fd14c7091f85b667667cb2b74c1b75e005db.tar.gz
Nix-34e2fd14c7091f85b667667cb2b74c1b75e005db.tar.zst
Nix-34e2fd14c7091f85b667667cb2b74c1b75e005db.zip
Add piedsjaloux website
-rw-r--r--virtual/eldiron.nix39
-rw-r--r--virtual/packages.nix3
-rw-r--r--virtual/packages/aten.nix4
-rw-r--r--virtual/packages/ludivinecassal.nix4
-rw-r--r--virtual/packages/piedsjaloux.json14
-rw-r--r--virtual/packages/piedsjaloux.nix169
-rw-r--r--virtual/packages/piedsjaloux_goaccess.conf99
7 files changed, 327 insertions, 5 deletions
diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix
index 7d732ac..2b407e2 100644
--- a/virtual/eldiron.nix
+++ b/virtual/eldiron.nix
@@ -119,6 +119,7 @@
119 "cloud.immae.eu" = null; 119 "cloud.immae.eu" = null;
120 "ludivine.immae.eu" = null; 120 "ludivine.immae.eu" = null;
121 "dev.aten.pro" = null; 121 "dev.aten.pro" = null;
122 "piedsjaloux.immae.eu" = null;
122 }; 123 };
123 }; 124 };
124 "ludivinecassal" = { 125 "ludivinecassal" = {
@@ -145,6 +146,18 @@
145 "www.aten.pro" = null; 146 "www.aten.pro" = null;
146 }; 147 };
147 }; 148 };
149 "piedsjaloux" = {
150 webroot = "/var/lib/acme/acme-challenge";
151 email = "ismael@bouya.org";
152 domain = "piedsjaloux.fr";
153 plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ];
154 postRun = ''
155 systemctl reload httpd.service
156 '';
157 extraDomains = {
158 "www.piedsjaloux.fr" = null;
159 };
160 };
148 # "connexionswing" = { 161 # "connexionswing" = {
149 # webroot = "/var/lib/acme/acme-challenge"; 162 # webroot = "/var/lib/acme/acme-challenge";
150 # email = "ismael@bouya.org"; 163 # email = "ismael@bouya.org";
@@ -213,6 +226,8 @@
213 connexionswing_prod = mypkgs.connexionswing_prod.phpFpm.pool; 226 connexionswing_prod = mypkgs.connexionswing_prod.phpFpm.pool;
214 ludivinecassal_dev = mypkgs.ludivinecassal_dev.phpFpm.pool; 227 ludivinecassal_dev = mypkgs.ludivinecassal_dev.phpFpm.pool;
215 ludivinecassal_prod = mypkgs.ludivinecassal_prod.phpFpm.pool; 228 ludivinecassal_prod = mypkgs.ludivinecassal_prod.phpFpm.pool;
229 piedsjaloux_dev = mypkgs.piedsjaloux_dev.phpFpm.pool;
230 piedsjaloux_prod = mypkgs.piedsjaloux_prod.phpFpm.pool;
216 aten_dev = mypkgs.aten_dev.phpFpm.pool; 231 aten_dev = mypkgs.aten_dev.phpFpm.pool;
217 aten_prod = mypkgs.aten_prod.phpFpm.pool; 232 aten_prod = mypkgs.aten_prod.phpFpm.pool;
218 nextcloud = mypkgs.nextcloud.phpFpm.pool; 233 nextcloud = mypkgs.nextcloud.phpFpm.pool;
@@ -224,7 +239,9 @@
224 connexionswing_dev = mypkgs.connexionswing_dev.activationScript; 239 connexionswing_dev = mypkgs.connexionswing_dev.activationScript;
225 connexionswing_prod = mypkgs.connexionswing_prod.activationScript; 240 connexionswing_prod = mypkgs.connexionswing_prod.activationScript;
226 ludivinecassal_dev = mypkgs.ludivinecassal_dev.activationScript; 241 ludivinecassal_dev = mypkgs.ludivinecassal_dev.activationScript;
227 ludivinecassal_prod = mypkgs.ludivinecassal_prod.activationScript; 242 ludivinecassal_prod = mypkgs.ludivinecassal_prod.activationScript;
243 piedsjaloux_dev = mypkgs.piedsjaloux_dev.activationScript;
244 piedsjaloux_prod = mypkgs.piedsjaloux_prod.activationScript;
228 aten_dev = mypkgs.aten_dev.activationScript; 245 aten_dev = mypkgs.aten_dev.activationScript;
229 aten_prod = mypkgs.aten_prod.activationScript; 246 aten_prod = mypkgs.aten_prod.activationScript;
230 nextcloud = mypkgs.nextcloud.activationScript; 247 nextcloud = mypkgs.nextcloud.activationScript;
@@ -261,6 +278,8 @@
261 goaccess = '' 278 goaccess = ''
262 mkdir -p /var/lib/goaccess 279 mkdir -p /var/lib/goaccess
263 mkdir -p /var/lib/goaccess/aten.pro 280 mkdir -p /var/lib/goaccess/aten.pro
281 mkdir -p /var/lib/goaccess/ludivinecassal.com
282 mkdir -p /var/lib/goaccess/piedsjaloux.fr
264 ''; 283 '';
265 }; 284 };
266 285
@@ -369,6 +388,8 @@
369 mypkgs.connexionswing_prod.apache.modules ++ 388 mypkgs.connexionswing_prod.apache.modules ++
370 mypkgs.ludivinecassal_dev.apache.modules ++ 389 mypkgs.ludivinecassal_dev.apache.modules ++
371 mypkgs.ludivinecassal_prod.apache.modules ++ 390 mypkgs.ludivinecassal_prod.apache.modules ++
391 mypkgs.piedsjaloux_dev.apache.modules ++
392 mypkgs.piedsjaloux_prod.apache.modules ++
372 mypkgs.aten_dev.apache.modules ++ 393 mypkgs.aten_dev.apache.modules ++
373 mypkgs.aten_prod.apache.modules ++ 394 mypkgs.aten_prod.apache.modules ++
374 mypkgs.ympd.apache.modules ++ 395 mypkgs.ympd.apache.modules ++
@@ -425,6 +446,21 @@
425 ]; 446 ];
426 }) 447 })
427 (withConf "eldiron" // { 448 (withConf "eldiron" // {
449 hostName = "piedsjaloux.immae.eu";
450 documentRoot = mypkgs.piedsjaloux_dev.webRoot;
451 extraConfig = builtins.concatStringsSep "\n" [
452 mypkgs.piedsjaloux_dev.apache.vhostConf
453 ];
454 })
455 (withConf "piedsjaloux" // {
456 hostName = "piedsjaloux.fr";
457 serverAliases = [ "www.piedsjaloux.fr" ];
458 documentRoot = mypkgs.piedsjaloux_prod.webRoot;
459 extraConfig = builtins.concatStringsSep "\n" [
460 mypkgs.piedsjaloux_prod.apache.vhostConf
461 ];
462 })
463 (withConf "eldiron" // {
428 hostName = "dev.aten.pro"; 464 hostName = "dev.aten.pro";
429 documentRoot = mypkgs.aten_dev.webRoot; 465 documentRoot = mypkgs.aten_dev.webRoot;
430 extraConfig = builtins.concatStringsSep "\n" [ 466 extraConfig = builtins.concatStringsSep "\n" [
@@ -561,6 +597,7 @@
561 in [ 597 in [
562 "5 0 * * * root ${stats "aten.pro" ./packages/aten_goaccess.conf}" 598 "5 0 * * * root ${stats "aten.pro" ./packages/aten_goaccess.conf}"
563 "5 0 * * * root ${stats "ludivinecassal.com" ./packages/ludivinecassal_goaccess.conf}" 599 "5 0 * * * root ${stats "ludivinecassal.com" ./packages/ludivinecassal_goaccess.conf}"
600 "5 0 * * * root ${stats "piedsjaloux.fr" ./packages/piedsjaloux_goaccess.conf}"
564 ]; 601 ];
565 }; 602 };
566 }; 603 };
diff --git a/virtual/packages.nix b/virtual/packages.nix
index 60a333a..ed88b9d 100644
--- a/virtual/packages.nix
+++ b/virtual/packages.nix
@@ -2,6 +2,7 @@
2let 2let
3 connexionswing = callPackage ./packages/connexionswing.nix { inherit checkEnv fetchedGitPrivate; }; 3 connexionswing = callPackage ./packages/connexionswing.nix { inherit checkEnv fetchedGitPrivate; };
4 ludivinecassal = callPackage ./packages/ludivinecassal.nix { inherit checkEnv fetchedGitPrivate; }; 4 ludivinecassal = callPackage ./packages/ludivinecassal.nix { inherit checkEnv fetchedGitPrivate; };
5 piedsjaloux = callPackage ./packages/piedsjaloux.nix { inherit checkEnv fetchedGitPrivate; };
5 aten = callPackage ./packages/aten.nix { inherit checkEnv fetchedGitPrivate; }; 6 aten = callPackage ./packages/aten.nix { inherit checkEnv fetchedGitPrivate; };
6 nextcloud = callPackage ./packages/nextcloud.nix { inherit checkEnv; }; 7 nextcloud = callPackage ./packages/nextcloud.nix { inherit checkEnv; };
7 adminer = callPackage ./packages/adminer.nix {}; 8 adminer = callPackage ./packages/adminer.nix {};
@@ -18,6 +19,8 @@ in
18 ludivinecassal_prod = ludivinecassal { environment = "prod"; }; 19 ludivinecassal_prod = ludivinecassal { environment = "prod"; };
19 aten_dev = aten { environment = "dev"; }; 20 aten_dev = aten { environment = "dev"; };
20 aten_prod = aten { environment = "prod"; }; 21 aten_prod = aten { environment = "prod"; };
22 piedsjaloux_dev = piedsjaloux { environment = "dev"; };
23 piedsjaloux_prod = piedsjaloux { environment = "prod"; };
21 inherit nextcloud; 24 inherit nextcloud;
22 inherit mantisbt; 25 inherit mantisbt;
23 # FIXME: add buildbot 26 # FIXME: add buildbot
diff --git a/virtual/packages/aten.nix b/virtual/packages/aten.nix
index 21bbff0..8251b31 100644
--- a/virtual/packages/aten.nix
+++ b/virtual/packages/aten.nix
@@ -37,8 +37,6 @@ let
37 assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET"; 37 assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET";
38 assert checkEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"; 38 assert checkEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL";
39 '' 39 ''
40 Use Stats aten.pro
41
42 <FilesMatch "\.php$"> 40 <FilesMatch "\.php$">
43 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" 41 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
44 </FilesMatch> 42 </FilesMatch>
@@ -60,6 +58,8 @@ let
60 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>" 58 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
61 </Location> 59 </Location>
62 '' else '' 60 '' else ''
61 Use Stats aten.pro
62
63 <Location /backend> 63 <Location /backend>
64 Use LDAPConnect 64 Use LDAPConnect
65 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu 65 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
diff --git a/virtual/packages/ludivinecassal.nix b/virtual/packages/ludivinecassal.nix
index 03f68f7..c078722 100644
--- a/virtual/packages/ludivinecassal.nix
+++ b/virtual/packages/ludivinecassal.nix
@@ -71,8 +71,6 @@ let
71 group = "wwwrun"; 71 group = "wwwrun";
72 modules = [ "proxy_fcgi" ]; 72 modules = [ "proxy_fcgi" ];
73 vhostConf = '' 73 vhostConf = ''
74 Use Stats ludivinecassal.com
75
76 <FilesMatch "\.php$"> 74 <FilesMatch "\.php$">
77 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" 75 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
78 </FilesMatch> 76 </FilesMatch>
@@ -125,6 +123,8 @@ let
125 123
126 </Directory> 124 </Directory>
127 '' else '' 125 '' else ''
126 Use Stats ludivinecassal.com
127
128 <Directory ${webRoot}> 128 <Directory ${webRoot}>
129 Options Indexes FollowSymLinks MultiViews Includes 129 Options Indexes FollowSymLinks MultiViews Includes
130 AllowOverride All 130 AllowOverride All
diff --git a/virtual/packages/piedsjaloux.json b/virtual/packages/piedsjaloux.json
new file mode 100644
index 0000000..c4aae16
--- /dev/null
+++ b/virtual/packages/piedsjaloux.json
@@ -0,0 +1,14 @@
1{
2 "tag": "c7a5593-master",
3 "meta": {
4 "name": "piedsjaloux",
5 "url": "gitolite@git.immae.eu:Pieds_jaloux/NewSite",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:Pieds_jaloux/NewSite",
10 "rev": "c7a5593c37040c6f1f57f8163bc13256aabf6b3e",
11 "sha256": "1zvyd90d6xns6ypnp1p3fgbcl30pqwdv335qagbbjak1cn8jaq4l",
12 "fetchSubmodules": true
13 }
14}
diff --git a/virtual/packages/piedsjaloux.nix b/virtual/packages/piedsjaloux.nix
new file mode 100644
index 0000000..819bafb
--- /dev/null
+++ b/virtual/packages/piedsjaloux.nix
@@ -0,0 +1,169 @@
1{ lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, texlive, imagemagick }:
2let
3 piedsjaloux = { environment ? "dev" }: rec {
4 varPrefix = "PIEDSJALOUX";
5 varDir = "/var/lib/piedsjaloux_${environment}";
6 envName= lib.strings.toUpper environment;
7 configRoot =
8 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD";
9 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER";
10 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_NAME";
11 assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET";
12 writeText "parameters.yml" ''
13 # This file is auto-generated during the composer install
14 parameters:
15 database_host: db-1.immae.eu
16 database_port: null
17 database_name: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_NAME"}
18 database_user: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"}
19 database_password: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"}
20 mailer_transport: smtp
21 mailer_host: mail.immae.eu
22 mailer_user: null
23 mailer_password: null
24 secret: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"}
25 pdflatex: "${texlive.combine { inherit (texlive) attachfile preprint scheme-small; }}/bin/pdflatex"
26 leapt_im:
27 binary_path: ${imagemagick}/bin
28 '';
29 phpFpm = rec {
30 socket = "/var/run/phpfpm/piedsjaloux-${environment}.sock";
31 pool = ''
32 listen = ${socket}
33 user = ${apache.user}
34 group = ${apache.group}
35 listen.owner = ${apache.user}
36 listen.group = ${apache.group}
37 php_admin_value[upload_max_filesize] = 20M
38 php_admin_value[post_max_size] = 20M
39 ;php_admin_flag[log_errors] = on
40 php_admin_value[open_basedir] = "${configRoot}:${webappDir}:${varDir}:/tmp"
41 ${if environment == "dev" then ''
42 pm = ondemand
43 pm.max_children = 5
44 pm.process_idle_timeout = 60
45 env[SYMFONY_DEBUG_MODE] = "yes"
46 '' else ''
47 pm = dynamic
48 pm.max_children = 20
49 pm.start_servers = 2
50 pm.min_spare_servers = 1
51 pm.max_spare_servers = 3
52 ''}'';
53 };
54 apache = {
55 user = "wwwrun";
56 group = "wwwrun";
57 modules = [ "proxy_fcgi" ];
58 vhostConf = ''
59 <FilesMatch "\.php$">
60 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
61 </FilesMatch>
62
63 ${if environment == "dev" then ''
64 <Location />
65 Use LDAPConnect
66 Require ldap-group cn=piedsjaloux.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
67 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
68 </Location>
69
70 <Directory ${webRoot}>
71 Options Indexes FollowSymLinks MultiViews Includes
72 AllowOverride None
73 Require all granted
74
75 DirectoryIndex app_dev.php
76
77 <IfModule mod_negotiation.c>
78 Options -MultiViews
79 </IfModule>
80
81 <IfModule mod_rewrite.c>
82 RewriteEngine On
83
84 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
85 RewriteRule ^(.*) - [E=BASE:%1]
86
87 # Maintenance script
88 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
89 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
90 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
91 ErrorDocument 503 /maintenance.php
92
93 # Sets the HTTP_AUTHORIZATION header removed by Apache
94 RewriteCond %{HTTP:Authorization} .
95 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
96
97 RewriteCond %{ENV:REDIRECT_STATUS} ^$
98 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
99
100 # If the requested filename exists, simply serve it.
101 # We only want to let Apache serve files and not directories.
102 RewriteCond %{REQUEST_FILENAME} -f
103 RewriteRule ^ - [L]
104
105 # Rewrite all other queries to the front controller.
106 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]
107 </IfModule>
108
109 </Directory>
110 '' else ''
111 Use Stats piedsjaloux.fr
112
113 <Directory ${webRoot}>
114 Options Indexes FollowSymLinks MultiViews Includes
115 AllowOverride All
116 Require all granted
117 </Directory>
118 ''}
119 '';
120 };
121 activationScript = {
122 deps = [ "wrappers" ];
123 text = ''
124 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
125 ${varDir}/tmp
126 if [ ! -f "${varDir}/currentWebappDir" -o \
127 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
128 pushd ${webappDir} > /dev/null
129 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
130 popd > /dev/null
131 echo -n "${webappDir}" > ${varDir}/currentWebappDir
132 fi
133 '';
134 };
135 webappDir = stdenv.mkDerivation (fetchedGitPrivate ./piedsjaloux.json // rec {
136 # FIXME: can we do better than symlink?
137 # FIXME: initial sync
138 # FIXME: backup
139 # FIXME: miniatures and data need to be in the same dir due to a
140 # bug in leapt.im (searches for data/../miniatures)
141 # FIXME: var/bootstrap.php.cache doesn't get created
142 # (cannot work with var as a symlink since the file
143 # references ..)
144 # FIXME: configuration change should not trigger a rebuild
145 buildPhase = ''
146 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
147 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
148
149 ln -sf ${configRoot} app/config/parameters.yml
150 sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
151 ${if environment == "dev" then ''
152 composer install
153 '' else ''
154 SYMFONY_ENV=prod composer install --no-dev
155 ''}
156 rm -rf var
157 ln -sf ../../../../../${varDir} var
158 '';
159 installPhase = ''
160 cp -a . $out
161 '';
162 buildInputs = [
163 php git cacert phpPackages.composer
164 ];
165 });
166 webRoot = "${webappDir}/web";
167 };
168in
169 piedsjaloux
diff --git a/virtual/packages/piedsjaloux_goaccess.conf b/virtual/packages/piedsjaloux_goaccess.conf
new file mode 100644
index 0000000..3950f7e
--- /dev/null
+++ b/virtual/packages/piedsjaloux_goaccess.conf
@@ -0,0 +1,99 @@
1time-format %H:%M:%S
2date-format %d/%b/%Y
3
4#sur immae.eu
5#log-format %v %h %^[%d:%t %^] "%r" %s %b "%R" "%u" $^
6
7log-format VCOMBINED
8#= %v:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
9
10html-prefs {"theme":"bright","layout":"vertical"}
11
12exclude-ip 188.165.209.148
13exclude-ip 178.33.252.96
14exclude-ip 2001:41d0:2:9c94::1
15exclude-ip 2001:41d0:2:9c94::
16exclude-ip 176.9.151.89
17exclude-ip 2a01:4f8:160:3445::
18exclude-ip 82.255.56.72
19
20no-query-string true
21
22keep-db-files true
23load-from-disk true
24db-path /var/lib/goaccess/piedsjaloux.fr
25
26ignore-panel REFERRERS
27ignore-panel KEYPHRASES
28
29static-file .css
30static-file .js
31static-file .jpg
32static-file .png
33static-file .gif
34static-file .ico
35static-file .jpeg
36static-file .pdf
37static-file .csv
38static-file .mpeg
39static-file .mpg
40static-file .swf
41static-file .woff
42static-file .woff2
43static-file .xls
44static-file .xlsx
45static-file .doc
46static-file .docx
47static-file .ppt
48static-file .pptx
49static-file .txt
50static-file .zip
51static-file .ogg
52static-file .mp3
53static-file .mp4
54static-file .exe
55static-file .iso
56static-file .gz
57static-file .rar
58static-file .svg
59static-file .bmp
60static-file .tar
61static-file .tgz
62static-file .tiff
63static-file .tif
64static-file .ttf
65static-file .flv
66#static-file .less
67#static-file .ac3
68#static-file .avi
69#static-file .bz2
70#static-file .class
71#static-file .cue
72#static-file .dae
73#static-file .dat
74#static-file .dts
75#static-file .ejs
76#static-file .eot
77#static-file .eps
78#static-file .img
79#static-file .jar
80#static-file .map
81#static-file .mid
82#static-file .midi
83#static-file .ogv
84#static-file .webm
85#static-file .mkv
86#static-file .odp
87#static-file .ods
88#static-file .odt
89#static-file .otf
90#static-file .pict
91#static-file .pls
92#static-file .ps
93#static-file .qt
94#static-file .rm
95#static-file .svgz
96#static-file .wav
97#static-file .webp
98
99