This commit is contained in:
Schrottkatze 2023-04-30 14:56:30 +02:00
parent 913bab2fbf
commit 0e23e021c1
5 changed files with 71 additions and 22 deletions

View file

@ -25,7 +25,7 @@
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim wget neofetch vim wget neofetch btop
]; ];
fileSystems."/" = { fileSystems."/" = {

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
#./phtanumb-wiki.nix ./phtanumb-wiki.nix
]; ];
} }

View file

@ -2,22 +2,33 @@
{ {
containers."phtanumb-wiki" = { containers."phtanumb-wiki" = {
autoStart = true; autoStart = true;
localAddress = "127.0.0.1"; hostAddress = "127.0.0.1";
bindMounts = { bindMounts = {
"/var/mediawiki" = { "/var/mediawiki" = {
hostPath = "/phtanum-b/wiki"; hostPath = "/phtanum-b/wiki";
isReadOnly = false; isReadOnly = false;
}; };
}; };
forwardPorts = [
{
protocol = "tcp";
hostPort = 5432;
containerPort = 5432;
}
{
protocol = "tcp";
hostPort = 8081;
containerPort = 8081;
}
];
config = { config, pkgs, ... }: { config = { config, pkgs, ... }: {
services.mediawiki = { services.mediawiki = {
enable = true; enable = true;
name = "phtanum-b"; name = "phtanum-b";
virtualHost.listen = [ virtualHost.listen = [
{ {
ip = "127.0.0.1"; ip = "127.0.0.2";
port = 8080; port = 8081;
ssl = false; ssl = false;
} }
]; ];
@ -27,14 +38,39 @@
extraConfig = '' extraConfig = ''
# Disable anonymous editing # Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['edit'] = false;
$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";
$wgPluggableAuth_Config["katzen.cafe authentication"] = [
'plugin' => 'OpenIDConnect',
'data' => [
'providerURL' => 'https://auth.katzen.cafe/realms/master/',
'clientID' => 'phtanumb-wiki',
'clientsecret' => '/var/mediawiki/keycloakClientSecret',
]
];
''; '';
extensions = {
PluggableAuth = pkgs.fetchzip {
url = "https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_38-5331512.tar.gz";
sha256 = "sha256-OWfr3oq2XzyJ5tynP5bRRPm34ymqz2oIBe2vBPHK+/Q=";
};
OpenIDConnect = pkgs.fetchzip {
url = "https://extdist.wmflabs.org/dist/extensions/OpenIDConnect-REL1_38-8f8bab6.tar.gz";
sha256 = "sha256-g+PGNzt0o2FebI3xyVamz5RA95E86MD2yqD4v8N6zKU=";
};
};
}; };
system.stateVersion = "22.11"; system.stateVersion = "22.11";
}; };
}; };
deployment.keys."passwordFile" = { deployment.keys = {
keyCommand = [ "cat" "/home/jade/keys/phtanumb-wiki/passwordFile" ]; "passwordFile" = {
destDir = "/var/mediawiki"; keyCommand = [ "cat" "/home/jade/keys/phtanumb-wiki/passwordFile" ];
destDir = "/phtanum-b/wiki";
};
"keycloakClientSecret" = {
keyCommand = [ "cat" "/home/jade/keys-tmp/phtanumb-wiki-keycloak-secret" ];
destDir = "/phtanum-b/wiki";
};
}; };
} }

View file

@ -4,12 +4,20 @@
enable = true; enable = true;
settings = { settings = {
http-port = 8097; http-port = 8080;
http-enabled = true;
proxy = "edge"; proxy = "edge";
hostname = "auth.katzen.cafe"; hostname = "auth.katzen.cafe";
hostname-port = "-1";
hostname-admin-url = "https://auth.katzen.cafe";
hostname-strict-backchannel = true; hostname-strict-backchannel = true;
}; };
#sslCertificateKey = "/var/lib/acme/auth.katzen.cafe/key.pem";
#sslCertificate = "/var/lib/acme/auth.katzen.cafe/cert.pem";
database = { database = {
type = "postgresql"; type = "postgresql";
createLocally = true; createLocally = true;

View file

@ -11,10 +11,10 @@
#group = "nginx"; #group = "nginx";
#keyType = "rsa4096"; #keyType = "rsa4096";
#}; #};
#"wiki.phtanum-b.katzen.cafe" = { "wiki.phtanum-b.katzen.cafe" = {
#group = "nginx"; group = "nginx";
#keyType = "rsa4096"; keyType = "rsa4096";
#}; };
"auth.katzen.cafe" = { "auth.katzen.cafe" = {
group = "nginx"; group = "nginx";
keyType = "rsa4096"; keyType = "rsa4096";
@ -24,19 +24,24 @@
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
#"wiki.phtanum-b.katzen.cafe" = { "wiki.phtanum-b.katzen.cafe" = {
#forceSSL = true; forceSSL = true;
#enableACME = true; enableACME = true;
#locations."/" = { locations."/" = {
#proxyPass = "http://127.0.0.1:8080"; proxyPass = "http://127.0.0.2:8081";
#}; };
#}; };
"auth.katzen.cafe" = { "auth.katzen.cafe" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:8097"; proxyPass = "http://127.0.0.1:8080";
}; };
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
'';
}; };
}; };