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