Jump to content

MediaWiki: Difference between revisions

m
imported>Redvers
(Initial mediawiki guide.)
 
 
(20 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[https://www.mediawiki.org/wiki/MediaWiki Mediawiki] is available in NixOS.
[https://mediawiki.org/ {{PAGENAME}}] ([[wikipedia:en:{{PAGENAME}}]]) is available as a [[module]].


== Overview ==
== Configuration Examples ==
=== Small Configuration ===


At the time of writing the mediawiki expression exists as an apache subservice. In the future this the build part of the expression will need to move to its own package. This will require a change in the future and we will endeavor to have a deprecation message inform you of the syntax changes required to migrate when the time comes.
<syntaxhighlight lang="nix">
services.mediawiki = {
  enable = true;
  name = "Sample MediaWiki";
  httpd.virtualHost = {
    hostName = "example.com";
    adminAddr = "admin@example.com";
  };
  # Administrator account username is admin.
  # Set initial password to "cardbotnine" for the account admin.
  passwordFile = pkgs.writeText "password" "cardbotnine";
  extraConfig = ''
    # Disable anonymous editing
    $wgGroupPermissions['*']['edit'] = false;
  '';


===installation===
  extensions = {
    # some extensions are included and can enabled by passing null
    VisualEditor = null;


There are a few things you need to configure in order to use the existing tooling. Install your database of choice and create the database user and password as required.
    # https://www.mediawiki.org/wiki/Extension:TemplateStyles
    TemplateStyles = pkgs.fetchzip {
      url = "https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_40-c639c7a.tar.gz";
      hash = "sha256-YBL0Cs4hDSNnoutNJSJBdLsv9zFWVkzo7m5osph8QiY=";
    };
  };
};
</syntaxhighlight>


For the simplest default configuration, in <code>configuration.nix</code>, add: <syntaxhighlight lang=nix>{
== Web Server ==
  ...
  services.httpd.extraSubservices =
    [ { serviceType = "mediawiki";
        siteName = "your.sitename.here";
        id = "unique_identifier";
        dbName = "dbname";
        dbUser = "dbusername";
        dbPassword = "redacted";
        defaultSkin = "MonoBook";
        extraConfig = ''
          wfLoadSkin( 'MonoBook' );
          wfLoadExtension( 'WikiEditor' );
          $wgDefaultUserOptions['usebetatoolbar'] = 1;
        '';
      }
    ];
  ...
}</syntaxhighlight>


By default, the <code>services.mediawiki</code> module creates a <code>services.httpd.virtualHost</code> which can be configured via the <code>services.mediawiki.httpd.virtualHost</code> submodule.


=== Known Issues ===
If you are using another web server (like Nginx), you can configure MediaWiki for a reverse proxy with the <code>services.mediawiki.virtualHost.listen</code> option:


There are several known issues with the package which will be remediated when we re-factor it out of a subService. To name a few:
<syntaxhighlight lang="nix">
services.mediawiki.httpd.virtualHost.listen = [
  {
    ip = "127.0.0.1";
    port = 8080;
    ssl = false;
  }
];
</syntaxhighlight>


# The database creation scripts run as 'root' for postgresql and fail. To fix this you can temporarily grant root dba access, run your first installation and revoke.
Alternatively, <code>services.mediawiki.webserver</code> can be set to <code>"nginx"</code> to use nginx instead of apache.
# It is ideal if we can have a working, secure, default installation without having to fall-back to extraConfig.  We're not there yet.


=== Halp?! ===
== Troubleshooting ==
=== Edit php.ini ===
An fpm pool is automatically created when Mediawiki is enabled. The <code>php.ini</code> file can be modified by using <code>phpOptions</code>. The following example shows how to increase the allowed file upload size.


__red__ on freenode.
<syntaxhighlight lang="nix">
services.phpfpm.pools.mediawiki.phpOptions = ''
    upload_max_filesize = 10M
    post_max_size = 15M
'';
</syntaxhighlight>


== See Also ==
* [https://github.com/NixOS/nixos-wiki-infra Configuration of the NixOS wiki]
* [https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/mediawiki.nix nixos/tests/mediawiki.nix]
* [[Dokuwiki]], simple PHP- and web-based wiki software which uses file based storage for its content.
* [[Outline]], a modern web based wiki and knowledge base for teams.




[[Category:Guide]]
[[Category:Guide]]
[[Category:Server]]
[[Category:Web Applications]]
trusted
596

edits