]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | let | |
3 | chloe = pkgs.callPackage ./builder.nix { | |
4 | inherit (pkgs.webapps) chloe; | |
5 | config = config.myEnv.websites.chloe.production; | |
6 | apacheUser = config.services.httpd.Prod.user; | |
7 | apacheGroup = config.services.httpd.Prod.group; | |
8 | }; | |
9 | ||
10 | cfg = config.myServices.websites.chloe.production; | |
11 | in { | |
12 | options.myServices.websites.chloe.production.enable = lib.mkEnableOption "enable Chloe's website in production"; | |
13 | ||
14 | config = lib.mkIf cfg.enable { | |
15 | services.duplyBackup.profiles.chloe_prod.rootDir = chloe.app.varDir; | |
16 | secrets.keys = chloe.keys; | |
17 | services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ]; | |
18 | ||
19 | systemd.services.phpfpm-chloe_prod.after = lib.mkAfter chloe.phpFpm.serviceDeps; | |
20 | systemd.services.phpfpm-chloe_prod.wants = chloe.phpFpm.serviceDeps; | |
21 | services.phpfpm.pools.chloe_prod = { | |
22 | user = config.services.httpd.Prod.user; | |
23 | group = config.services.httpd.Prod.group; | |
24 | settings = chloe.phpFpm.pool; | |
25 | phpOptions = config.services.phpfpm.phpOptions + '' | |
26 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | |
27 | ''; | |
28 | }; | |
29 | system.activationScripts.chloe_prod = chloe.activationScript; | |
30 | myServices.websites.webappDirs."${chloe.apache.webappName}" = chloe.app.webRoot; | |
31 | services.websites.env.production.modules = chloe.apache.modules; | |
32 | services.websites.env.production.vhostConfs.chloe = { | |
33 | certName = "chloe"; | |
34 | certMainHost = "osteopathe-cc.fr"; | |
35 | hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ]; | |
36 | root = chloe.apache.root; | |
37 | extraConfig = [ | |
38 | '' | |
39 | RewriteEngine On | |
40 | RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC] | |
41 | RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L] | |
42 | '' | |
43 | (chloe.apache.vhostConf config.services.phpfpm.pools.chloe_prod.socket) | |
44 | ]; | |
45 | }; | |
46 | services.websites.env.production.watchPaths = [ | |
47 | "/var/secrets/webapps/${chloe.app.environment}-chloe" | |
48 | ]; | |
49 | }; | |
50 | } |