]>
Commit | Line | Data |
---|---|---|
ab8f306d | 1 | { lib, pkgs, config, ... }: |
f8026b6e IB |
2 | let |
3 | chloe = pkgs.callPackage ./builder.nix { | |
4 | inherit (pkgs.webapps) chloe; | |
ab8f306d | 5 | config = config.myEnv.websites.chloe.production; |
f8026b6e IB |
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 { | |
d2e703c5 | 15 | services.duplyBackup.profiles.chloe_prod.rootDir = chloe.app.varDir; |
f8026b6e IB |
16 | secrets.keys = chloe.keys; |
17 | services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ]; | |
18 | ||
f40f5b23 IB |
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 | listen = chloe.phpFpm.socket; | |
23 | extraConfig = chloe.phpFpm.pool; | |
24 | phpOptions = config.services.phpfpm.phpOptions + '' | |
25 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | |
f8026b6e | 26 | ''; |
f40f5b23 | 27 | }; |
f8026b6e | 28 | system.activationScripts.chloe_prod = chloe.activationScript; |
4288c2f2 | 29 | myServices.websites.webappDirs."${chloe.apache.webappName}" = chloe.app.webRoot; |
29f8cb85 IB |
30 | services.websites.env.production.modules = chloe.apache.modules; |
31 | services.websites.env.production.vhostConfs.chloe = { | |
f8026b6e IB |
32 | certName = "chloe"; |
33 | certMainHost = "osteopathe-cc.fr"; | |
34 | hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ]; | |
35 | root = chloe.apache.root; | |
33b5010f IB |
36 | extraConfig = [ |
37 | '' | |
38 | RewriteEngine On | |
39 | RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC] | |
40 | RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L] | |
41 | '' | |
42 | chloe.apache.vhostConf | |
43 | ]; | |
f8026b6e | 44 | }; |
29f8cb85 | 45 | services.websites.env.production.watchPaths = [ |
17f6eae9 IB |
46 | "/var/secrets/webapps/${chloe.app.environment}-chloe" |
47 | ]; | |
f8026b6e IB |
48 | }; |
49 | } |