diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-12-24 08:26:39 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-12-24 08:26:39 +0100 |
commit | 91b75ffe45f2a5d7e148c92f53a4ba90ede8df77 (patch) | |
tree | 0952edf96a444857a617cfc416f051cf483c944c /modules/private/websites | |
parent | 9338c8325026fcba24c3214ced611c4993e7b8fe (diff) | |
download | Nix-91b75ffe45f2a5d7e148c92f53a4ba90ede8df77.tar.gz Nix-91b75ffe45f2a5d7e148c92f53a4ba90ede8df77.tar.zst Nix-91b75ffe45f2a5d7e148c92f53a4ba90ede8df77.zip |
Add Richie website
Diffstat (limited to 'modules/private/websites')
-rw-r--r-- | modules/private/websites/default.nix | 1 | ||||
-rw-r--r-- | modules/private/websites/emilia/richie.json | 14 | ||||
-rw-r--r-- | modules/private/websites/emilia/richie.nix | 101 |
3 files changed, 116 insertions, 0 deletions
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index 16f02a7..3ac4cb5 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix | |||
@@ -238,6 +238,7 @@ in | |||
238 | denisejerome.production.enable = true; | 238 | denisejerome.production.enable = true; |
239 | 239 | ||
240 | emilia.production.enable = true; | 240 | emilia.production.enable = true; |
241 | emilia.richie_production.enable = true; | ||
241 | 242 | ||
242 | florian.app.enable = true; | 243 | florian.app.enable = true; |
243 | florian.integration.enable = true; | 244 | florian.integration.enable = true; |
diff --git a/modules/private/websites/emilia/richie.json b/modules/private/websites/emilia/richie.json new file mode 100644 index 0000000..63aab6e --- /dev/null +++ b/modules/private/websites/emilia/richie.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "tag": "3e7b523-master", | ||
3 | "meta": { | ||
4 | "name": "richie", | ||
5 | "url": "ssh://gitolite@git.immae.eu/perso/Immae/Sites/Richie", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "git": { | ||
9 | "url": "ssh://gitolite@git.immae.eu/perso/Immae/Sites/Richie", | ||
10 | "rev": "3e7b523dd1b47da10ec3c5b1b61df4034397a7b9", | ||
11 | "sha256": "04922nwprx6l0jn11mfcaxsfsxa96lq7dm170lk6q25fqr0ipa67", | ||
12 | "fetchSubmodules": true | ||
13 | } | ||
14 | } | ||
diff --git a/modules/private/websites/emilia/richie.nix b/modules/private/websites/emilia/richie.nix new file mode 100644 index 0000000..f7b4f8d --- /dev/null +++ b/modules/private/websites/emilia/richie.nix | |||
@@ -0,0 +1,101 @@ | |||
1 | { lib, config, pkgs, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.emilia.richie_production; | ||
4 | vardir = "/var/lib/richie_production"; | ||
5 | richieSrc = pkgs.stdenv.mkDerivation (pkgs.mylibs.fetchedGitPrivate ./richie.json // { | ||
6 | phases = "installPhase"; | ||
7 | installPhase = '' | ||
8 | cp -a $src $out | ||
9 | chmod -R u+w $out | ||
10 | ln -sf ${vardir}/files $out/ | ||
11 | ln -sf ${vardir}/drapeaux $out/images/ | ||
12 | ln -sf ${vardir}/photos $out/ | ||
13 | sed -i "s@localedef --list-archive@localedef --list-archive /run/current-system/sw/lib/locale/locale-archive@" $out/admin/parametres.php | ||
14 | ''; | ||
15 | }); | ||
16 | in | ||
17 | { | ||
18 | options.myServices.websites.emilia.richie_production.enable = lib.mkEnableOption "enable Richie's website"; | ||
19 | config = lib.mkIf cfg.enable { | ||
20 | services.duplyBackup.profiles.richie_production.rootDir = vardir; | ||
21 | services.webstats.sites = [ { name = "europe-richie.org"; } ]; | ||
22 | |||
23 | secrets.keys = [{ | ||
24 | dest = "webapps/prod-richie"; | ||
25 | user = "wwwrun"; | ||
26 | group = "wwwrun"; | ||
27 | permissions = "0400"; | ||
28 | text = with config.myEnv.websites.richie; '' | ||
29 | <?php | ||
30 | |||
31 | $hote_sql = '${mysql.host}'; | ||
32 | $login_sql = '${mysql.user}'; | ||
33 | $bdd_sql = '${mysql.database}'; | ||
34 | $mdp_sql = '${mysql.password}'; | ||
35 | |||
36 | $db = mysqli_connect($hote_sql,$login_sql,$mdp_sql); | ||
37 | unset($mdp_sql); | ||
38 | |||
39 | $smtp_mailer->Auth('${smtp_mailer.user}', '${smtp_mailer.password}'); | ||
40 | ?> | ||
41 | ''; | ||
42 | }]; | ||
43 | myServices.websites.webappDirs.richie_production = richieSrc; | ||
44 | system.activationScripts.richie_production = { | ||
45 | deps = [ "httpd" ]; | ||
46 | text = '' | ||
47 | install -m 0755 -o wwwrun -g wwwrun -d /var/lib/php/sessions/richie_production | ||
48 | install -m 0755 -o wwwrun -g wwwrun -d ${vardir} | ||
49 | ''; | ||
50 | }; | ||
51 | services.phpfpm.pools.richie_production = { | ||
52 | listen = "/run/phpfpm/richie_production.sock"; | ||
53 | extraConfig = '' | ||
54 | user = wwwrun | ||
55 | group = wwwrun | ||
56 | listen.owner = wwwrun | ||
57 | listen.group = wwwrun | ||
58 | |||
59 | pm = ondemand | ||
60 | pm.max_children = 5 | ||
61 | pm.process_idle_timeout = 60 | ||
62 | |||
63 | env[PATH] = /run/current-system/sw/bin:${lib.makeBinPath [ pkgs.imagemagick ]} | ||
64 | env[BDD_CONNECT] = "/var/secrets/webapps/prod-richie" | ||
65 | php_admin_value[open_basedir] = "${vardir}:/var/lib/php/sessions/richie_production:/var/secrets/webapps/prod-richie:${richieSrc}:/tmp" | ||
66 | php_admin_value[session.save_path] = "/var/lib/php/sessions/richie_production" | ||
67 | ''; | ||
68 | phpOptions = config.services.phpfpm.phpOptions + '' | ||
69 | date.timezone = 'Europe/Paris' | ||
70 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | ||
71 | ''; | ||
72 | }; | ||
73 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | ||
74 | services.websites.env.production.vhostConfs.richie_production = { | ||
75 | certName = "richie"; | ||
76 | addToCerts = true; | ||
77 | certMainHost = "europe-richie.org"; | ||
78 | hosts = [ "europe-richie.org" "www.europe-richie.org" ]; | ||
79 | root = "/run/current-system/webapps/richie_production"; | ||
80 | extraConfig = [ | ||
81 | '' | ||
82 | Use Stats europe-richie.org | ||
83 | ErrorDocument 404 /404.html | ||
84 | <LocationMatch "^/files/.*/admin/"> | ||
85 | Require all denied | ||
86 | </LocationMatch> | ||
87 | <Directory /run/current-system/webapps/richie_production> | ||
88 | DirectoryIndex index.php index.htm index.html | ||
89 | Options Indexes FollowSymLinks MultiViews Includes | ||
90 | AllowOverride None | ||
91 | Require all granted | ||
92 | |||
93 | <FilesMatch "\.php$"> | ||
94 | SetHandler "proxy:unix:/run/phpfpm/richie_production.sock|fcgi://localhost" | ||
95 | </FilesMatch> | ||
96 | </Directory> | ||
97 | '' | ||
98 | ]; | ||
99 | }; | ||
100 | }; | ||
101 | } | ||