aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-10 23:02:54 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-10 23:20:03 +0100
commit091ae73429b8853e6ab971bffaccd84bdd59f40d (patch)
tree17ba770ff2e30c6f2b3f2e87dc8937093bd39e30 /virtual/modules
parentad915416a6886010139413f4fbc41ed827336aa2 (diff)
downloadNix-091ae73429b8853e6ab971bffaccd84bdd59f40d.tar.gz
Nix-091ae73429b8853e6ab971bffaccd84bdd59f40d.tar.zst
Nix-091ae73429b8853e6ab971bffaccd84bdd59f40d.zip
Move packages fils to module
Diffstat (limited to 'virtual/modules')
-rw-r--r--virtual/modules/websites.nix10
-rw-r--r--virtual/modules/websites/aten/aten.json14
-rw-r--r--virtual/modules/websites/aten/aten.nix126
-rw-r--r--virtual/modules/websites/aten/default.nix (renamed from virtual/modules/websites/aten.nix)8
-rw-r--r--virtual/modules/websites/aten/goaccess.conf99
-rw-r--r--virtual/modules/websites/chloe/chloe.json14
-rw-r--r--virtual/modules/websites/chloe/chloe.nix131
-rw-r--r--virtual/modules/websites/chloe/chloe_config/chmod.php4
-rw-r--r--virtual/modules/websites/chloe/chloe_config/connect.php6
-rw-r--r--virtual/modules/websites/chloe/chloe_config/ldap.php9
-rw-r--r--virtual/modules/websites/chloe/default.nix (renamed from virtual/modules/websites/chloe.nix)8
-rw-r--r--virtual/modules/websites/chloe/goaccess.conf99
-rw-r--r--virtual/modules/websites/commons/spip/spip_ldap_patch.patch60
-rw-r--r--virtual/modules/websites/commons/spip/spip_mes_options.php18
-rw-r--r--virtual/modules/websites/connexionswing/connexionswing.json14
-rw-r--r--virtual/modules/websites/connexionswing/connexionswing.nix181
-rw-r--r--virtual/modules/websites/connexionswing/default.nix (renamed from virtual/modules/websites/connexionswing.nix)8
-rw-r--r--virtual/modules/websites/connexionswing/goaccess.conf99
-rw-r--r--virtual/modules/websites/ludivine/default.nix (renamed from virtual/modules/websites/ludivine.nix)4
-rw-r--r--virtual/modules/websites/ludivine/goaccess.conf99
-rw-r--r--virtual/modules/websites/ludivine/ludivinecassal.json14
-rw-r--r--virtual/modules/websites/ludivine/ludivinecassal.nix181
-rw-r--r--virtual/modules/websites/piedsjaloux/default.nix (renamed from virtual/modules/websites/piedsjaloux.nix)6
-rw-r--r--virtual/modules/websites/piedsjaloux/goaccess.conf99
-rw-r--r--virtual/modules/websites/piedsjaloux/piedsjaloux.json14
-rw-r--r--virtual/modules/websites/piedsjaloux/piedsjaloux.nix171
26 files changed, 1480 insertions, 16 deletions
diff --git a/virtual/modules/websites.nix b/virtual/modules/websites.nix
index cbd7de0..d794c7a 100644
--- a/virtual/modules/websites.nix
+++ b/virtual/modules/websites.nix
@@ -59,11 +59,11 @@ let
59in 59in
60{ 60{
61 imports = [ 61 imports = [
62 ./websites/chloe.nix 62 ./websites/chloe
63 ./websites/ludivine.nix 63 ./websites/ludivine
64 ./websites/aten.nix 64 ./websites/aten
65 ./websites/piedsjaloux.nix 65 ./websites/piedsjaloux
66 ./websites/connexionswing.nix 66 ./websites/connexionswing
67 # built using: 67 # built using:
68 # sed -e "s/services\.httpd/services\.httpdProd/g" .nix-defexpr/channels/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix 68 # sed -e "s/services\.httpd/services\.httpdProd/g" .nix-defexpr/channels/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix
69 # And removed users / groups 69 # And removed users / groups
diff --git a/virtual/modules/websites/aten/aten.json b/virtual/modules/websites/aten/aten.json
new file mode 100644
index 0000000..53569b6
--- /dev/null
+++ b/virtual/modules/websites/aten/aten.json
@@ -0,0 +1,14 @@
1{
2 "tag": "b99537f-master",
3 "meta": {
4 "name": "aten",
5 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Aten",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Aten",
10 "rev": "b99537fdad41291afb4f1bb8b2e2aa4081c71fae",
11 "sha256": "15mlyik6zivxwry6zc906bqnivxhby27yr8kj4lg5n68pvb877dn",
12 "fetchSubmodules": true
13 }
14}
diff --git a/virtual/modules/websites/aten/aten.nix b/virtual/modules/websites/aten/aten.nix
new file mode 100644
index 0000000..d67f7b7
--- /dev/null
+++ b/virtual/modules/websites/aten/aten.nix
@@ -0,0 +1,126 @@
1{ lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, yarn }:
2let
3 aten = { environment ? "dev" }: rec {
4 varPrefix = "ATEN";
5 varDir = "/var/lib/aten_${environment}";
6 envName= lib.strings.toUpper environment;
7 phpFpm = rec {
8 socket = "/var/run/phpfpm/aten-${environment}.sock";
9 pool = ''
10 listen = ${socket}
11 user = ${apache.user}
12 group = ${apache.group}
13 listen.owner = ${apache.user}
14 listen.group = ${apache.group}
15 php_admin_value[upload_max_filesize] = 20M
16 php_admin_value[post_max_size] = 20M
17 ;php_admin_flag[log_errors] = on
18 php_admin_value[open_basedir] = "${webappDir}:${varDir}:/tmp"
19 php_admin_value[session.save_path] = "${varDir}/phpSessions"
20 ${if environment == "dev" then ''
21 pm = ondemand
22 pm.max_children = 5
23 pm.process_idle_timeout = 60
24 env[SYMFONY_DEBUG_MODE] = "yes"
25 '' else ''
26 pm = dynamic
27 pm.max_children = 20
28 pm.start_servers = 2
29 pm.min_spare_servers = 1
30 pm.max_spare_servers = 3
31 ''}'';
32 };
33 apache = {
34 user = "wwwrun";
35 group = "wwwrun";
36 modules = [ "proxy_fcgi" ];
37 vhostConf =
38 assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET";
39 assert checkEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL";
40 ''
41 <FilesMatch "\.php$">
42 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
43 </FilesMatch>
44
45 SetEnv APP_ENV "${environment}"
46 SetEnv APP_SECRET "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"}
47 SetEnv DATABASE_URL "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"}
48
49 ${if environment == "dev" then ''
50 <Location />
51 Use LDAPConnect
52 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
53 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
54 </Location>
55
56 <Location /backend>
57 Use LDAPConnect
58 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
59 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
60 </Location>
61 '' else ''
62 Use Stats aten.pro
63
64 <Location /backend>
65 Use LDAPConnect
66 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
67 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
68 </Location>
69 ''}
70
71 <Directory ${webRoot}>
72 Options Indexes FollowSymLinks MultiViews Includes
73 AllowOverride All
74 Require all granted
75 DirectoryIndex index.php
76 FallbackResource /index.php
77 </Directory>
78 '';
79 };
80 activationScript = {
81 deps = [ "wrappers" ];
82 text = ''
83 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}
84 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
85 if [ ! -f "${varDir}/currentWebappDir" -o \
86 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
87 pushd ${webappDir} > /dev/null
88 $wrapperDir/sudo -u wwwrun APP_ENV=${environment} ./bin/console --env=${environment} cache:clear --no-warmup
89 popd > /dev/null
90 echo -n "${webappDir}" > ${varDir}/currentWebappDir
91 fi
92 '';
93 };
94 webappDir = stdenv.mkDerivation (fetchedGitPrivate ./aten.json // rec {
95 # FIXME: can we do better than symlink?
96 # FIXME: initial sync
97 # FIXME: backup
98 # FIXME: usage statistics
99 buildPhase = ''
100 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
101 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
102 export APP_ENV="${environment}"
103 export DATABASE_URL="${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"}"
104 export APP_SECRET="${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"}"
105
106 ${if environment == "dev" then ''
107 composer install
108 '' else ''
109 SYMFONY_ENV=prod composer install --no-dev
110 ''}
111 yarn install
112 yarn run encore production
113 rm -rf var
114 ln -sf ../../../../../${varDir} var
115 '';
116 installPhase = ''
117 cp -a . $out
118 '';
119 buildInputs = [
120 php git cacert phpPackages.composer yarn
121 ];
122 });
123 webRoot = "${webappDir}/public";
124 };
125in
126 aten
diff --git a/virtual/modules/websites/aten.nix b/virtual/modules/websites/aten/default.nix
index 4688db3..d9db75c 100644
--- a/virtual/modules/websites/aten.nix
+++ b/virtual/modules/websites/aten/default.nix
@@ -1,6 +1,6 @@
1{ lib, pkgs, config, mylibs, ... }: 1{ lib, pkgs, config, mylibs, ... }:
2let 2let
3 aten = pkgs.callPackage ../../packages/aten.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; 3 aten = pkgs.callPackage ./aten.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
4 aten_dev = aten { environment = "dev"; }; 4 aten_dev = aten { environment = "dev"; };
5 aten_prod = aten { environment = "prod"; }; 5 aten_prod = aten { environment = "prod"; };
6 6
@@ -15,13 +15,17 @@ in {
15 }; 15 };
16 }; 16 };
17 17
18 imports = [
19 ../commons/stats.nix
20 ];
21
18 config = lib.mkMerge [ 22 config = lib.mkMerge [
19 (lib.mkIf cfg.production.enable { 23 (lib.mkIf cfg.production.enable {
20 services.myWebsites.commons.stats.enable = true; 24 services.myWebsites.commons.stats.enable = true;
21 services.myWebsites.commons.stats.sites = [ 25 services.myWebsites.commons.stats.sites = [
22 { 26 {
23 name = "aten.pro"; 27 name = "aten.pro";
24 conf = ../../packages/aten_goaccess.conf; 28 conf = ./goaccess.conf;
25 } 29 }
26 ]; 30 ];
27 31
diff --git a/virtual/modules/websites/aten/goaccess.conf b/virtual/modules/websites/aten/goaccess.conf
new file mode 100644
index 0000000..07cce57
--- /dev/null
+++ b/virtual/modules/websites/aten/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/aten.pro
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
diff --git a/virtual/modules/websites/chloe/chloe.json b/virtual/modules/websites/chloe/chloe.json
new file mode 100644
index 0000000..686d751
--- /dev/null
+++ b/virtual/modules/websites/chloe/chloe.json
@@ -0,0 +1,14 @@
1{
2 "tag": "96fc4eb-master",
3 "meta": {
4 "name": "chloe",
5 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe",
10 "rev": "96fc4eb0099a29b0f9a58fb4eaec4bf14ac65f0a",
11 "sha256": "0mf15j6z86j2smm2k360cmm5djhcjbs9949pznwi57kw97vkm1s3",
12 "fetchSubmodules": true
13 }
14}
diff --git a/virtual/modules/websites/chloe/chloe.nix b/virtual/modules/websites/chloe/chloe.nix
new file mode 100644
index 0000000..126d8e7
--- /dev/null
+++ b/virtual/modules/websites/chloe/chloe.nix
@@ -0,0 +1,131 @@
1{ stdenv, lib, checkEnv, fetchzip, fetchurl, fetchedGitPrivate, sassc }:
2let
3 chloe = { environment ? "dev" }: rec {
4 varPrefix = "CHLOE";
5 envName= lib.strings.toUpper environment;
6 phpFpm = rec {
7 socket = "/var/run/phpfpm/chloe-${environment}.sock";
8 pool =
9 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD";
10 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER";
11 assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_DB";
12 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_DN";
13 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD";
14 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH";
15 ''
16 listen = ${socket}
17 user = ${apache.user}
18 group = ${apache.group}
19 listen.owner = ${apache.user}
20 listen.group = ${apache.group}
21 php_admin_value[upload_max_filesize] = 20M
22 php_admin_value[post_max_size] = 20M
23 ;php_admin_flag[log_errors] = on
24 php_admin_value[open_basedir] = "${../commons/spip/spip_mes_options.php}:${configDir}:${webRoot}:${varDir}:/tmp"
25 php_admin_value[session.save_path] = "${varDir}/phpSessions"
26 env[SPIP_CONFIG_DIR] = "${configDir}"
27 env[SPIP_VAR_DIR] = "${varDir}"
28 env[SPIP_SITE] = "chloe-${environment}"
29 env[SPIP_LDAP_BASE] = "dc=immae,dc=eu"
30 env[SPIP_LDAP_HOST] = "ldaps://ldap.immae.eu"
31 env[SPIP_LDAP_SEARCH_DN] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_DN"}"
32 env[SPIP_LDAP_SEARCH_PW] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD"}"
33 env[SPIP_LDAP_SEARCH] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH"}"
34 env[SPIP_MYSQL_HOST] = "db-1.immae.eu"
35 env[SPIP_MYSQL_DB] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_DB"}"
36 env[SPIP_MYSQL_USER] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"}"
37 env[SPIP_MYSQL_PASSWORD] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"}"
38 ${if environment == "dev" then ''
39 pm = ondemand
40 pm.max_children = 5
41 pm.process_idle_timeout = 60
42 '' else ''
43 pm = dynamic
44 pm.max_children = 20
45 pm.start_servers = 2
46 pm.min_spare_servers = 1
47 pm.max_spare_servers = 3
48 ''}'';
49 };
50 apache = {
51 user = "wwwrun";
52 group = "wwwrun";
53 modules = [ "proxy_fcgi" ];
54 vhostConf = ''
55 RewriteEngine On
56 ${if environment == "prod" then ''
57 RewriteRule ^/news.rss /spip.php?page=backend&id_rubrique=1
58 '' else ""}
59
60 <FilesMatch "\.php$">
61 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
62 </FilesMatch>
63
64 <Directory ${webRoot}>
65 DirectoryIndex index.php index.htm index.html
66 Options -Indexes +FollowSymLinks +MultiViews +Includes
67 Include ${webRoot}/htaccess.txt
68
69 AllowOverride AuthConfig FileInfo Limit
70 Require all granted
71 </Directory>
72
73 <DirectoryMatch "${webRoot}/squelettes">
74 Require all denied
75 </DirectoryMatch>
76
77 <FilesMatch "(.htaccess|rewrite-rules|.gitignore)$">
78 Require all denied
79 </FilesMatch>
80
81 ${if environment == "dev" then ''
82 <Location />
83 Use LDAPConnect
84 Require ldap-group cn=chloe.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
85 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://osteopathe-cc.fr\"></html>"
86 </Location>
87 '' else ''
88 Use Stats osteopathe-cc.fr
89 ''}
90 '';
91 };
92 activationScript = {
93 deps = [ "wrappers" ];
94 text = ''
95 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} ${varDir}/IMG ${varDir}/tmp ${varDir}/local
96 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
97 '';
98 };
99 configDir = ./chloe_config;
100 varDir = "/var/lib/chloe_${environment}";
101 siteDir = stdenv.mkDerivation (fetchedGitPrivate ./chloe.json // rec {
102 buildPhase = ''
103 make
104 '';
105 installPhase = ''
106 cp -a . $out
107 '';
108 buildInputs = [ sassc ];
109 });
110 webRoot = stdenv.mkDerivation rec {
111 name = "chloe-${environment}-spip-${version}";
112 version = "3.2";
113 src = fetchzip {
114 url = "http://files.spip.org/spip/stable/spip-${version}.zip";
115 sha256 = "0cacpxs9nv61i3hzd3nbmplq4mp22s886llhacp3n4923jd6snx5";
116 };
117 paches = [ ../commons/spip/spip_ldap_patch.patch ];
118 buildPhase = ''
119 rm -rf IMG local tmp config/remove.txt
120 ln -sf ${../commons/spip/spip_mes_options.php} config/mes_options.php
121 echo "Require all denied" > "config/.htaccess"
122 ln -sf ../../../../../${varDir}/{IMG,local} .
123 '';
124 installPhase = ''
125 cp -a . $out
126 cp -a ${siteDir}/* $out
127 '';
128 };
129 };
130in
131 chloe
diff --git a/virtual/modules/websites/chloe/chloe_config/chmod.php b/virtual/modules/websites/chloe/chloe_config/chmod.php
new file mode 100644
index 0000000..aae16cd
--- /dev/null
+++ b/virtual/modules/websites/chloe/chloe_config/chmod.php
@@ -0,0 +1,4 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', 0777);
4?> \ No newline at end of file
diff --git a/virtual/modules/websites/chloe/chloe_config/connect.php b/virtual/modules/websites/chloe/chloe_config/connect.php
new file mode 100644
index 0000000..2e4439f
--- /dev/null
+++ b/virtual/modules/websites/chloe/chloe_config/connect.php
@@ -0,0 +1,6 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3define('_MYSQL_SET_SQL_MODE',true);
4$GLOBALS['spip_connect_version'] = 0.7;
5spip_connect_db(getenv("SPIP_MYSQL_HOST"),'',getenv("SPIP_MYSQL_USER"),getenv("SPIP_MYSQL_PASSWORD"),getenv("SPIP_MYSQL_DB"),'mysql', 'spip','ldap.php');
6?>
diff --git a/virtual/modules/websites/chloe/chloe_config/ldap.php b/virtual/modules/websites/chloe/chloe_config/ldap.php
new file mode 100644
index 0000000..825b7ed
--- /dev/null
+++ b/virtual/modules/websites/chloe/chloe_config/ldap.php
@@ -0,0 +1,9 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3$GLOBALS['ldap_base'] = getenv("SPIP_LDAP_BASE");
4$GLOBALS['ldap_link'] = @ldap_connect(getenv("SPIP_LDAP_HOST"));
5@ldap_set_option($GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'3');
6@ldap_bind($GLOBALS['ldap_link'],getenv("SPIP_LDAP_SEARCH_DN"), getenv("SPIP_LDAP_SEARCH_PW"));
7$GLOBALS['ldap_champs'] = array('login' => array('sAMAccountName','uid','login','userid','cn','sn'),'nom' => 'cn','email' => 'mail','bio' => 'description',);
8$GLOBALS['ldap_search'] = getenv("SPIP_LDAP_SEARCH");
9?>
diff --git a/virtual/modules/websites/chloe.nix b/virtual/modules/websites/chloe/default.nix
index 3309dd2..72a9b6f 100644
--- a/virtual/modules/websites/chloe.nix
+++ b/virtual/modules/websites/chloe/default.nix
@@ -1,6 +1,6 @@
1{ lib, pkgs, config, mylibs, ... }: 1{ lib, pkgs, config, mylibs, ... }:
2let 2let
3 chloe = pkgs.callPackage ../../packages/chloe.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; 3 chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
4 chloe_dev = chloe { environment = "dev"; }; 4 chloe_dev = chloe { environment = "dev"; };
5 chloe_prod = chloe { environment = "prod"; }; 5 chloe_prod = chloe { environment = "prod"; };
6 6
@@ -15,13 +15,17 @@ in {
15 }; 15 };
16 }; 16 };
17 17
18 imports = [
19 ../commons/stats.nix
20 ];
21
18 config = lib.mkMerge [ 22 config = lib.mkMerge [
19 (lib.mkIf cfg.production.enable { 23 (lib.mkIf cfg.production.enable {
20 services.myWebsites.commons.stats.enable = true; 24 services.myWebsites.commons.stats.enable = true;
21 services.myWebsites.commons.stats.sites = [ 25 services.myWebsites.commons.stats.sites = [
22 { 26 {
23 name = "osteopathe-cc.fr"; 27 name = "osteopathe-cc.fr";
24 conf = ../../packages/chloe_goaccess.conf; 28 conf = ./goaccess.conf;
25 } 29 }
26 ]; 30 ];
27 31
diff --git a/virtual/modules/websites/chloe/goaccess.conf b/virtual/modules/websites/chloe/goaccess.conf
new file mode 100644
index 0000000..89cff6d
--- /dev/null
+++ b/virtual/modules/websites/chloe/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/osteopathe-cc.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
diff --git a/virtual/modules/websites/commons/spip/spip_ldap_patch.patch b/virtual/modules/websites/commons/spip/spip_ldap_patch.patch
new file mode 100644
index 0000000..653c909
--- /dev/null
+++ b/virtual/modules/websites/commons/spip/spip_ldap_patch.patch
@@ -0,0 +1,60 @@
1--- old/ecrire/auth/ldap.php 2017-06-08 21:58:17.000000000 +0200
2+++ new/ecrire/auth/ldap.php 2017-06-10 02:54:02.687954143 +0200
3@@ -171,24 +171,41 @@
4 $desc = isset($ldap['attributes']) && $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'] ;
5
6 $logins = is_array($desc['login']) ? $desc['login'] : array($desc['login']);
7+ if (isset($GLOBALS['ldap_search'])) {
8+ $search_query = str_replace("%user%", $login_search, $GLOBALS['ldap_search']);
9+ $result = @ldap_search($ldap_link, $ldap_base, $search_query, array("dn"));
10+ $info = @ldap_get_entries($ldap_link, $result);
11+ // Ne pas accepter les resultats si plus d'une entree
12+ // (on veut un attribut unique)
13
14- // Tenter une recherche pour essayer de retrouver le DN
15- foreach ($logins as $att) {
16- $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
17- $info = @ldap_get_entries($ldap_link, $result);
18- // Ne pas accepter les resultats si plus d'une entree
19- // (on veut un attribut unique)
20+ if (is_array($info) and $info['count'] == 1) {
21+ $dn = $info[0]['dn'];
22+ if (!$checkpass) {
23+ return $dn;
24+ }
25+ if (@ldap_bind($ldap_link, $dn, $pass)) {
26+ return $dn;
27+ }
28+ }
29+ } else {
30+ // Tenter une recherche pour essayer de retrouver le DN
31+ foreach ($logins as $att) {
32+ $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
33+ $info = @ldap_get_entries($ldap_link, $result);
34+ // Ne pas accepter les resultats si plus d'une entree
35+ // (on veut un attribut unique)
36
37- if (is_array($info) and $info['count'] == 1) {
38- $dn = $info[0]['dn'];
39- if (!$checkpass) {
40- return $dn;
41- }
42- if (@ldap_bind($ldap_link, $dn, $pass)) {
43- return $dn;
44- }
45- }
46- }
47+ if (is_array($info) and $info['count'] == 1) {
48+ $dn = $info[0]['dn'];
49+ if (!$checkpass) {
50+ return $dn;
51+ }
52+ if (@ldap_bind($ldap_link, $dn, $pass)) {
53+ return $dn;
54+ }
55+ }
56+ }
57+ }
58
59 if ($checkpass and !isset($dn)) {
60 // Si echec, essayer de deviner le DN
diff --git a/virtual/modules/websites/commons/spip/spip_mes_options.php b/virtual/modules/websites/commons/spip/spip_mes_options.php
new file mode 100644
index 0000000..8db8389
--- /dev/null
+++ b/virtual/modules/websites/commons/spip/spip_mes_options.php
@@ -0,0 +1,18 @@
1<?php // /!\ Important: There must be no blank space before &lt;?php or after ?&gt;
2// This file was inspired from the spip contrib website
3// http://www.spip.net/fr_article3811.html
4
5$config_dir = getenv('SPIP_CONFIG_DIR') . '/';
6$var_dir = getenv('SPIP_VAR_DIR') . '/';
7
8$cookie_prefix = str_replace('.', '_', getenv("SPIP_SITE"));
9$table_prefix = 'spip';
10
11spip_initialisation(
12 $config_dir,
13 _DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES,
14 $var_dir . _NOM_TEMPORAIRES_INACCESSIBLES,
15 _DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES
16);
17
18?>
diff --git a/virtual/modules/websites/connexionswing/connexionswing.json b/virtual/modules/websites/connexionswing/connexionswing.json
new file mode 100644
index 0000000..146c5f6
--- /dev/null
+++ b/virtual/modules/websites/connexionswing/connexionswing.json
@@ -0,0 +1,14 @@
1{
2 "tag": "0330478-master",
3 "meta": {
4 "name": "connexionswing",
5 "url": "gitolite@git.immae.eu:perso/Immae/Projets/Connexionswing",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:perso/Immae/Projets/Connexionswing",
10 "rev": "0330478cd256e6e36f525d3d0a247bad06de319f",
11 "sha256": "1sh97965winvbmpzqhjidhqry9840fa701wvr4vxywccyg4dyr17",
12 "fetchSubmodules": true
13 }
14}
diff --git a/virtual/modules/websites/connexionswing/connexionswing.nix b/virtual/modules/websites/connexionswing/connexionswing.nix
new file mode 100644
index 0000000..90cca73
--- /dev/null
+++ b/virtual/modules/websites/connexionswing/connexionswing.nix
@@ -0,0 +1,181 @@
1{ lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert }:
2let
3 connexionswing = { environment ? "dev" }: rec {
4 varDir = "/var/lib/connexionswing_${environment}";
5 envName= lib.strings.toUpper environment;
6 configRoot =
7 # FIXME: spool emails in prod for when immae.eu is down?
8 assert checkEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_PASSWORD";
9 assert checkEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_USER";
10 assert checkEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_NAME";
11 assert checkEnv "NIXOPS_CONNEXIONSWING_${envName}_SECRET";
12 assert checkEnv "NIXOPS_CONNEXIONSWING_${envName}_EMAIL";
13 writeText "parameters.yml" ''
14 # This file is auto-generated during the composer install
15 parameters:
16 database_host: db-1.immae.eu
17 database_port: null
18 database_name: ${builtins.getEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_NAME"}
19 database_user: ${builtins.getEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_USER"}
20 database_password: ${builtins.getEnv "NIXOPS_CONNEXIONSWING_${envName}_MYSQL_PASSWORD"}
21 mailer_transport: smtp
22 mailer_host: mail.immae.eu
23 mailer_user: null
24 mailer_password: null
25 subscription_email: ${builtins.getEnv "NIXOPS_CONNEXIONSWING_${envName}_EMAIL"}
26 allow_robots: true
27 secret: ${builtins.getEnv "NIXOPS_CONNEXIONSWING_${envName}_SECRET"}
28 '';
29 phpFpm = rec {
30 socket = "/var/run/phpfpm/connexionswing-${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 php_admin_value[session.save_path] = "${varDir}/phpSessions"
42 ${if environment == "dev" then ''
43 pm = ondemand
44 pm.max_children = 5
45 pm.process_idle_timeout = 60
46 env[SYMFONY_DEBUG_MODE] = "yes"
47 '' else ''
48 pm = dynamic
49 pm.max_children = 20
50 pm.start_servers = 2
51 pm.min_spare_servers = 1
52 pm.max_spare_servers = 3
53 ''}'';
54 };
55 apache = {
56 user = "wwwrun";
57 group = "wwwrun";
58 modules = [ "proxy_fcgi" ];
59 vhostConf = ''
60 <FilesMatch "\.php$">
61 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
62 </FilesMatch>
63
64 <Directory ${varDir}/medias>
65 Options FollowSymLinks
66 AllowOverride None
67 Require all granted
68 </Directory>
69
70 <Directory ${varDir}/uploads>
71 Options FollowSymLinks
72 AllowOverride None
73 Require all granted
74 </Directory>
75
76 ${if environment == "dev" then ''
77 <Location />
78 Use LDAPConnect
79 Require ldap-group cn=connexionswing.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
80 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://connexionswing.com\"></html>"
81 </Location>
82
83 <Directory ${webRoot}>
84 Options Indexes FollowSymLinks MultiViews Includes
85 AllowOverride None
86 Require all granted
87
88 DirectoryIndex app_dev.php
89
90 <IfModule mod_negotiation.c>
91 Options -MultiViews
92 </IfModule>
93
94 <IfModule mod_rewrite.c>
95 RewriteEngine On
96
97 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
98 RewriteRule ^(.*) - [E=BASE:%1]
99
100 # Maintenance script
101 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
102 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
103 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
104 ErrorDocument 503 /maintenance.php
105
106 # Sets the HTTP_AUTHORIZATION header removed by Apache
107 RewriteCond %{HTTP:Authorization} .
108 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
109
110 RewriteCond %{ENV:REDIRECT_STATUS} ^$
111 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
112
113 # If the requested filename exists, simply serve it.
114 # We only want to let Apache serve files and not directories.
115 RewriteCond %{REQUEST_FILENAME} -f
116 RewriteRule ^ - [L]
117
118 # Rewrite all other queries to the front controller.
119 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]
120 </IfModule>
121
122 </Directory>
123 '' else ''
124 Use Stats connexionswing.com
125
126 <Directory ${webRoot}>
127 Options Indexes FollowSymLinks MultiViews Includes
128 AllowOverride All
129 Require all granted
130 </Directory>
131 ''}
132 '';
133 };
134 activationScript = {
135 deps = [ "wrappers" ];
136 text = ''
137 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
138 ${varDir}/medias \
139 ${varDir}/uploads \
140 ${varDir}/var
141 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
142 if [ ! -f "${varDir}/currentWebappDir" -o \
143 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
144 pushd ${webappDir} > /dev/null
145 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
146 popd > /dev/null
147 echo -n "${webappDir}" > ${varDir}/currentWebappDir
148 fi
149 '';
150 };
151 webappDir = stdenv.mkDerivation (fetchedGitPrivate ./connexionswing.json // rec {
152 # FIXME: can we do better than symlink?
153 # FIXME: imagick optional
154 # FIXME: initial sync
155 # FIXME: backup
156 # FIXME: replace with pkgs.phpPackages.composer
157 buildPhase = ''
158 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
159 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
160
161 ln -sf ../../../../../${varDir}/{medias,uploads} web/images/
162 ln -sf ${configRoot} app/config/parameters.yml
163 sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
164 ${if environment == "dev" then "php bin/composer install" else ''
165 SYMFONY_ENV=prod php bin/composer install --no-dev
166 ./bin/console assetic:dump --env=prod --no-debug
167 ''}
168 rm -rf var
169 ln -sf ../../../../../${varDir}/var var
170 '';
171 installPhase = ''
172 cp -a . $out
173 '';
174 buildInputs = [
175 php git cacert
176 ];
177 });
178 webRoot = "${webappDir}/web";
179 };
180in
181 connexionswing
diff --git a/virtual/modules/websites/connexionswing.nix b/virtual/modules/websites/connexionswing/default.nix
index 9fc0cec..636b16e 100644
--- a/virtual/modules/websites/connexionswing.nix
+++ b/virtual/modules/websites/connexionswing/default.nix
@@ -1,6 +1,6 @@
1{ lib, pkgs, config, mylibs, ... }: 1{ lib, pkgs, config, mylibs, ... }:
2let 2let
3 connexionswing = pkgs.callPackage ../../packages/connexionswing.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; 3 connexionswing = pkgs.callPackage ./connexionswing.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
4 connexionswing_dev = connexionswing { environment = "dev"; }; 4 connexionswing_dev = connexionswing { environment = "dev"; };
5 connexionswing_prod = connexionswing { environment = "prod"; }; 5 connexionswing_prod = connexionswing { environment = "prod"; };
6 6
@@ -15,13 +15,17 @@ in {
15 }; 15 };
16 }; 16 };
17 17
18 imports = [
19 ../commons/stats.nix
20 ];
21
18 config = lib.mkMerge [ 22 config = lib.mkMerge [
19 (lib.mkIf cfg.production.enable { 23 (lib.mkIf cfg.production.enable {
20 services.myWebsites.commons.stats.enable = true; 24 services.myWebsites.commons.stats.enable = true;
21 services.myWebsites.commons.stats.sites = [ 25 services.myWebsites.commons.stats.sites = [
22 { 26 {
23 name = "connexionswing.com"; 27 name = "connexionswing.com";
24 conf = ../../packages/connexionswing_goaccess.conf; 28 conf = ./goaccess.conf;
25 } 29 }
26 ]; 30 ];
27 31
diff --git a/virtual/modules/websites/connexionswing/goaccess.conf b/virtual/modules/websites/connexionswing/goaccess.conf
new file mode 100644
index 0000000..05ad083
--- /dev/null
+++ b/virtual/modules/websites/connexionswing/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/connexionswing.com
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
diff --git a/virtual/modules/websites/ludivine.nix b/virtual/modules/websites/ludivine/default.nix
index b3c1c51..ed719ba 100644
--- a/virtual/modules/websites/ludivine.nix
+++ b/virtual/modules/websites/ludivine/default.nix
@@ -1,6 +1,6 @@
1{ lib, pkgs, config, mylibs, ... }: 1{ lib, pkgs, config, mylibs, ... }:
2let 2let
3 ludivinecassal = pkgs.callPackage ../../packages/ludivinecassal.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; 3 ludivinecassal = pkgs.callPackage ./ludivinecassal.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
4 ludivinecassal_dev = ludivinecassal { environment = "dev"; }; 4 ludivinecassal_dev = ludivinecassal { environment = "dev"; };
5 ludivinecassal_prod = ludivinecassal { environment = "prod"; }; 5 ludivinecassal_prod = ludivinecassal { environment = "prod"; };
6 6
@@ -21,7 +21,7 @@ in {
21 services.myWebsites.commons.stats.sites = [ 21 services.myWebsites.commons.stats.sites = [
22 { 22 {
23 name = "ludivinecassal.com"; 23 name = "ludivinecassal.com";
24 conf = ../../packages/ludivinecassal_goaccess.conf; 24 conf = ./goaccess.conf;
25 } 25 }
26 ]; 26 ];
27 27
diff --git a/virtual/modules/websites/ludivine/goaccess.conf b/virtual/modules/websites/ludivine/goaccess.conf
new file mode 100644
index 0000000..25e5f63
--- /dev/null
+++ b/virtual/modules/websites/ludivine/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/ludivinecassal.com
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
diff --git a/virtual/modules/websites/ludivine/ludivinecassal.json b/virtual/modules/websites/ludivine/ludivinecassal.json
new file mode 100644
index 0000000..89667c0
--- /dev/null
+++ b/virtual/modules/websites/ludivine/ludivinecassal.json
@@ -0,0 +1,14 @@
1{
2 "tag": "4327b82-master",
3 "meta": {
4 "name": "ludivinecassal",
5 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Ludivine",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Ludivine",
10 "rev": "4327b82ec00cc514bfce5aa7155bcdbcc871c065",
11 "sha256": "1c5hnzvyvj45j61v2v5mh1l405ih74f58isr9dq21428kcfc2gyd",
12 "fetchSubmodules": true
13 }
14}
diff --git a/virtual/modules/websites/ludivine/ludivinecassal.nix b/virtual/modules/websites/ludivine/ludivinecassal.nix
new file mode 100644
index 0000000..ac63735
--- /dev/null
+++ b/virtual/modules/websites/ludivine/ludivinecassal.nix
@@ -0,0 +1,181 @@
1{ lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, ruby, sass, imagemagick }:
2let
3 ludivinecassal = { environment ? "dev" }: rec {
4 varPrefix = "LUDIVINECASSAL";
5 varDir = "/var/lib/ludivinecassal_${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 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD";
13 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH_DN";
14 assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH_FILTER";
15 writeText "parameters.yml" ''
16 # This file is auto-generated during the composer install
17 parameters:
18 database_host: db-1.immae.eu
19 database_port: null
20 database_name: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_NAME"}
21 database_user: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"}
22 database_password: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"}
23 mailer_transport: smtp
24 mailer_host: mail.immae.eu
25 mailer_user: null
26 mailer_password: null
27 secret: ${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"}
28 ldap_host: ldap.immae.eu
29 ldap_port: 636
30 ldap_version: 3
31 ldap_ssl: true
32 ldap_tls: false
33 ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu'
34 ldap_base_dn: 'dc=immae,dc=eu'
35 ldap_search_dn: '${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH_DN"}'
36 ldap_search_password: '${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD"}'
37 ldap_search_filter: '${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH_FILTER"}'
38 leapt_im:
39 binary_path: ${imagemagick}/bin
40 assetic:
41 sass: ${sass}/bin/sass
42 ruby: ${ruby}/bin/ruby
43 '';
44 phpFpm = rec {
45 socket = "/var/run/phpfpm/ludivinecassal-${environment}.sock";
46 pool = ''
47 listen = ${socket}
48 user = ${apache.user}
49 group = ${apache.group}
50 listen.owner = ${apache.user}
51 listen.group = ${apache.group}
52 php_admin_value[upload_max_filesize] = 20M
53 php_admin_value[post_max_size] = 20M
54 ;php_admin_flag[log_errors] = on
55 php_admin_value[open_basedir] = "${configRoot}:${webappDir}:${varDir}:/tmp"
56 php_admin_value[session.save_path] = "${varDir}/phpSessions"
57 ${if environment == "dev" then ''
58 pm = ondemand
59 pm.max_children = 5
60 pm.process_idle_timeout = 60
61 env[SYMFONY_DEBUG_MODE] = "yes"
62 '' else ''
63 pm = dynamic
64 pm.max_children = 20
65 pm.start_servers = 2
66 pm.min_spare_servers = 1
67 pm.max_spare_servers = 3
68 ''}'';
69 };
70 apache = {
71 user = "wwwrun";
72 group = "wwwrun";
73 modules = [ "proxy_fcgi" ];
74 vhostConf = ''
75 <FilesMatch "\.php$">
76 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
77 </FilesMatch>
78
79 ${if environment == "dev" then ''
80 <Location />
81 Use LDAPConnect
82 Require ldap-group cn=ludivine.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
83 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
84 </Location>
85
86 <Directory ${webRoot}>
87 Options Indexes FollowSymLinks MultiViews Includes
88 AllowOverride None
89 Require all granted
90
91 DirectoryIndex app_dev.php
92
93 <IfModule mod_negotiation.c>
94 Options -MultiViews
95 </IfModule>
96
97 <IfModule mod_rewrite.c>
98 RewriteEngine On
99
100 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
101 RewriteRule ^(.*) - [E=BASE:%1]
102
103 # Maintenance script
104 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
105 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
106 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
107 ErrorDocument 503 /maintenance.php
108
109 # Sets the HTTP_AUTHORIZATION header removed by Apache
110 RewriteCond %{HTTP:Authorization} .
111 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
112
113 RewriteCond %{ENV:REDIRECT_STATUS} ^$
114 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
115
116 # If the requested filename exists, simply serve it.
117 # We only want to let Apache serve files and not directories.
118 RewriteCond %{REQUEST_FILENAME} -f
119 RewriteRule ^ - [L]
120
121 # Rewrite all other queries to the front controller.
122 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]
123 </IfModule>
124
125 </Directory>
126 '' else ''
127 Use Stats ludivinecassal.com
128
129 <Directory ${webRoot}>
130 Options Indexes FollowSymLinks MultiViews Includes
131 AllowOverride All
132 Require all granted
133 </Directory>
134 ''}
135 '';
136 };
137 activationScript = {
138 deps = [ "wrappers" ];
139 text = ''
140 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}
141 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
142 if [ ! -f "${varDir}/currentWebappDir" -o \
143 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
144 pushd ${webappDir} > /dev/null
145 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
146 popd > /dev/null
147 echo -n "${webappDir}" > ${varDir}/currentWebappDir
148 fi
149 '';
150 };
151 webappDir = stdenv.mkDerivation (fetchedGitPrivate ./ludivinecassal.json // rec {
152 # FIXME: can we do better than symlink?
153 # FIXME: initial sync
154 # FIXME: backup
155 # FIXME: miniatures and data need to be in the same dir due to a
156 # bug in leapt.im (searches for data/../miniatures)
157 buildPhase = ''
158 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
159 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
160
161 ln -sf ${configRoot} app/config/parameters.yml
162 sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
163 ${if environment == "dev" then ''
164 composer install
165 '' else ''
166 SYMFONY_ENV=prod composer install --no-dev
167 ''}
168 rm -rf var
169 ln -sf ../../../../../${varDir} var
170 '';
171 installPhase = ''
172 cp -a . $out
173 '';
174 buildInputs = [
175 php git cacert phpPackages.composer sass
176 ];
177 });
178 webRoot = "${webappDir}/web";
179 };
180in
181 ludivinecassal
diff --git a/virtual/modules/websites/piedsjaloux.nix b/virtual/modules/websites/piedsjaloux/default.nix
index 451ae52..bf74173 100644
--- a/virtual/modules/websites/piedsjaloux.nix
+++ b/virtual/modules/websites/piedsjaloux/default.nix
@@ -1,6 +1,6 @@
1{ lib, pkgs, config, mylibs, ... }: 1{ lib, pkgs, config, mylibs, ... }:
2let 2let
3 piedsjaloux = pkgs.callPackage ../../packages/piedsjaloux.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; 3 piedsjaloux = pkgs.callPackage ./piedsjaloux.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
4 piedsjaloux_dev = piedsjaloux { environment = "dev"; }; 4 piedsjaloux_dev = piedsjaloux { environment = "dev"; };
5 piedsjaloux_prod = piedsjaloux { environment = "prod"; }; 5 piedsjaloux_prod = piedsjaloux { environment = "prod"; };
6 6
@@ -16,7 +16,7 @@ in {
16 }; 16 };
17 17
18 imports = [ 18 imports = [
19 ./commons/stats.nix 19 ../commons/stats.nix
20 ]; 20 ];
21 21
22 config = lib.mkMerge [ 22 config = lib.mkMerge [
@@ -25,7 +25,7 @@ in {
25 services.myWebsites.commons.stats.sites = [ 25 services.myWebsites.commons.stats.sites = [
26 { 26 {
27 name = "piedsjaloux.fr"; 27 name = "piedsjaloux.fr";
28 conf = ../../packages/piedsjaloux_goaccess.conf; 28 conf = ./goaccess.conf;
29 } 29 }
30 ]; 30 ];
31 31
diff --git a/virtual/modules/websites/piedsjaloux/goaccess.conf b/virtual/modules/websites/piedsjaloux/goaccess.conf
new file mode 100644
index 0000000..3950f7e
--- /dev/null
+++ b/virtual/modules/websites/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
diff --git a/virtual/modules/websites/piedsjaloux/piedsjaloux.json b/virtual/modules/websites/piedsjaloux/piedsjaloux.json
new file mode 100644
index 0000000..c4aae16
--- /dev/null
+++ b/virtual/modules/websites/piedsjaloux/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/modules/websites/piedsjaloux/piedsjaloux.nix b/virtual/modules/websites/piedsjaloux/piedsjaloux.nix
new file mode 100644
index 0000000..1c3d8b7
--- /dev/null
+++ b/virtual/modules/websites/piedsjaloux/piedsjaloux.nix
@@ -0,0 +1,171 @@
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 php_admin_value[session.save_path] = "${varDir}/phpSessions"
42 ${if environment == "dev" then ''
43 pm = ondemand
44 pm.max_children = 5
45 pm.process_idle_timeout = 60
46 env[SYMFONY_DEBUG_MODE] = "yes"
47 '' else ''
48 pm = dynamic
49 pm.max_children = 20
50 pm.start_servers = 2
51 pm.min_spare_servers = 1
52 pm.max_spare_servers = 3
53 ''}'';
54 };
55 apache = {
56 user = "wwwrun";
57 group = "wwwrun";
58 modules = [ "proxy_fcgi" ];
59 vhostConf = ''
60 <FilesMatch "\.php$">
61 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
62 </FilesMatch>
63
64 ${if environment == "dev" then ''
65 <Location />
66 Use LDAPConnect
67 Require ldap-group cn=piedsjaloux.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
68 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
69 </Location>
70
71 <Directory ${webRoot}>
72 Options Indexes FollowSymLinks MultiViews Includes
73 AllowOverride None
74 Require all granted
75
76 DirectoryIndex app_dev.php
77
78 <IfModule mod_negotiation.c>
79 Options -MultiViews
80 </IfModule>
81
82 <IfModule mod_rewrite.c>
83 RewriteEngine On
84
85 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
86 RewriteRule ^(.*) - [E=BASE:%1]
87
88 # Maintenance script
89 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
90 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
91 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
92 ErrorDocument 503 /maintenance.php
93
94 # Sets the HTTP_AUTHORIZATION header removed by Apache
95 RewriteCond %{HTTP:Authorization} .
96 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
97
98 RewriteCond %{ENV:REDIRECT_STATUS} ^$
99 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
100
101 # If the requested filename exists, simply serve it.
102 # We only want to let Apache serve files and not directories.
103 RewriteCond %{REQUEST_FILENAME} -f
104 RewriteRule ^ - [L]
105
106 # Rewrite all other queries to the front controller.
107 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]
108 </IfModule>
109
110 </Directory>
111 '' else ''
112 Use Stats piedsjaloux.fr
113
114 <Directory ${webRoot}>
115 Options Indexes FollowSymLinks MultiViews Includes
116 AllowOverride All
117 Require all granted
118 </Directory>
119 ''}
120 '';
121 };
122 activationScript = {
123 deps = [ "wrappers" ];
124 text = ''
125 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
126 ${varDir}/tmp
127 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
128 if [ ! -f "${varDir}/currentWebappDir" -o \
129 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
130 pushd ${webappDir} > /dev/null
131 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
132 popd > /dev/null
133 echo -n "${webappDir}" > ${varDir}/currentWebappDir
134 fi
135 '';
136 };
137 webappDir = stdenv.mkDerivation (fetchedGitPrivate ./piedsjaloux.json // rec {
138 # FIXME: can we do better than symlink?
139 # FIXME: initial sync
140 # FIXME: backup
141 # FIXME: miniatures and data need to be in the same dir due to a
142 # bug in leapt.im (searches for data/../miniatures)
143 # FIXME: var/bootstrap.php.cache doesn't get created
144 # (cannot work with var as a symlink since the file
145 # references ..)
146 # FIXME: configuration change should not trigger a rebuild
147 buildPhase = ''
148 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
149 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
150
151 ln -sf ${configRoot} app/config/parameters.yml
152 sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
153 ${if environment == "dev" then ''
154 composer install
155 '' else ''
156 SYMFONY_ENV=prod composer install --no-dev
157 ''}
158 rm -rf var
159 ln -sf ../../../../../${varDir} var
160 '';
161 installPhase = ''
162 cp -a . $out
163 '';
164 buildInputs = [
165 php git cacert phpPackages.composer
166 ];
167 });
168 webRoot = "${webappDir}/web";
169 };
170in
171 piedsjaloux