[Nix-dev] instructions for setting up apache + mediawiki is broken

Bjørn Forsman bjorn.forsman at gmail.com
Sat Jun 29 21:44:38 CEST 2013


On 29 June 2013 11:27, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
> On 29 June 2013 10:54, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>> On 28 June 2013 20:47, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>>> Hi,
>>>
>>> Today I tried setting up Apache + MediaWiki, following this guide:
>>>
>>> http://nixos.org/wiki/Setting_up_MediaWiki_%26_vhosts
>>>
>>> It says I should add this to configuration.nix:
>>>
>>> services.postgresql.enable = true;
>>> services.httpd.enable = true;
>>> services.httpd.adminAddr = "admin at example.org";
>>> services.httpd.extraSubservices =
>>>   [ { serviceType = "mediawiki";
>>>       siteName = "My Wiki";
>>>       logo = "http://www.example.org/wiki-logo.png"; # should be 135x135px
>>>       extraConfig =
>>>         ''
>>>           # See http://www.mediawiki.org/wiki/Manual:Configuration_settings
>>>           $wgEmailConfirmToEdit = true;
>>>         '';
>>>     }
>>>   ];
>>>
>>> But when I nixos-rebuild it fails pretty bad. The build log is below.
>>>
>>> I tried to comment out the httpd config stuff and then I see that
>>> having just "services.prostgresql.enable = true;" fails pretty badly
>>> too.
>>
>> I've added "services.postgresql.package = pkgs.postgresql92;" to the wiki.
>>
>> http://nixos.org/wiki/Setting_up_MediaWiki_%26_vhosts
>
> Ok, so now the configuration builds. Then the wiki says I should create users:
>
> $ mediawiki-main-createAndPromote --bureaucrat God foobar
>
> But that results in this error:
> mediawiki: Creating and promoting User:God...DB connection error: No
> database connection
>
> Running with sudo doesn't help. PostgreSQL is running and I can
> manually connect to the mediawiki database:
>
> $ sudo psql mediawiki
>
> So what is going on here? Is mediawiki broken in nixos or should I be
> using a different version of postgresql?

Looking at the log messages from postgres seems to suggest that I
should run as the mediawiki user, instead of wwwrun:

juni 29 21:20:21 nixos postgres[3897]: [2-1] LOG:  provided user name
(mediawiki) and authenticated user name (wwwrun) do not match
juni 29 21:20:21 nixos postgres[3897]: [3-1] FATAL:  Peer
authentication failed for user "mediawiki"

However...

$ sudo useradd mediawiki

$ sudo -u mediawiki mediawiki-main-createAndPromote --bureaucrat God foobar
mediawiki: Creating and promoting User:God...A database error has
occurred.  Did you forget to run maintenance/update.php after
upgrading?  See:
https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT  user_id  FROM "mwuser"  WHERE user_name = 'God'  LIMIT 1
Function: User::idForName
Error: 42P01 ERROR:  relation "mwuser" does not exist
LINE 1: SELECT /* User::idForName  */  user_id  FROM "mwuser"  WHERE...

So now the database connection is ok. But there is an error and it
suggests that I run the maintenance/update.php script.

$ sudo -u mediawiki php
/nix/store/4wgmybdy33hi54nmqbkdd4i1w65jgis9-mediawiki-1.20.5/maintenance/update.php
MediaWiki 1.20.5 Updater

Going to run database updates for mediawiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown
with --quick) ... 0
Creating sequence logging_log_id_seq
Creating sequence page_restrictions_pr_id_seq
Creating sequence filearchive_fa_id_seq
Fatal error: Call to a member function defaultValue() on a non-object
in /nix/store/4wgmybdy33hi54nmqbkdd4i1w65jgis9-mediawiki-1.20.5/includes/installer/PostgresUpdater.php
on line 570

Ugh... need... help....

Best regards,
Bjørn Forsman


More information about the nix-dev mailing list