diff options
Diffstat (limited to 'systems/eldiron/websites/immae/production.nix')
-rw-r--r-- | systems/eldiron/websites/immae/production.nix | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/systems/eldiron/websites/immae/production.nix b/systems/eldiron/websites/immae/production.nix new file mode 100644 index 0000000..e4060ba --- /dev/null +++ b/systems/eldiron/websites/immae/production.nix | |||
@@ -0,0 +1,107 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.immae.production; | ||
4 | varDir = "/var/lib/buildbot/outputs/immae/blog"; | ||
5 | historyDir = "/var/lib/buildbot/outputs/immae/history"; | ||
6 | docsDir = "/var/lib/buildbot/outputs/immae/docs/"; | ||
7 | in { | ||
8 | options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website"; | ||
9 | |||
10 | config = lib.mkIf cfg.enable { | ||
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 | }; | ||
16 | services.webstats.sites = [ { name = "www.immae.eu"; } ]; | ||
17 | |||
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}" = {}; | ||
23 | services.websites.env.production.vhostConfs.immae_production = { | ||
24 | certName = "immae"; | ||
25 | hosts = [ "www.immae.eu" "immae.eu" ]; | ||
26 | root = varDir; | ||
27 | extraConfig = [ | ||
28 | '' | ||
29 | Use Stats www.immae.eu | ||
30 | Header always set Strict-Transport-Security "max-age=31536000" | ||
31 | |||
32 | <LocationMatch /.well-known/(webfinger|host-meta)> | ||
33 | Header always set Referrer-Policy "strict-origin-when-cross-origin" | ||
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 | |||
44 | <Directory ${varDir}> | ||
45 | DirectoryIndex index.htm index.html | ||
46 | Options Indexes FollowSymLinks MultiViews Includes | ||
47 | AllowOverride All | ||
48 | Require all granted | ||
49 | </Directory> | ||
50 | |||
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> | ||
58 | |||
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 | |||
67 | Alias /eurl ${./sarl} | ||
68 | Alias /eurl ${./sarl} | ||
69 | <Directory ${./sarl}> | ||
70 | DirectoryIndex index.htm index.html | ||
71 | Options Indexes FollowSymLinks MultiViews Includes | ||
72 | AllowOverride None | ||
73 | Require all granted | ||
74 | </Directory> | ||
75 | |||
76 | Alias /history ${historyDir} | ||
77 | <Directory ${historyDir}> | ||
78 | DirectoryIndex index.html | ||
79 | AllowOverride None | ||
80 | Require all granted | ||
81 | </Directory> | ||
82 | |||
83 | Alias /.well-known/chatonsinfos ${config.myServices.chatonsProperties.propertiesPath} | ||
84 | <Directory ${config.myServices.chatonsProperties.propertiesPath}> | ||
85 | Options Indexes FollowSymLinks MultiViews Includes | ||
86 | AllowOverride None | ||
87 | Require all granted | ||
88 | </Directory> | ||
89 | '' | ||
90 | ]; | ||
91 | }; | ||
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 | ]; | ||
106 | }; | ||
107 | } | ||