aboutsummaryrefslogtreecommitdiff
path: root/virtual/packages
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 /virtual/packages
parent2f2b578bee0ab204a2e626ec9f7ca5c290634456 (diff)
downloadNix-34e2fd14c7091f85b667667cb2b74c1b75e005db.tar.gz
Nix-34e2fd14c7091f85b667667cb2b74c1b75e005db.tar.zst
Nix-34e2fd14c7091f85b667667cb2b74c1b75e005db.zip
Add piedsjaloux website
Diffstat (limited to 'virtual/packages')
-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
5 files changed, 286 insertions, 4 deletions
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