Talk:MediaWiki: Difference between revisions

From NixOS Wiki
Latest comment: 26 May 2021 by Makefu
imported>Vater
imported>Vater
 
Line 7: Line 7:
==== minimal configuration ====
==== minimal configuration ====
: tested on NixOS 21.11
: tested on NixOS 21.11
: with a working setup for networking


<!--
----
: <syntaxhighlight lang="bash">touch /tmp/configuration.nix_services_mediawiki_passwordFile</syntaxhighlight>
 
<!--
: <syntaxhighlight lang="bash">touch /run/keys/mediawiki-password</syntaxhighlight>
: <syntaxhighlight lang="bash">$EDITOR /run/keys/mediawiki-password</syntaxhighlight>
: <syntaxhighlight lang="bash">$EDITOR /run/keys/mediawiki-password</syntaxhighlight>
: <syntaxhighlight lang="bash">cat /run/keys/mediawiki-password</syntaxhighlight>
: <syntaxhighlight lang="bash">cat /run/keys/mediawiki-password</syntaxhighlight>
<!--
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
an-initial-password-for-mediawiki-on-a-not-secure-place-to-store-a-password
this-is-an-initial-password-for-mediawiki
</syntaxhighlight>
 
: <syntaxhighlight lang="bash">$EDITOR /etc/nixos/configuration.nix</syntaxhighlight>
<syntaxhighlight lang="nix">
{ config, pkgs, ... }:
 
{
</syntaxhighlight>
</syntaxhighlight>
-->
<syntaxhighlight lang="nix"></syntaxhighlight>
<syntaxhighlight lang="bash">
<syntaxhighlight lang="nix">
this-is-an-initial-password-for-mediawiki
  services.mediawiki.enable = true;
  services.mediawiki.virtualHost.hostName = "mediawiki.example.org";
  services.mediawiki.virtualHost.adminAddr = "admin@example.org";
  services.mediawiki.passwordFile = "/run/keys/mediawiki-password";
  networking.firewall.allowedTCPPorts = [ 80 ];
}
</syntaxhighlight>
</syntaxhighlight>
: <syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight>
fails
----
: <syntaxhighlight lang="bash">cp --preserve=all /var/lib/mediawiki/secret.key /var/lib/mediawiki/passwordFile</syntaxhighlight>
: <syntaxhighlight lang="bash">cat /run/keys/mediawiki-password > /var/lib/mediawiki/passwordFile</syntaxhighlight>


: <syntaxhighlight lang="bash">$EDITOR /etc/nixos/configuration.nix</syntaxhighlight>
: <syntaxhighlight lang="bash">$EDITOR /etc/nixos/configuration.nix</syntaxhighlight>
: <syntaxhighlight lang="bash">$EDITOR /tmp/configuration.nix_services_mediawiki_passwordFile</syntaxhighlight>
<syntaxhighlight lang="nix"></syntaxhighlight>
<syntaxhighlight lang="nix"></syntaxhighlight>
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
#  services.mediawiki.passwordFile = "/run/keys/mediawiki-password";
#  services.mediawiki.passwordFile = "/tmp/configuration.nix_services_mediawiki_passwordFile";
  services.mediawiki.passwordFile = "/var/lib/mediawiki/passwordFile";
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="nix"></syntaxhighlight>
<syntaxhighlight lang="nix"></syntaxhighlight>
: <syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight>
works

Latest revision as of 10:11, 31 March 2022

Now that there is `services.mediawiki` i think this article needs to be revised. I am somewhat struggling to get the whole setup running, there are just so many configuration options and it is not clear what actually needs to be done I was looking for a nixos container setup which gets requests forwarded from the host system but maybe it is enough to have mediawiki listen on the a port != 80 --Makefu (talk) 07:28, 26 May 2021 (UTC)Reply

configuration examples

minimal configuration

tested on NixOS 21.11
with a working setup for networking

touch /run/keys/mediawiki-password
$EDITOR /run/keys/mediawiki-password
cat /run/keys/mediawiki-password
this-is-an-initial-password-for-mediawiki
$EDITOR /etc/nixos/configuration.nix
{ config, pkgs, ... }:

{
  services.mediawiki.enable = true;
  services.mediawiki.virtualHost.hostName = "mediawiki.example.org";
  services.mediawiki.virtualHost.adminAddr = "admin@example.org";
  services.mediawiki.passwordFile = "/run/keys/mediawiki-password";
  networking.firewall.allowedTCPPorts = [ 80 ];
}
nixos-rebuild switch

fails


cp --preserve=all /var/lib/mediawiki/secret.key /var/lib/mediawiki/passwordFile
cat /run/keys/mediawiki-password > /var/lib/mediawiki/passwordFile
$EDITOR /etc/nixos/configuration.nix
#  services.mediawiki.passwordFile = "/run/keys/mediawiki-password";
#  services.mediawiki.passwordFile = "/tmp/configuration.nix_services_mediawiki_passwordFile";
  services.mediawiki.passwordFile = "/var/lib/mediawiki/passwordFile";
nixos-rebuild switch

works