aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/isabelle
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-12-24 13:59:54 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-12-24 13:59:54 +0100
commit829ef7f1cb79f0171f9c5254278d93c48c44a7b5 (patch)
treebf3d387409046dd0a5bb100b08e1c5eefb27344f /modules/private/websites/isabelle
parent9a414bd66ff06cade504ac34f13dbeddac48150a (diff)
downloadNix-829ef7f1cb79f0171f9c5254278d93c48c44a7b5.tar.gz
Nix-829ef7f1cb79f0171f9c5254278d93c48c44a7b5.tar.zst
Nix-829ef7f1cb79f0171f9c5254278d93c48c44a7b5.zip
Add iridologie website
Diffstat (limited to 'modules/private/websites/isabelle')
-rw-r--r--modules/private/websites/isabelle/aten_integration.nix89
-rw-r--r--modules/private/websites/isabelle/aten_production.nix87
-rw-r--r--modules/private/websites/isabelle/iridologie.nix31
3 files changed, 207 insertions, 0 deletions
diff --git a/modules/private/websites/isabelle/aten_integration.nix b/modules/private/websites/isabelle/aten_integration.nix
new file mode 100644
index 0000000..c8ca03f
--- /dev/null
+++ b/modules/private/websites/isabelle/aten_integration.nix
@@ -0,0 +1,89 @@
1{ lib, pkgs, config, ... }:
2let
3 secrets = config.myEnv.websites.isabelle.aten_integration;
4 app = pkgs.webapps.aten.override { environment = secrets.environment; };
5 cfg = config.myServices.websites.isabelle.aten_integration;
6 pcfg = config.services.phpApplication;
7in {
8 options.myServices.websites.isabelle.aten_integration.enable = lib.mkEnableOption "enable Aten's website in integration";
9
10 config = lib.mkIf cfg.enable {
11 services.duplyBackup.profiles.aten_dev.rootDir = app.varDir;
12 services.phpApplication.apps.aten_dev = {
13 websiteEnv = "integration";
14 httpdUser = config.services.httpd.Inte.user;
15 httpdGroup = config.services.httpd.Inte.group;
16 httpdWatchFiles = [
17 config.secrets.fullPaths."webapps/${app.environment}-aten"
18 ];
19 inherit (app) webRoot varDir;
20 inherit app;
21 serviceDeps = [ "postgresql.service" ];
22 preStartActions = [
23 "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
24 ];
25 phpOpenbasedir = [ "/tmp" ];
26 phpPool = ''
27 php_admin_value[upload_max_filesize] = 20M
28 php_admin_value[post_max_size] = 20M
29 ;php_admin_flag[log_errors] = on
30 pm = ondemand
31 pm.max_children = 5
32 pm.process_idle_timeout = 60
33 env[SYMFONY_DEBUG_MODE] = "yes"
34 '';
35 };
36
37 secrets.keys = [{
38 dest = "webapps/${app.environment}-aten";
39 user = config.services.httpd.Inte.user;
40 group = config.services.httpd.Inte.group;
41 permissions = "0400";
42 text = let
43 # cf:
44 # https://secure.php.net/manual/fr/function.parse-url.php
45 # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
46 psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
47 in ''
48 SetEnv APP_ENV "${app.environment}"
49 SetEnv APP_SECRET "${secrets.secret}"
50 SetEnv DATABASE_URL "${psql_url}"
51 '';
52 }];
53 services.websites.env.integration.vhostConfs.aten_dev = {
54 certName = "eldiron";
55 addToCerts = true;
56 hosts = [ "dev.aten.pro" ];
57 root = pcfg.webappDirs.aten_dev;
58 extraConfig = [
59 ''
60 <FilesMatch "\.php$">
61 SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost"
62 </FilesMatch>
63
64 Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"}
65
66 <Location />
67 Use LDAPConnect
68 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
69 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
70 </Location>
71
72 <Location /backend>
73 Use LDAPConnect
74 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
75 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
76 </Location>
77
78 <Directory ${pcfg.webappDirs.aten_dev}>
79 Options Indexes FollowSymLinks MultiViews Includes
80 AllowOverride All
81 Require all granted
82 DirectoryIndex index.php
83 FallbackResource /index.php
84 </Directory>
85 ''
86 ];
87 };
88 };
89}
diff --git a/modules/private/websites/isabelle/aten_production.nix b/modules/private/websites/isabelle/aten_production.nix
new file mode 100644
index 0000000..8e33f0f
--- /dev/null
+++ b/modules/private/websites/isabelle/aten_production.nix
@@ -0,0 +1,87 @@
1{ lib, pkgs, config, ... }:
2let
3 secrets = config.myEnv.websites.isabelle.aten_production;
4 app = pkgs.webapps.aten.override { environment = secrets.environment; };
5 cfg = config.myServices.websites.isabelle.aten_production;
6 pcfg = config.services.phpApplication;
7in {
8 options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production";
9
10 config = lib.mkIf cfg.enable {
11 services.duplyBackup.profiles.aten_prod.rootDir = app.varDir;
12 services.webstats.sites = [ { name = "aten.pro"; } ];
13 services.phpApplication.apps.aten_prod = {
14 websiteEnv = "production";
15 httpdUser = config.services.httpd.Prod.user;
16 httpdGroup = config.services.httpd.Prod.group;
17 httpdWatchFiles = [
18 config.secrets.fullPaths."webapps/${app.environment}-aten"
19 ];
20 inherit (app) webRoot varDir;
21 inherit app;
22 serviceDeps = [ "postgresql.service" ];
23 preStartActions = [
24 "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
25 ];
26 phpOpenbasedir = [ "/tmp" ];
27 phpPool = ''
28 php_admin_value[upload_max_filesize] = 20M
29 php_admin_value[post_max_size] = 20M
30 ;php_admin_flag[log_errors] = on
31 pm = dynamic
32 pm.max_children = 20
33 pm.start_servers = 2
34 pm.min_spare_servers = 1
35 pm.max_spare_servers = 3
36 '';
37 };
38
39 secrets.keys = [{
40 dest = "webapps/${app.environment}-aten";
41 user = config.services.httpd.Prod.user;
42 group = config.services.httpd.Prod.group;
43 permissions = "0400";
44 text = let
45 # cf:
46 # https://secure.php.net/manual/fr/function.parse-url.php
47 # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
48 psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
49 in ''
50 SetEnv APP_ENV "${app.environment}"
51 SetEnv APP_SECRET "${secrets.secret}"
52 SetEnv DATABASE_URL "${psql_url}"
53 '';
54 }];
55 services.websites.env.production.vhostConfs.aten_prod = {
56 certName = "aten";
57 certMainHost = "aten.pro";
58 hosts = [ "aten.pro" "www.aten.pro" ];
59 root = pcfg.webappDirs.aten_prod;
60 extraConfig = [
61 ''
62 <FilesMatch "\.php$">
63 SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_prod}|fcgi://localhost"
64 </FilesMatch>
65
66 Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"}
67
68 Use Stats aten.pro
69
70 <Location /backend>
71 Use LDAPConnect
72 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
73 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
74 </Location>
75
76 <Directory ${pcfg.webappDirs.aten_prod}>
77 Options Indexes FollowSymLinks MultiViews Includes
78 AllowOverride All
79 Require all granted
80 DirectoryIndex index.php
81 FallbackResource /index.php
82 </Directory>
83 ''
84 ];
85 };
86 };
87}
diff --git a/modules/private/websites/isabelle/iridologie.nix b/modules/private/websites/isabelle/iridologie.nix
new file mode 100644
index 0000000..88f8b03
--- /dev/null
+++ b/modules/private/websites/isabelle/iridologie.nix
@@ -0,0 +1,31 @@
1{ lib, config, ... }:
2let
3 cfg = config.myServices.websites.isabelle.iridologie;
4 varDir = "/var/lib/ftp/isabelle";
5in {
6 options.myServices.websites.isabelle.iridologie.enable = lib.mkEnableOption "enable Iridologie's website";
7
8 config = lib.mkIf cfg.enable {
9 services.webstats.sites = [ { name = "iridologie.icommandeur.org"; } ];
10 services.websites.env.production.vhostConfs.iridologie = {
11 certName = "aten";
12 hosts = [ "icommandeur.org" "www.icommandeur.org" "iridologie.icommandeur.org" ];
13 root = varDir;
14 extraConfig = [
15 ''
16 Use Stats iridologie.icommandeur.org
17 RewriteEngine On
18 RewriteCond "%{HTTP_HOST}" "!^iridologie\.icommandeur\.org$" [NC]
19 RewriteRule ^(.+)$ https://iridologie.icommandeur.org$1 [R=302,L]
20
21 <Directory ${varDir}>
22 DirectoryIndex index.html
23 AllowOverride None
24 Require all granted
25 </Directory>
26 ''
27 ];
28 };
29 };
30}
31