aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-29 08:33:53 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-29 08:34:48 +0100
commitd578d27021abba83de60143611230c692da46521 (patch)
tree87479b7ca9cc376d6aa3e32884b60afee6c6c7f1 /nixops/modules/websites
parent439049e58f9638eefaf1648b1898fdb1d964d97e (diff)
downloadNix-d578d27021abba83de60143611230c692da46521.tar.gz
Nix-d578d27021abba83de60143611230c692da46521.tar.zst
Nix-d578d27021abba83de60143611230c692da46521.zip
Add Jerome's ftp website
Related issue: https://git.immae.eu/mantisbt/view.php?id=77
Diffstat (limited to 'nixops/modules/websites')
-rw-r--r--nixops/modules/websites/default.nix2
-rw-r--r--nixops/modules/websites/ftp/jerome.nix96
-rw-r--r--nixops/modules/websites/ftp/jerome_goaccess.conf99
3 files changed, 197 insertions, 0 deletions
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix
index 4d5ae23..9befdd1 100644
--- a/nixops/modules/websites/default.nix
+++ b/nixops/modules/websites/default.nix
@@ -91,6 +91,7 @@ in
91 ./piedsjaloux 91 ./piedsjaloux
92 ./connexionswing 92 ./connexionswing
93 ./tellesflorian 93 ./tellesflorian
94 ./ftp/jerome.nix
94 ./tools/db 95 ./tools/db
95 ./tools/tools 96 ./tools/tools
96 ./tools/dav 97 ./tools/dav
@@ -187,6 +188,7 @@ in
187 services.myWebsites.Aten.production.enable = cfg.production.enable; 188 services.myWebsites.Aten.production.enable = cfg.production.enable;
188 services.myWebsites.PiedsJaloux.production.enable = cfg.production.enable; 189 services.myWebsites.PiedsJaloux.production.enable = cfg.production.enable;
189 services.myWebsites.Connexionswing.production.enable = cfg.production.enable; 190 services.myWebsites.Connexionswing.production.enable = cfg.production.enable;
191 services.myWebsites.Jerome.production.enable = cfg.production.enable;
190 192
191 services.myWebsites.Chloe.integration.enable = cfg.integration.enable; 193 services.myWebsites.Chloe.integration.enable = cfg.integration.enable;
192 services.myWebsites.Ludivine.integration.enable = cfg.integration.enable; 194 services.myWebsites.Ludivine.integration.enable = cfg.integration.enable;
diff --git a/nixops/modules/websites/ftp/jerome.nix b/nixops/modules/websites/ftp/jerome.nix
new file mode 100644
index 0000000..199bfab
--- /dev/null
+++ b/nixops/modules/websites/ftp/jerome.nix
@@ -0,0 +1,96 @@
1{ lib, pkgs, config, myconfig, mylibs, ... }:
2let
3 adminer = pkgs.callPackage ../commons/adminer.nix {};
4 cfg = config.services.myWebsites.Jerome;
5 varDir = "/var/lib/ftp/jerome";
6 env = myconfig.env.websites.jerome;
7in {
8 options.services.myWebsites.Jerome = {
9 production = {
10 enable = lib.mkEnableOption "enable Jerome's website";
11 };
12 };
13
14 imports = [
15 ../commons/stats.nix
16 ];
17
18 config = lib.mkIf cfg.production.enable {
19 services.myWebsites.commons.stats.enable = true;
20 services.myWebsites.commons.stats.sites = [
21 {
22 name = "naturaloutil.immae.eu";
23 conf = ./jerome_goaccess.conf;
24 }
25 ];
26
27 security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null;
28 security.acme.certs."naturaloutil" = config.services.myCertificates.certConfig // {
29 domain = "naturaloutil.immae.eu";
30 };
31
32 services.myPhpfpm.poolConfigs.jerome = let
33 configFile = pkgs.writeText "naturaloutil.inc.php" ''
34 <?php
35 $mysql_user = '${env.mysql.user}' ;
36 $mysql_server = '${env.mysql.host}' ;
37 $mysql_base = '${env.mysql.name}' ;
38 $mysql_password = '${env.mysql.password}' ;
39 //connect to db
40 $db = mysqli_init();
41 ${if env.mysql.host != "localhost" then ''
42 mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
43 $db->ssl_set(NULL, NULL, "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt", NULL, NULL);
44 '' else ""}
45 $database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password);
46 ?>
47 '';
48 in ''
49 listen = /run/phpfpm/naturaloutil.sock
50 user = wwwrun
51 group = wwwrun
52 listen.owner = wwwrun
53 listen.group = wwwrun
54
55 pm = ondemand
56 pm.max_children = 5
57 pm.process_idle_timeout = 60
58
59 env[BDD_CONNECT] = "${configFile}"
60 php_admin_value[open_basedir] = "${configFile}:${varDir}:/tmp"
61 '';
62 services.myPhpfpm.poolPhpConfigs.jerome = ''
63 extension=${pkgs.php}/lib/php/extensions/mysqli.so
64 '';
65 services.myWebsites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ];
66 services.myWebsites.production.vhostConfs.naturaloutil = {
67 certName = "naturaloutil";
68 hosts = ["naturaloutil.immae.eu" ];
69 root = varDir;
70 extraConfig = [
71 adminer.apache.vhostConf
72 ''
73 Use Stats naturaloutil.immae.eu
74 ServerAdmin ${env.server_admin}
75 ErrorLog "${varDir}/logs/error_log"
76 CustomLog "${varDir}/logs/access_log" combined
77
78 <FilesMatch "\.php$">
79 SetHandler "proxy:unix:/run/phpfpm/naturaloutil.sock|fcgi://localhost"
80 </FilesMatch>
81
82 <Directory ${varDir}/logs>
83 AllowOverride None
84 Require all denied
85 </Directory>
86 <Directory ${varDir}>
87 DirectoryIndex index.php index.htm index.html
88 Options Indexes FollowSymLinks MultiViews Includes
89 AllowOverride None
90 Require all granted
91 </Directory>
92 ''
93 ];
94 };
95 };
96}
diff --git a/nixops/modules/websites/ftp/jerome_goaccess.conf b/nixops/modules/websites/ftp/jerome_goaccess.conf
new file mode 100644
index 0000000..83c59e2
--- /dev/null
+++ b/nixops/modules/websites/ftp/jerome_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/naturaloutil.immae.eu
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