aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/chloe
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/websites/chloe')
-rw-r--r--modules/private/websites/chloe/app/default.nix22
-rw-r--r--modules/private/websites/chloe/config/chmod.php4
-rw-r--r--modules/private/websites/chloe/config/connect.php15
-rw-r--r--modules/private/websites/chloe/config/ldap.php9
-rw-r--r--modules/private/websites/chloe/integration.nix104
-rw-r--r--modules/private/websites/chloe/production.nix112
6 files changed, 0 insertions, 266 deletions
diff --git a/modules/private/websites/chloe/app/default.nix b/modules/private/websites/chloe/app/default.nix
deleted file mode 100644
index d23e3e0..0000000
--- a/modules/private/websites/chloe/app/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
1{ environment ? "prod"
2, varDir ? "/var/lib/chloe_${environment}"
3, spip, stdenv, sassc, sources }:
4let
5 siteDir = stdenv.mkDerivation {
6 version = sources.websites-chloe-app.version;
7 pname = "chloe";
8 src = sources.websites-chloe-app;
9 buildPhase = ''
10 make
11 '';
12 installPhase = ''
13 cp -a . $out
14 '';
15 buildInputs = [ sassc ];
16 };
17in
18spip.override {
19 ldap = true;
20 siteName = "chloe";
21 inherit environment siteDir varDir;
22}
diff --git a/modules/private/websites/chloe/config/chmod.php b/modules/private/websites/chloe/config/chmod.php
deleted file mode 100644
index aae16cd..0000000
--- a/modules/private/websites/chloe/config/chmod.php
+++ /dev/null
@@ -1,4 +0,0 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', 0777);
4?> \ No newline at end of file
diff --git a/modules/private/websites/chloe/config/connect.php b/modules/private/websites/chloe/config/connect.php
deleted file mode 100644
index 18b0933..0000000
--- a/modules/private/websites/chloe/config/connect.php
+++ /dev/null
@@ -1,15 +0,0 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3define('_MYSQL_SET_SQL_MODE',true);
4$GLOBALS['spip_connect_version'] = 0.7;
5spip_connect_db(
6 getenv("SPIP_MYSQL_HOST"),
7 getenv("SPIP_MYSQL_PORT"),
8 getenv("SPIP_MYSQL_USER"),
9 getenv("SPIP_MYSQL_PASSWORD"),
10 getenv("SPIP_MYSQL_DB"),
11 'mysql',
12 'spip',
13 'ldap.php'
14);
15?>
diff --git a/modules/private/websites/chloe/config/ldap.php b/modules/private/websites/chloe/config/ldap.php
deleted file mode 100644
index 825b7ed..0000000
--- a/modules/private/websites/chloe/config/ldap.php
+++ /dev/null
@@ -1,9 +0,0 @@
1<?php
2if (!defined("_ECRIRE_INC_VERSION")) return;
3$GLOBALS['ldap_base'] = getenv("SPIP_LDAP_BASE");
4$GLOBALS['ldap_link'] = @ldap_connect(getenv("SPIP_LDAP_HOST"));
5@ldap_set_option($GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'3');
6@ldap_bind($GLOBALS['ldap_link'],getenv("SPIP_LDAP_SEARCH_DN"), getenv("SPIP_LDAP_SEARCH_PW"));
7$GLOBALS['ldap_champs'] = array('login' => array('sAMAccountName','uid','login','userid','cn','sn'),'nom' => 'cn','email' => 'mail','bio' => 'description',);
8$GLOBALS['ldap_search'] = getenv("SPIP_LDAP_SEARCH");
9?>
diff --git a/modules/private/websites/chloe/integration.nix b/modules/private/websites/chloe/integration.nix
deleted file mode 100644
index 533568e..0000000
--- a/modules/private/websites/chloe/integration.nix
+++ /dev/null
@@ -1,104 +0,0 @@
1{ lib, pkgs, config, ... }:
2let
3 apacheUser = config.services.httpd.Inte.user;
4 apacheGroup = config.services.httpd.Inte.group;
5 ccfg = config.myEnv.websites.chloe.integration;
6 webRoot = "/var/lib/ftp/immae/chloe";
7 varDir = "/var/lib/ftp/immae/chloe_var";
8 cfg = config.myServices.websites.chloe.integration;
9in {
10 options.myServices.websites.chloe.integration.enable = lib.mkEnableOption "enable Chloe's website in integration";
11
12 config = lib.mkIf cfg.enable {
13 secrets.keys."websites/chloe/integration" = {
14 user = apacheUser;
15 group = apacheGroup;
16 permissions = "0400";
17 text = ''
18 SetEnv SPIP_CONFIG_DIR "${./config}"
19 SetEnv SPIP_VAR_DIR "${varDir}"
20 SetEnv SPIP_SITE "chloe-dev"
21 SetEnv SPIP_LDAP_BASE "dc=immae,dc=eu"
22 SetEnv SPIP_LDAP_HOST "ldaps://ldap.immae.eu"
23 SetEnv SPIP_LDAP_SEARCH_DN "${ccfg.ldap.dn}"
24 SetEnv SPIP_LDAP_SEARCH_PW "${ccfg.ldap.password}"
25 SetEnv SPIP_LDAP_SEARCH "${ccfg.ldap.filter}"
26 SetEnv SPIP_MYSQL_HOST "${ccfg.mysql.host}"
27 SetEnv SPIP_MYSQL_PORT "${ccfg.mysql.port}"
28 SetEnv SPIP_MYSQL_DB "${ccfg.mysql.database}"
29 SetEnv SPIP_MYSQL_USER "${ccfg.mysql.user}"
30 SetEnv SPIP_MYSQL_PASSWORD "${ccfg.mysql.password}"
31 '';
32 };
33 systemd.services.phpfpm-chloe_integration.after = lib.mkAfter [ "mysql.service" ];
34 systemd.services.phpfpm-chloe_integration.wants = [ "mysql.service" ];
35 services.phpfpm.pools.chloe_integration = {
36 user = config.services.httpd.Inte.user;
37 group = config.services.httpd.Inte.group;
38 settings = {
39 "listen.owner" = apacheUser;
40 "listen.group" = apacheGroup;
41 "php_admin_value[upload_max_filesize]" = "20M";
42 "php_admin_value[post_max_size]" = "20M";
43 # "php_admin_flag[log_errors]" = "on";
44 "php_admin_value[open_basedir]" = "${../../../../pkgs/webapps/spip/spip_mes_options.php}:${./config}:${webRoot}:${varDir}:/tmp";
45 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
46 "pm" = "ondemand";
47 "pm.max_children" = "5";
48 "pm.process_idle_timeout" = "60";
49 };
50 phpPackage = pkgs.php72;
51 };
52 system.activationScripts.chloe_integration = {
53 deps = [ "wrappers" ];
54 text = ''
55 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} ${varDir}/IMG ${varDir}/tmp ${varDir}/local
56 install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${varDir}/phpSessions
57 '';
58 };
59 services.websites.env.integration.modules = [ "proxy_fcgi" ];
60 services.websites.env.integration.vhostConfs.chloe_integration = {
61 certName = "integration";
62 addToCerts = true;
63 hosts = ["test.chc.immae.dev" ];
64 root = webRoot;
65 extraConfig = [
66 ''
67 Include ${config.secrets.fullPaths."websites/chloe/integration"}
68
69 RewriteEngine On
70
71 <FilesMatch "\.php$">
72 SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_integration.socket}|fcgi://localhost"
73 </FilesMatch>
74
75 <Directory ${webRoot}>
76 DirectoryIndex index.php index.htm index.html
77 Options -Indexes +FollowSymLinks +MultiViews +Includes
78 Include ${webRoot}/htaccess.txt
79
80 AllowOverride AuthConfig FileInfo Limit
81 Require all granted
82 </Directory>
83
84 <DirectoryMatch "${webRoot}/squelettes">
85 Require all denied
86 </DirectoryMatch>
87
88 <FilesMatch "(.htaccess|rewrite-rules|.gitignore)$">
89 Require all denied
90 </FilesMatch>
91
92 <Location />
93 Use LDAPConnect
94 Require ldap-group cn=chc.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
95 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://osteopathe-cc.fr\"></html>"
96 </Location>
97 ''
98 ];
99 };
100 services.websites.env.integration.watchPaths = [
101 config.secrets.fullPaths."websites/chloe/integration"
102 ];
103 };
104}
diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix
deleted file mode 100644
index 211232c..0000000
--- a/modules/private/websites/chloe/production.nix
+++ /dev/null
@@ -1,112 +0,0 @@
1{ lib, pkgs, config, ... }:
2let
3 apacheUser = config.services.httpd.Prod.user;
4 apacheGroup = config.services.httpd.Prod.group;
5 ccfg = config.myEnv.websites.chloe.production;
6 app = pkgs.callPackage ./app {
7 inherit (ccfg) environment;
8 inherit (pkgs.webapps) spip;
9 varDir = "/var/lib/chloe_production";
10 };
11 cfg = config.myServices.websites.chloe.production;
12in {
13 options.myServices.websites.chloe.production.enable = lib.mkEnableOption "enable Chloe's website in production";
14
15 config = lib.mkIf cfg.enable {
16 secrets.keys."websites/chloe/production" = {
17 user = apacheUser;
18 group = apacheGroup;
19 permissions = "0400";
20 text = ''
21 SetEnv SPIP_CONFIG_DIR "${./config}"
22 SetEnv SPIP_VAR_DIR "${app.varDir}"
23 SetEnv SPIP_SITE "chloe-${app.environment}"
24 SetEnv SPIP_LDAP_BASE "dc=immae,dc=eu"
25 SetEnv SPIP_LDAP_HOST "ldaps://ldap.immae.eu"
26 SetEnv SPIP_LDAP_SEARCH_DN "${ccfg.ldap.dn}"
27 SetEnv SPIP_LDAP_SEARCH_PW "${ccfg.ldap.password}"
28 SetEnv SPIP_LDAP_SEARCH "${ccfg.ldap.filter}"
29 SetEnv SPIP_MYSQL_HOST "${ccfg.mysql.host}"
30 SetEnv SPIP_MYSQL_PORT "${ccfg.mysql.port}"
31 SetEnv SPIP_MYSQL_DB "${ccfg.mysql.database}"
32 SetEnv SPIP_MYSQL_USER "${ccfg.mysql.user}"
33 SetEnv SPIP_MYSQL_PASSWORD "${ccfg.mysql.password}"
34 '';
35 };
36 services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
37
38 systemd.services.phpfpm-chloe_production.after = lib.mkAfter [ "mysql.service" ];
39 systemd.services.phpfpm-chloe_production.wants = [ "mysql.service" ];
40 services.phpfpm.pools.chloe_production = {
41 user = config.services.httpd.Prod.user;
42 group = config.services.httpd.Prod.group;
43 settings = {
44 "listen.owner" = apacheUser;
45 "listen.group" = apacheGroup;
46 "php_admin_value[upload_max_filesize]" = "20M";
47 "php_admin_value[post_max_size]" = "20M";
48 # "php_admin_flag[log_errors]" = "on";
49 "php_admin_value[open_basedir]" = "${app.spipConfig}:${./config}:${app}:${app.varDir}:/tmp";
50 "php_admin_value[session.save_path]" = "${app.varDir}/phpSessions";
51 "pm" = "dynamic";
52 "pm.max_children" = "20";
53 "pm.start_servers" = "2";
54 "pm.min_spare_servers" = "1";
55 "pm.max_spare_servers" = "3";
56 };
57 phpPackage = pkgs.php72;
58 };
59 system.activationScripts.chloe_production = {
60 deps = [ "wrappers" ];
61 text = ''
62 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir} ${app.varDir}/IMG ${app.varDir}/tmp ${app.varDir}/local
63 install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}/phpSessions
64 '';
65 };
66 services.websites.env.production.modules = [ "proxy_fcgi" ];
67 services.websites.env.production.vhostConfs.chloe = {
68 certName = "chloe";
69 certMainHost = "osteopathe-cc.fr";
70 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
71 root = app.webRoot;
72 extraConfig = [
73 ''
74 Use Stats osteopathe-cc.fr
75
76 RewriteEngine On
77 RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC]
78 RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L]
79
80 Include ${config.secrets.fullPaths."websites/chloe/production"}
81
82 RewriteEngine On
83 RewriteRule ^/news.rss /spip.php?page=backend&id_rubrique=1
84
85 <FilesMatch "\.php$">
86 SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_production.socket}|fcgi://localhost"
87 </FilesMatch>
88
89 <Directory ${app.webRoot}>
90 DirectoryIndex index.php index.htm index.html
91 Options -Indexes +FollowSymLinks +MultiViews +Includes
92 Include ${app.webRoot}/htaccess.txt
93
94 AllowOverride AuthConfig FileInfo Limit
95 Require all granted
96 </Directory>
97
98 <DirectoryMatch "${app.webRoot}/squelettes">
99 Require all denied
100 </DirectoryMatch>
101
102 <FilesMatch "(.htaccess|rewrite-rules|.gitignore)$">
103 Require all denied
104 </FilesMatch>
105 ''
106 ];
107 };
108 services.websites.env.production.watchPaths = [
109 config.secrets.fullPaths."websites/chloe/production"
110 ];
111 };
112}