serve static files for mastodon correctly
This commit is contained in:
parent
d247beb91e
commit
ac3ecc749b
1 changed files with 26 additions and 26 deletions
|
@ -13,6 +13,20 @@ let
|
||||||
gid = 3049;
|
gid = 3049;
|
||||||
systemUserName = "mastodon";
|
systemUserName = "mastodon";
|
||||||
systemGroupName = "mastodon";
|
systemGroupName = "mastodon";
|
||||||
|
users = {
|
||||||
|
users."${systemUserName}" = {
|
||||||
|
uid = uid;
|
||||||
|
isSystemUser = true;
|
||||||
|
isNormalUser = false;
|
||||||
|
group = systemGroupName;
|
||||||
|
};
|
||||||
|
groups."${systemGroupName}" = {
|
||||||
|
gid = gid;
|
||||||
|
members = [ "${systemUserName}" "nginx" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
package =
|
||||||
|
inputs.nixpkgs-nixos-unstable.legacyPackages."${pkgs.system}".mastodon;
|
||||||
in {
|
in {
|
||||||
imports = [ ../nginx.nix ];
|
imports = [ ../nginx.nix ];
|
||||||
|
|
||||||
|
@ -21,18 +35,17 @@ in {
|
||||||
"${domain}" = {
|
"${domain}" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
root = "${config.services.mastodon.package}/public/";
|
root = "${package}/public/";
|
||||||
|
|
||||||
locations."/system/".alias = "${path}/public-system/";
|
|
||||||
|
|
||||||
locations."/" = { tryFiles = "$uri @proxy"; };
|
locations."/" = { tryFiles = "$uri @proxy"; };
|
||||||
|
locations."/system/".alias = "${path}/public-system/";
|
||||||
|
|
||||||
locations."@proxy" = {
|
locations."@proxy" = {
|
||||||
proxyPass = "http://localhost:" + toString webPort;
|
proxyPass = "http://127.0.0.1:" + toString webPort;
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
locations."/api/v1/streaming/" = {
|
locations."/api/v1/streaming/" = {
|
||||||
proxyPass = "http://localhost:" + toString streamingPort;
|
proxyPass = "http://127.0.0.1:" + toString streamingPort;
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -51,16 +64,9 @@ in {
|
||||||
owner = systemUserName;
|
owner = systemUserName;
|
||||||
group = systemGroupName;
|
group = systemGroupName;
|
||||||
};
|
};
|
||||||
users.users."${systemUserName}" = {
|
|
||||||
uid = uid;
|
inherit users;
|
||||||
isSystemUser = true;
|
|
||||||
isNormalUser = false;
|
|
||||||
group = systemGroupName;
|
|
||||||
};
|
|
||||||
users.groups."${systemGroupName}" = {
|
|
||||||
gid = gid;
|
|
||||||
members = [ "${systemUserName}" ];
|
|
||||||
};
|
|
||||||
containers.mastodon = {
|
containers.mastodon = {
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
forwardPorts = [
|
forwardPorts = [
|
||||||
|
@ -90,20 +96,13 @@ in {
|
||||||
config = { config, pkgs, lib, ... }: {
|
config = { config, pkgs, lib, ... }: {
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
services.postgresql.port = postgresPort;
|
services.postgresql.port = postgresPort;
|
||||||
users.mutableUsers = false;
|
users = users // {
|
||||||
users.allowNoPasswordLogin = true;
|
mutableUsers = false;
|
||||||
users.users."${systemUserName}" = {
|
allowNoPasswordLogin = true;
|
||||||
uid = uid;
|
|
||||||
isSystemUser = true;
|
|
||||||
isNormalUser = false;
|
|
||||||
group = systemGroupName;
|
|
||||||
};
|
|
||||||
users.groups."${systemGroupName}" = {
|
|
||||||
gid = gid;
|
|
||||||
members = [ "${systemUserName}" ];
|
|
||||||
};
|
};
|
||||||
services.mastodon = {
|
services.mastodon = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
inherit package;
|
||||||
localDomain = "${domain}";
|
localDomain = "${domain}";
|
||||||
user = systemUserName;
|
user = systemUserName;
|
||||||
group = systemGroupName;
|
group = systemGroupName;
|
||||||
|
@ -120,6 +119,7 @@ in {
|
||||||
SMTP_TLS = "true";
|
SMTP_TLS = "true";
|
||||||
SMTP_ENABLE_STARTTLS_AUTO = "true";
|
SMTP_ENABLE_STARTTLS_AUTO = "true";
|
||||||
SINGLE_USER_MODE = "true";
|
SINGLE_USER_MODE = "true";
|
||||||
|
RAILS_SERVE_STATIC_FILES = "true";
|
||||||
};
|
};
|
||||||
inherit streamingPort;
|
inherit streamingPort;
|
||||||
inherit webPort;
|
inherit webPort;
|
||||||
|
|
Loading…
Reference in a new issue