]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/chloe/production.nix
Upgrade nixos
[perso/Immae/Config/Nix.git] / modules / private / websites / chloe / production.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
f8026b6e
IB
2let
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;
11in {
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 = {
5400b9b6
IB
22 user = config.services.httpd.Prod.user;
23 group = config.services.httpd.Prod.group;
24 settings = chloe.phpFpm.pool;
f40f5b23
IB
25 phpOptions = config.services.phpfpm.phpOptions + ''
26 extension=${pkgs.php}/lib/php/extensions/mysqli.so
f8026b6e 27 '';
f40f5b23 28 };
f8026b6e 29 system.activationScripts.chloe_prod = chloe.activationScript;
4288c2f2 30 myServices.websites.webappDirs."${chloe.apache.webappName}" = chloe.app.webRoot;
29f8cb85
IB
31 services.websites.env.production.modules = chloe.apache.modules;
32 services.websites.env.production.vhostConfs.chloe = {
f8026b6e
IB
33 certName = "chloe";
34 certMainHost = "osteopathe-cc.fr";
35 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
36 root = chloe.apache.root;
33b5010f
IB
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 ''
5400b9b6 43 (chloe.apache.vhostConf config.services.phpfpm.pools.chloe_prod.socket)
33b5010f 44 ];
f8026b6e 45 };
29f8cb85 46 services.websites.env.production.watchPaths = [
17f6eae9
IB
47 "/var/secrets/webapps/${chloe.app.environment}-chloe"
48 ];
f8026b6e
IB
49 };
50}