From 829ef7f1cb79f0171f9c5254278d93c48c44a7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 24 Dec 2019 13:59:54 +0100 Subject: Add iridologie website --- modules/private/default.nix | 5 +- modules/private/environment.nix | 8 +- modules/private/websites/aten/integration.nix | 89 ---------------------- modules/private/websites/aten/production.nix | 87 --------------------- modules/private/websites/default.nix | 5 +- .../private/websites/isabelle/aten_integration.nix | 89 ++++++++++++++++++++++ .../private/websites/isabelle/aten_production.nix | 87 +++++++++++++++++++++ modules/private/websites/isabelle/iridologie.nix | 31 ++++++++ 8 files changed, 217 insertions(+), 184 deletions(-) delete mode 100644 modules/private/websites/aten/integration.nix delete mode 100644 modules/private/websites/aten/production.nix create mode 100644 modules/private/websites/isabelle/aten_integration.nix create mode 100644 modules/private/websites/isabelle/aten_production.nix create mode 100644 modules/private/websites/isabelle/iridologie.nix (limited to 'modules/private') diff --git a/modules/private/default.nix b/modules/private/default.nix index be39993..30b9df6 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix @@ -16,8 +16,9 @@ set = { openldapReplication = ./databases/openldap_replication.nix; websites = ./websites; - atenInte = ./websites/aten/integration.nix; - atenProd = ./websites/aten/production.nix; + isabelleAtenInte = ./websites/isabelle/aten_integration.nix; + isabelleAtenProd = ./websites/isabelle/aten_production.nix; + isabelleIridologie = ./websites/isabelle/iridologie.nix; capitainesProd = ./websites/capitaines/production.nix; chloeInte = ./websites/chloe/integration.nix; chloeProd = ./websites/chloe/production.nix; diff --git a/modules/private/environment.nix b/modules/private/environment.nix index f0e39e9..15e8f54 100644 --- a/modules/private/environment.nix +++ b/modules/private/environment.nix @@ -951,8 +951,8 @@ in description = "Websites configurations"; type = submodule { options = { - aten = mkOption { - description = "Aten configurations by environment"; + isabelle = mkOption { + description = "Isabelle configurations by environment"; type = let atenSubmodule = mkOption { @@ -968,8 +968,8 @@ in in submodule { options = { - production = atenSubmodule; - integration = atenSubmodule; + aten_production = atenSubmodule; + aten_integration = atenSubmodule; }; }; }; diff --git a/modules/private/websites/aten/integration.nix b/modules/private/websites/aten/integration.nix deleted file mode 100644 index 7e12b38..0000000 --- a/modules/private/websites/aten/integration.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ lib, pkgs, config, ... }: -let - secrets = config.myEnv.websites.aten.integration; - app = pkgs.webapps.aten.override { environment = secrets.environment; }; - cfg = config.myServices.websites.aten.integration; - pcfg = config.services.phpApplication; -in { - options.myServices.websites.aten.integration.enable = lib.mkEnableOption "enable Aten's website in integration"; - - config = lib.mkIf cfg.enable { - services.duplyBackup.profiles.aten_dev.rootDir = app.varDir; - services.phpApplication.apps.aten_dev = { - websiteEnv = "integration"; - httpdUser = config.services.httpd.Inte.user; - httpdGroup = config.services.httpd.Inte.group; - httpdWatchFiles = [ - config.secrets.fullPaths."webapps/${app.environment}-aten" - ]; - inherit (app) webRoot varDir; - inherit app; - serviceDeps = [ "postgresql.service" ]; - preStartActions = [ - "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" - ]; - phpOpenbasedir = [ "/tmp" ]; - phpPool = '' - php_admin_value[upload_max_filesize] = 20M - php_admin_value[post_max_size] = 20M - ;php_admin_flag[log_errors] = on - pm = ondemand - pm.max_children = 5 - pm.process_idle_timeout = 60 - env[SYMFONY_DEBUG_MODE] = "yes" - ''; - }; - - secrets.keys = [{ - dest = "webapps/${app.environment}-aten"; - user = config.services.httpd.Inte.user; - group = config.services.httpd.Inte.group; - permissions = "0400"; - text = let - # cf: - # https://secure.php.net/manual/fr/function.parse-url.php - # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery - psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; - in '' - SetEnv APP_ENV "${app.environment}" - SetEnv APP_SECRET "${secrets.secret}" - SetEnv DATABASE_URL "${psql_url}" - ''; - }]; - services.websites.env.integration.vhostConfs.aten_dev = { - certName = "eldiron"; - addToCerts = true; - hosts = [ "dev.aten.pro" ]; - root = pcfg.webappDirs.aten_dev; - extraConfig = [ - '' - - SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost" - - - Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} - - - Use LDAPConnect - Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu - ErrorDocument 401 "" - - - - Use LDAPConnect - Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu - ErrorDocument 401 "" - - - - Options Indexes FollowSymLinks MultiViews Includes - AllowOverride All - Require all granted - DirectoryIndex index.php - FallbackResource /index.php - - '' - ]; - }; - }; -} diff --git a/modules/private/websites/aten/production.nix b/modules/private/websites/aten/production.nix deleted file mode 100644 index 1f72e61..0000000 --- a/modules/private/websites/aten/production.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ lib, pkgs, config, ... }: -let - secrets = config.myEnv.websites.aten.production; - app = pkgs.webapps.aten.override { environment = secrets.environment; }; - cfg = config.myServices.websites.aten.production; - pcfg = config.services.phpApplication; -in { - options.myServices.websites.aten.production.enable = lib.mkEnableOption "enable Aten's website in production"; - - config = lib.mkIf cfg.enable { - services.duplyBackup.profiles.aten_prod.rootDir = app.varDir; - services.webstats.sites = [ { name = "aten.pro"; } ]; - services.phpApplication.apps.aten_prod = { - websiteEnv = "production"; - httpdUser = config.services.httpd.Prod.user; - httpdGroup = config.services.httpd.Prod.group; - httpdWatchFiles = [ - config.secrets.fullPaths."webapps/${app.environment}-aten" - ]; - inherit (app) webRoot varDir; - inherit app; - serviceDeps = [ "postgresql.service" ]; - preStartActions = [ - "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" - ]; - phpOpenbasedir = [ "/tmp" ]; - phpPool = '' - php_admin_value[upload_max_filesize] = 20M - php_admin_value[post_max_size] = 20M - ;php_admin_flag[log_errors] = on - pm = dynamic - pm.max_children = 20 - pm.start_servers = 2 - pm.min_spare_servers = 1 - pm.max_spare_servers = 3 - ''; - }; - - secrets.keys = [{ - dest = "webapps/${app.environment}-aten"; - user = config.services.httpd.Prod.user; - group = config.services.httpd.Prod.group; - permissions = "0400"; - text = let - # cf: - # https://secure.php.net/manual/fr/function.parse-url.php - # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery - psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; - in '' - SetEnv APP_ENV "${app.environment}" - SetEnv APP_SECRET "${secrets.secret}" - SetEnv DATABASE_URL "${psql_url}" - ''; - }]; - services.websites.env.production.vhostConfs.aten_prod = { - certName = "aten"; - certMainHost = "aten.pro"; - hosts = [ "aten.pro" "www.aten.pro" ]; - root = pcfg.webappDirs.aten_prod; - extraConfig = [ - '' - - SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_prod}|fcgi://localhost" - - - Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} - - Use Stats aten.pro - - - Use LDAPConnect - Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu - ErrorDocument 401 "" - - - - Options Indexes FollowSymLinks MultiViews Includes - AllowOverride All - Require all granted - DirectoryIndex index.php - FallbackResource /index.php - - '' - ]; - }; - }; -} diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index dcbbef8..7f3e463 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -224,8 +224,9 @@ in _theme = pkgs.webapps.apache-theme.theme; }; - aten.integration.enable = true; - aten.production.enable = true; + isabelle.aten_integration.enable = true; + isabelle.aten_production.enable = true; + isabelle.iridologie.enable = true; capitaines.production.enable = true; 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 @@ +{ lib, pkgs, config, ... }: +let + secrets = config.myEnv.websites.isabelle.aten_integration; + app = pkgs.webapps.aten.override { environment = secrets.environment; }; + cfg = config.myServices.websites.isabelle.aten_integration; + pcfg = config.services.phpApplication; +in { + options.myServices.websites.isabelle.aten_integration.enable = lib.mkEnableOption "enable Aten's website in integration"; + + config = lib.mkIf cfg.enable { + services.duplyBackup.profiles.aten_dev.rootDir = app.varDir; + services.phpApplication.apps.aten_dev = { + websiteEnv = "integration"; + httpdUser = config.services.httpd.Inte.user; + httpdGroup = config.services.httpd.Inte.group; + httpdWatchFiles = [ + config.secrets.fullPaths."webapps/${app.environment}-aten" + ]; + inherit (app) webRoot varDir; + inherit app; + serviceDeps = [ "postgresql.service" ]; + preStartActions = [ + "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" + ]; + phpOpenbasedir = [ "/tmp" ]; + phpPool = '' + php_admin_value[upload_max_filesize] = 20M + php_admin_value[post_max_size] = 20M + ;php_admin_flag[log_errors] = on + pm = ondemand + pm.max_children = 5 + pm.process_idle_timeout = 60 + env[SYMFONY_DEBUG_MODE] = "yes" + ''; + }; + + secrets.keys = [{ + dest = "webapps/${app.environment}-aten"; + user = config.services.httpd.Inte.user; + group = config.services.httpd.Inte.group; + permissions = "0400"; + text = let + # cf: + # https://secure.php.net/manual/fr/function.parse-url.php + # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery + psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; + in '' + SetEnv APP_ENV "${app.environment}" + SetEnv APP_SECRET "${secrets.secret}" + SetEnv DATABASE_URL "${psql_url}" + ''; + }]; + services.websites.env.integration.vhostConfs.aten_dev = { + certName = "eldiron"; + addToCerts = true; + hosts = [ "dev.aten.pro" ]; + root = pcfg.webappDirs.aten_dev; + extraConfig = [ + '' + + SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost" + + + Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} + + + Use LDAPConnect + Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu + ErrorDocument 401 "" + + + + Use LDAPConnect + Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu + ErrorDocument 401 "" + + + + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride All + Require all granted + DirectoryIndex index.php + FallbackResource /index.php + + '' + ]; + }; + }; +} 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 @@ +{ lib, pkgs, config, ... }: +let + secrets = config.myEnv.websites.isabelle.aten_production; + app = pkgs.webapps.aten.override { environment = secrets.environment; }; + cfg = config.myServices.websites.isabelle.aten_production; + pcfg = config.services.phpApplication; +in { + options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production"; + + config = lib.mkIf cfg.enable { + services.duplyBackup.profiles.aten_prod.rootDir = app.varDir; + services.webstats.sites = [ { name = "aten.pro"; } ]; + services.phpApplication.apps.aten_prod = { + websiteEnv = "production"; + httpdUser = config.services.httpd.Prod.user; + httpdGroup = config.services.httpd.Prod.group; + httpdWatchFiles = [ + config.secrets.fullPaths."webapps/${app.environment}-aten" + ]; + inherit (app) webRoot varDir; + inherit app; + serviceDeps = [ "postgresql.service" ]; + preStartActions = [ + "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" + ]; + phpOpenbasedir = [ "/tmp" ]; + phpPool = '' + php_admin_value[upload_max_filesize] = 20M + php_admin_value[post_max_size] = 20M + ;php_admin_flag[log_errors] = on + pm = dynamic + pm.max_children = 20 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 3 + ''; + }; + + secrets.keys = [{ + dest = "webapps/${app.environment}-aten"; + user = config.services.httpd.Prod.user; + group = config.services.httpd.Prod.group; + permissions = "0400"; + text = let + # cf: + # https://secure.php.net/manual/fr/function.parse-url.php + # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery + psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; + in '' + SetEnv APP_ENV "${app.environment}" + SetEnv APP_SECRET "${secrets.secret}" + SetEnv DATABASE_URL "${psql_url}" + ''; + }]; + services.websites.env.production.vhostConfs.aten_prod = { + certName = "aten"; + certMainHost = "aten.pro"; + hosts = [ "aten.pro" "www.aten.pro" ]; + root = pcfg.webappDirs.aten_prod; + extraConfig = [ + '' + + SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_prod}|fcgi://localhost" + + + Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"} + + Use Stats aten.pro + + + Use LDAPConnect + Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu + ErrorDocument 401 "" + + + + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride All + Require all granted + DirectoryIndex index.php + FallbackResource /index.php + + '' + ]; + }; + }; +} 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 @@ +{ lib, config, ... }: +let + cfg = config.myServices.websites.isabelle.iridologie; + varDir = "/var/lib/ftp/isabelle"; +in { + options.myServices.websites.isabelle.iridologie.enable = lib.mkEnableOption "enable Iridologie's website"; + + config = lib.mkIf cfg.enable { + services.webstats.sites = [ { name = "iridologie.icommandeur.org"; } ]; + services.websites.env.production.vhostConfs.iridologie = { + certName = "aten"; + hosts = [ "icommandeur.org" "www.icommandeur.org" "iridologie.icommandeur.org" ]; + root = varDir; + extraConfig = [ + '' + Use Stats iridologie.icommandeur.org + RewriteEngine On + RewriteCond "%{HTTP_HOST}" "!^iridologie\.icommandeur\.org$" [NC] + RewriteRule ^(.+)$ https://iridologie.icommandeur.org$1 [R=302,L] + + + DirectoryIndex index.html + AllowOverride None + Require all granted + + '' + ]; + }; + }; +} + -- cgit v1.2.3