env = config.myEnv.tools.mastodon;
root = "${mcfg.workdir}/public/";
cfg = config.myServices.websites.tools.mastodon;
- mcfg = config.services.mastodon;
+ mcfg = config.immaeServices.mastodon;
in {
options.myServices.websites.tools.mastodon = {
enable = lib.mkEnableOption "enable mastodon's website";
};
config = lib.mkIf cfg.enable {
+ myServices.dns.zones."immae.eu".subdomains.mastodon =
+ with config.myServices.dns.helpers; ips servers.eldiron.ips.main;
+
+ myServices.chatonsProperties.services.mastodon = {
+ file.datetime = "2022-08-21T19:50:00";
+ service = {
+ name = "Mastodon";
+ description = "Your self-hosted, globally interconnected microblogging community";
+ website = "https://mastodon.immae.eu/";
+ logo = "https://mastodon.immae.eu/apple-touch-icon.png";
+ status.level = "OK";
+ status.description = "OK";
+ registration."" = ["MEMBER" "CLIENT"];
+ registration.load = "OPEN";
+ install.type = "PACKAGE";
+ };
+ software = {
+ name = "Mastodon";
+ website = "https://joinmastodon.org/";
+ license.url = "https://github.com/tootsuite/mastodon/blob/master/LICENSE";
+ license.name = "GNU General Public License v3.0";
+ version = mcfg.package.version;
+ source.url = "https://github.com/tootsuite/mastodon";
+ };
+ };
secrets.keys."webapps/tools-mastodon" = {
user = "mastodon";
group = "mastodon";
LDAP_SEARCH_FILTER="${env.ldap.filter}"
'';
};
- services.mastodon = {
+ immaeServices.mastodon = {
enable = true;
configFile = config.secrets.fullPaths."webapps/tools-mastodon";
socketsPrefix = "live_immae";
services.websites.env.tools.modules = [
"headers" "proxy" "proxy_wstunnel" "proxy_http"
];
+ security.acme.certs.eldiron.extraDomainNames = [ "mastodon.immae.eu" ];
services.websites.env.tools.vhostConfs.mastodon = {
certName = "eldiron";
- addToCerts = true;
hosts = ["mastodon.immae.eu" ];
root = root;
extraConfig = [ ''
RewriteEngine On
- ProxyPass /500.html !
- ProxyPass /sw.js !
- ProxyPass /embed.js !
- ProxyPass /robots.txt !
- ProxyPass /manifest.json !
- ProxyPass /browserconfig.xml !
- ProxyPass /mask-icon.svg !
- ProxyPassMatch ^(/.*\.(png|ico|gif)$) !
- ProxyPassMatch ^/(assets|avatars|emoji|headers|packs|sounds|system|.well-known/acme-challenge) !
-
RewriteRule ^/api/v1/streaming/(.+)$ unix://${mcfg.sockets.node}|http://mastodon.immae.eu/api/v1/streaming/$1 [P,NE,QSA,L]
+ RewriteRule ^/api/v1/streaming/public$ unix://${mcfg.sockets.node}|http://mastodon.immae.eu/api/v1/streaming/public [P,NE,QSA,L]
RewriteRule ^/api/v1/streaming/$ unix://${mcfg.sockets.node}|ws://mastodon.immae.eu/ [P,NE,QSA,L]
- ProxyPass / unix://${mcfg.sockets.rails}|http://mastodon.immae.eu/
+ RewriteCond %{REQUEST_URI} !/500.html
+ RewriteCond %{REQUEST_URI} !/sw.js
+ RewriteCond %{REQUEST_URI} !/embed.js
+ RewriteCond %{REQUEST_URI} !/robots.txt
+ RewriteCond %{REQUEST_URI} !/manifest.json
+ RewriteCond %{REQUEST_URI} !/browserconfig.xml
+ RewriteCond %{REQUEST_URI} !/mask-icon.svg
+ RewriteCond %{REQUEST_URI} !^(/.*\.(png|ico|gif)$)
+ RewriteCond %{REQUEST_URI} !^/(assets|avatars|emoji|headers|packs|sounds|system|.well-known/acme-challenge)
+ RewriteRule ^/(.*)$ unix:///run/mastodon/live_immae_puma.sock|http://mastodon.immae.eu/$1 [P,NE,QSA,L]
ProxyPassReverse / unix://${mcfg.sockets.rails}|http://mastodon.immae.eu/
Alias /system ${mcfg.dataDir}
ErrorDocument 504 /500.html
'' ];
};
+ myServices.monitoring.fromMasterActivatedPlugins = [ "http" ];
+ myServices.monitoring.fromMasterObjects.service = [
+ {
+ service_description = "mastodon website is running on mastodon.immae.eu";
+ host_name = config.hostEnv.fqdn;
+ use = "external-web-service";
+ check_command = ["check_https" "mastodon.immae.eu" "/" "Mastodon</title>"];
+
+ servicegroups = "webstatus-webapps";
+ _webstatus_name = "Mastodon";
+ _webstatus_url = "https://mastodon.immae.eu/";
+ }
+ ];
};
}