diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-18 10:49:00 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-18 10:49:00 +0200 |
commit | f8026b6e4c869aa108f6361c8ccd50890657994d (patch) | |
tree | 57cb311e520933bd2ab6ccbae05f2913799eb49e /nixops/modules/websites/chloe | |
parent | 4aac110f17f0528d90510eec00c9a8df60bcf04f (diff) | |
download | Nix-f8026b6e4c869aa108f6361c8ccd50890657994d.tar.gz Nix-f8026b6e4c869aa108f6361c8ccd50890657994d.tar.zst Nix-f8026b6e4c869aa108f6361c8ccd50890657994d.zip |
Move personal websites to modules
Diffstat (limited to 'nixops/modules/websites/chloe')
8 files changed, 0 insertions, 230 deletions
diff --git a/nixops/modules/websites/chloe/chloe.nix b/nixops/modules/websites/chloe/chloe.nix deleted file mode 100644 index 2847b9d..0000000 --- a/nixops/modules/websites/chloe/chloe.nix +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | { chloe, config }: | ||
2 | rec { | ||
3 | app = chloe.override { inherit (config) environment; }; | ||
4 | phpFpm = rec { | ||
5 | serviceDeps = [ "mysql.service" ]; | ||
6 | socket = "/var/run/phpfpm/chloe-${app.environment}.sock"; | ||
7 | pool = '' | ||
8 | listen = ${socket} | ||
9 | user = ${apache.user} | ||
10 | group = ${apache.group} | ||
11 | listen.owner = ${apache.user} | ||
12 | listen.group = ${apache.group} | ||
13 | php_admin_value[upload_max_filesize] = 20M | ||
14 | php_admin_value[post_max_size] = 20M | ||
15 | ;php_admin_flag[log_errors] = on | ||
16 | php_admin_value[open_basedir] = "${app.spipConfig}:${configDir}:${app}:${app.varDir}:/tmp" | ||
17 | php_admin_value[session.save_path] = "${app.varDir}/phpSessions" | ||
18 | ${if app.environment == "dev" then '' | ||
19 | pm = ondemand | ||
20 | pm.max_children = 5 | ||
21 | pm.process_idle_timeout = 60 | ||
22 | '' else '' | ||
23 | pm = dynamic | ||
24 | pm.max_children = 20 | ||
25 | pm.start_servers = 2 | ||
26 | pm.min_spare_servers = 1 | ||
27 | pm.max_spare_servers = 3 | ||
28 | ''}''; | ||
29 | }; | ||
30 | keys = [{ | ||
31 | dest = "webapps/${app.environment}-chloe"; | ||
32 | user = apache.user; | ||
33 | group = apache.group; | ||
34 | permissions = "0400"; | ||
35 | text = '' | ||
36 | SetEnv SPIP_CONFIG_DIR "${configDir}" | ||
37 | SetEnv SPIP_VAR_DIR "${app.varDir}" | ||
38 | SetEnv SPIP_SITE "chloe-${app.environment}" | ||
39 | SetEnv SPIP_LDAP_BASE "dc=immae,dc=eu" | ||
40 | SetEnv SPIP_LDAP_HOST "ldaps://ldap.immae.eu" | ||
41 | SetEnv SPIP_LDAP_SEARCH_DN "${config.ldap.dn}" | ||
42 | SetEnv SPIP_LDAP_SEARCH_PW "${config.ldap.password}" | ||
43 | SetEnv SPIP_LDAP_SEARCH "${config.ldap.search}" | ||
44 | SetEnv SPIP_MYSQL_HOST "${config.mysql.host}" | ||
45 | SetEnv SPIP_MYSQL_PORT "${config.mysql.port}" | ||
46 | SetEnv SPIP_MYSQL_DB "${config.mysql.name}" | ||
47 | SetEnv SPIP_MYSQL_USER "${config.mysql.user}" | ||
48 | SetEnv SPIP_MYSQL_PASSWORD "${config.mysql.password}" | ||
49 | ''; | ||
50 | }]; | ||
51 | apache = rec { | ||
52 | user = "wwwrun"; | ||
53 | group = "wwwrun"; | ||
54 | modules = [ "proxy_fcgi" ]; | ||
55 | webappName = "chloe_${app.environment}"; | ||
56 | root = "/run/current-system/webapps/${webappName}"; | ||
57 | vhostConf = '' | ||
58 | Include /var/secrets/webapps/${app.environment}-chloe | ||
59 | |||
60 | RewriteEngine On | ||
61 | ${if app.environment == "prod" then '' | ||
62 | RewriteRule ^/news.rss /spip.php?page=backend&id_rubrique=1 | ||
63 | '' else ""} | ||
64 | |||
65 | <FilesMatch "\.php$"> | ||
66 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
67 | </FilesMatch> | ||
68 | |||
69 | <Directory ${root}> | ||
70 | DirectoryIndex index.php index.htm index.html | ||
71 | Options -Indexes +FollowSymLinks +MultiViews +Includes | ||
72 | Include ${root}/htaccess.txt | ||
73 | |||
74 | AllowOverride AuthConfig FileInfo Limit | ||
75 | Require all granted | ||
76 | </Directory> | ||
77 | |||
78 | <DirectoryMatch "${root}/squelettes"> | ||
79 | Require all denied | ||
80 | </DirectoryMatch> | ||
81 | |||
82 | <FilesMatch "(.htaccess|rewrite-rules|.gitignore)$"> | ||
83 | Require all denied | ||
84 | </FilesMatch> | ||
85 | |||
86 | ${if app.environment == "dev" then '' | ||
87 | <Location /> | ||
88 | Use LDAPConnect | ||
89 | Require ldap-group cn=chloe.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu | ||
90 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://osteopathe-cc.fr\"></html>" | ||
91 | </Location> | ||
92 | '' else '' | ||
93 | Use Stats osteopathe-cc.fr | ||
94 | ''} | ||
95 | ''; | ||
96 | }; | ||
97 | activationScript = { | ||
98 | deps = [ "wrappers" ]; | ||
99 | text = '' | ||
100 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${app.varDir} ${app.varDir}/IMG ${app.varDir}/tmp ${app.varDir}/local | ||
101 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${app.varDir}/phpSessions | ||
102 | ''; | ||
103 | }; | ||
104 | configDir = ./chloe_config_ + app.environment; | ||
105 | } | ||
diff --git a/nixops/modules/websites/chloe/chloe_config_dev/chmod.php b/nixops/modules/websites/chloe/chloe_config_dev/chmod.php deleted file mode 100644 index aae16cd..0000000 --- a/nixops/modules/websites/chloe/chloe_config_dev/chmod.php +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | <?php | ||
2 | if (!defined("_ECRIRE_INC_VERSION")) return; | ||
3 | if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', 0777); | ||
4 | ?> \ No newline at end of file | ||
diff --git a/nixops/modules/websites/chloe/chloe_config_dev/connect.php b/nixops/modules/websites/chloe/chloe_config_dev/connect.php deleted file mode 100644 index 18b0933..0000000 --- a/nixops/modules/websites/chloe/chloe_config_dev/connect.php +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | <?php | ||
2 | if (!defined("_ECRIRE_INC_VERSION")) return; | ||
3 | define('_MYSQL_SET_SQL_MODE',true); | ||
4 | $GLOBALS['spip_connect_version'] = 0.7; | ||
5 | spip_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/nixops/modules/websites/chloe/chloe_config_dev/ldap.php b/nixops/modules/websites/chloe/chloe_config_dev/ldap.php deleted file mode 100644 index 825b7ed..0000000 --- a/nixops/modules/websites/chloe/chloe_config_dev/ldap.php +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <?php | ||
2 | if (!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/nixops/modules/websites/chloe/chloe_config_prod/chmod.php b/nixops/modules/websites/chloe/chloe_config_prod/chmod.php deleted file mode 100644 index aae16cd..0000000 --- a/nixops/modules/websites/chloe/chloe_config_prod/chmod.php +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | <?php | ||
2 | if (!defined("_ECRIRE_INC_VERSION")) return; | ||
3 | if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', 0777); | ||
4 | ?> \ No newline at end of file | ||
diff --git a/nixops/modules/websites/chloe/chloe_config_prod/connect.php b/nixops/modules/websites/chloe/chloe_config_prod/connect.php deleted file mode 100644 index 18b0933..0000000 --- a/nixops/modules/websites/chloe/chloe_config_prod/connect.php +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | <?php | ||
2 | if (!defined("_ECRIRE_INC_VERSION")) return; | ||
3 | define('_MYSQL_SET_SQL_MODE',true); | ||
4 | $GLOBALS['spip_connect_version'] = 0.7; | ||
5 | spip_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/nixops/modules/websites/chloe/chloe_config_prod/ldap.php b/nixops/modules/websites/chloe/chloe_config_prod/ldap.php deleted file mode 100644 index 825b7ed..0000000 --- a/nixops/modules/websites/chloe/chloe_config_prod/ldap.php +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <?php | ||
2 | if (!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/nixops/modules/websites/chloe/default.nix b/nixops/modules/websites/chloe/default.nix deleted file mode 100644 index 8e801b5..0000000 --- a/nixops/modules/websites/chloe/default.nix +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | ||
2 | let | ||
3 | chloe_dev = pkgs.callPackage ./chloe.nix { | ||
4 | inherit (pkgs.webapps) chloe; | ||
5 | config = myconfig.env.websites.chloe.integration; | ||
6 | }; | ||
7 | chloe_prod = pkgs.callPackage ./chloe.nix { | ||
8 | inherit (pkgs.webapps) chloe; | ||
9 | config = myconfig.env.websites.chloe.production; | ||
10 | }; | ||
11 | |||
12 | cfg = config.services.myWebsites.Chloe; | ||
13 | in { | ||
14 | options.services.myWebsites.Chloe = { | ||
15 | production = { | ||
16 | enable = lib.mkEnableOption "enable Chloe's website in production"; | ||
17 | }; | ||
18 | integration = { | ||
19 | enable = lib.mkEnableOption "enable Chloe's website in integration"; | ||
20 | }; | ||
21 | }; | ||
22 | |||
23 | config = lib.mkMerge [ | ||
24 | (lib.mkIf cfg.production.enable { | ||
25 | secrets.keys = chloe_prod.keys; | ||
26 | services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ]; | ||
27 | |||
28 | services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps; | ||
29 | services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool; | ||
30 | services.myPhpfpm.poolPhpConfigs.chloe_prod = '' | ||
31 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | ||
32 | ''; | ||
33 | system.activationScripts.chloe_prod = chloe_prod.activationScript; | ||
34 | system.extraSystemBuilderCmds = '' | ||
35 | mkdir -p $out/webapps | ||
36 | ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName} | ||
37 | ''; | ||
38 | services.websites.production.modules = chloe_prod.apache.modules; | ||
39 | services.websites.production.vhostConfs.chloe = { | ||
40 | certName = "chloe"; | ||
41 | certMainHost = "osteopathe-cc.fr"; | ||
42 | hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ]; | ||
43 | root = chloe_prod.apache.root; | ||
44 | extraConfig = [ chloe_prod.apache.vhostConf ]; | ||
45 | }; | ||
46 | }) | ||
47 | (lib.mkIf cfg.integration.enable { | ||
48 | secrets.keys = chloe_dev.keys; | ||
49 | services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps; | ||
50 | services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool; | ||
51 | services.myPhpfpm.poolPhpConfigs.chloe_dev = '' | ||
52 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | ||
53 | ''; | ||
54 | system.activationScripts.chloe_dev = chloe_dev.activationScript; | ||
55 | system.extraSystemBuilderCmds = '' | ||
56 | mkdir -p $out/webapps | ||
57 | ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName} | ||
58 | ''; | ||
59 | services.websites.integration.modules = chloe_dev.apache.modules; | ||
60 | services.websites.integration.vhostConfs.chloe = { | ||
61 | certName = "eldiron"; | ||
62 | addToCerts = true; | ||
63 | hosts = ["chloe.immae.eu" ]; | ||
64 | root = chloe_dev.apache.root; | ||
65 | extraConfig = [ chloe_dev.apache.vhostConf ]; | ||
66 | }; | ||
67 | }) | ||
68 | ]; | ||
69 | } | ||