]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - systems/eldiron/websites/immae/production.nix
Use new synapse host
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / immae / production.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
f759f52e 2let
f8026b6e 3 cfg = config.myServices.websites.immae.production;
cb589b2e 4 varDir = "/var/lib/buildbot/outputs/immae/blog";
577d00ee 5 historyDir = "/var/lib/buildbot/outputs/immae/history";
97f5a24b 6 docsDir = "/var/lib/buildbot/outputs/immae/docs/";
f5ef667f 7 patchesDir = "/var/lib/buildbot/outputs/immae/patches/";
f759f52e 8in {
f8026b6e 9 options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
f759f52e 10
f8026b6e 11 config = lib.mkIf cfg.enable {
1a64deeb
IB
12 myServices.dns.zones."immae.eu".subdomains = with config.myServices.dns.helpers;
13 {
14 www = ips servers.eldiron.ips.production;
15 matrix.CNAME = [ "immae.element.io." ];
16 };
9eae2b47 17 services.webstats.sites = [ { name = "www.immae.eu"; } ];
f759f52e 18
1a64deeb
IB
19 security.acme.certs.immae.domain = "www.immae.eu";
20 security.acme.certs.immae.extraDomainNames = [ "immae.eu" ];
21 services.websites.env.production.bindMounts."${varDir}" = {};
22 services.websites.env.production.bindMounts."${docsDir}" = {};
f5ef667f 23 services.websites.env.production.bindMounts."${patchesDir}" = {};
1a64deeb 24 services.websites.env.production.bindMounts."${historyDir}" = {};
d3452fc5
IB
25 services.websites.env.production.vhostConfs.immae_production = {
26 certName = "immae";
d3452fc5
IB
27 hosts = [ "www.immae.eu" "immae.eu" ];
28 root = varDir;
29 extraConfig = [
f759f52e
IB
30 ''
31 Use Stats www.immae.eu
46c99b57 32 Header always set Strict-Transport-Security "max-age=31536000"
f759f52e 33
6da0830e
IB
34 <LocationMatch /.well-known/(webfinger|host-meta)>
35 Header always set Referrer-Policy "strict-origin-when-cross-origin"
6da0830e
IB
36 RequestHeader set X-Forwarded-Proto "https"
37
38 RewriteRule ^(.*)$ https://mastodon.immae.eu%{REQUEST_URI} [QSA,L]
39 </LocationMatch>
40
41 RewriteEngine On
42 RewriteCond "%{REQUEST_URI}" "!^/.well-known/(webfinger|host-meta)"
43 RewriteCond "%{HTTP_HOST}" "!^www\.immae\.eu$" [NC]
44 RewriteRule ^(.+)$ https://www.immae.eu$1 [R=302,L]
45
f759f52e 46 <Directory ${varDir}>
0012da0f
IB
47 DirectoryIndex index.htm index.html
48 Options Indexes FollowSymLinks MultiViews Includes
49 AllowOverride All
50 Require all granted
51 </Directory>
52
57a42113
IB
53 Alias /.well-known/matrix ${./matrix}
54 <Directory ${./matrix}>
55 Options Indexes FollowSymLinks MultiViews Includes
56 AllowOverride None
57 Require all granted
58 Header always set Access-Control-Allow-Origin "*"
d1527470 59 Header always set Cache-Control "max-age=3600, public"
57a42113 60 </Directory>
196c6e3c 61
f5ef667f
IB
62 Alias /patches ${patchesDir}
63 <Directory ${patchesDir}>
64 DirectoryIndex index.htm index.html
65 Options Indexes FollowSymLinks MultiViews Includes
66 AllowOverride All
67 Require all granted
68 </Directory>
69
97f5a24b
IB
70 Alias /docs ${docsDir}
71 <Directory ${docsDir}>
72 DirectoryIndex index.htm index.html
73 Options Indexes FollowSymLinks MultiViews Includes
74 AllowOverride All
75 Require all granted
76 </Directory>
77
1a64deeb
IB
78 Alias /eurl ${./sarl}
79 Alias /eurl ${./sarl}
80 <Directory ${./sarl}>
23f9fdf0
IB
81 DirectoryIndex index.htm index.html
82 Options Indexes FollowSymLinks MultiViews Includes
83 AllowOverride None
84 Require all granted
85 </Directory>
86
7130402c
IB
87 Alias /history ${historyDir}
88 <Directory ${historyDir}>
89 DirectoryIndex index.html
90 AllowOverride None
91 Require all granted
92 </Directory>
70606070 93
1a64deeb
IB
94 Alias /.well-known/chatonsinfos ${config.myServices.chatonsProperties.propertiesPath}
95 <Directory ${config.myServices.chatonsProperties.propertiesPath}>
c5f1602f 96 Options Indexes FollowSymLinks MultiViews Includes
1a64deeb 97 AllowOverride None
c5f1602f
IB
98 Require all granted
99 </Directory>
1a64deeb
IB
100 ''
101 ];
70606070 102 };
1a64deeb
IB
103
104 myServices.monitoring.fromMasterActivatedPlugins = [ "http" ];
105 myServices.monitoring.fromMasterObjects.service = [
106 {
107 service_description = "blog website is running on immae.eu";
108 host_name = config.hostEnv.fqdn;
109 use = "external-web-service";
110 check_command = ["check_https" "www.immae.eu" "/blog/" "egrep -ri TODO /etc"];
111
112 servicegroups = "webstatus-websites";
113 _webstatus_name = "Immae’s Blog";
114 _webstatus_url = "https://www.immae.eu/blog";
115 }
116 ];
f759f52e
IB
117 };
118}