Create automated install/repeatable dev environment for IABot
Closed, ResolvedPublic5 Story Points

Description

Use MediaWiki-Vagrant or a similar system to automate provisioning and configuring a local development environment for IABot.

IABot code: https://github.com/cyberpower678/Cyberbot_II

bd808 created this task.Aug 1 2016, 6:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 1 2016, 6:08 PM
DannyH set the point value for this task to 5.Aug 1 2016, 6:41 PM
kaldari assigned this task to bd808.Aug 1 2016, 8:11 PM
Restricted Application added a project: User-bd808. · View Herald TranscriptAug 1 2016, 8:11 PM
kaldari updated the task description. (Show Details)Aug 1 2016, 8:24 PM

Change 302350 had a related patch set uploaded (by BryanDavis):
[WIP] InternetArchiveBot role

https://gerrit.wikimedia.org/r/302350

bd808 moved this task from To Do to In Dev/Progress on the User-bd808 board.Aug 1 2016, 11:56 PM

@bd808: I get 2 warnings when I provision this role:

default: Warning: Scope(Class[Role::Iabot]): Could not look up qualified variable '::mediawiki::server_url'; class ::mediawiki has not been evaluated
default: Warning: Scope(Class[Role::Iabot]): Could not look up qualified variable '::mediawiki::server_url'; class ::mediawiki has not been evaluated

right after:

default: Info: Loading facts in /vagrant/puppet/modules/stdlib/lib/facter/root_home.rb

Is there something else I need to configure first. I haven't seen this with other roles I've enabled.

bd808 added a comment.Aug 9 2016, 10:19 PM

Is there something else I need to configure first. I haven't seen this with other roles I've enabled.

No, that was just forgetting to make the dependency on ::role::mediawiki explicit. Hopefully https://gerrit.wikimedia.org/r/#/c/302350/8 will fix that.

No warnings now, but if I try to go to http://127.0.0.1:8080/wiki/User:InternetArchiveBot, it says: User account "InternetArchiveBot" is not registered.

bd808 added a comment.Aug 10 2016, 4:40 AM

No warnings now, but if I try to go to http://127.0.0.1:8080/wiki/User:InternetArchiveBot, it says: User account "InternetArchiveBot" is not registered.

The user account that the role creates is named "VagrantInternetArchiveBot"

That's not what the Commit Message says :)

@bd808: Running the deadlink.php script gives me the following error:

ERROR: Invalid identify response: {"error":"mwoauth-oauth-exception","message":"An error occurred in the OAuth protocol: Invalid signature"}
bd808 added a comment.Aug 10 2016, 5:10 PM

@bd808: Running the deadlink.php script gives me the following error:

ERROR: Invalid identify response: {"error":"mwoauth-oauth-exception","message":"An error occurred in the OAuth protocol: Invalid signature"}

I can reproduce that locally with e961e43 (Update IABot to v1.2beta) checked out. I'll see if I can figure out what has changed in the code and needs to be updated in the generated config.

bd808 added a comment.Aug 12 2016, 3:38 PM

I can reproduce that locally with e961e43 (Update IABot to v1.2beta) checked out. I'll see if I can figure out what has changed in the code and needs to be updated in the generated config.

This regression should be fixed now. I'm not sure how I messed up the 6 magic numbers that make up the OAuth grant keys, but recreating them from scratch seems to have fixed things. I also converted the on-wiki config page to the new js/json format.

This time I got the following error when trying to provision the role:

Error: Could not find dependency Mediawiki::Maintenance[Pass 0 of CentralAuth] for Mediawiki::Maintenance[migrate_user_VagrantInternetArchiveBot_to_centralauth] at /vagrant/puppet/modules/role/manifests/centralauth/migrate_user.pp:21

This time I got the following error when trying to provision the role:

Error: Could not find dependency Mediawiki::Maintenance[Pass 0 of CentralAuth] for Mediawiki::Maintenance[migrate_user_VagrantInternetArchiveBot_to_centralauth] at /vagrant/puppet/modules/role/manifests/centralauth/migrate_user.pp:21

Blerg. That sounds like my check for CA being enabled is not written correctly. I'll look into it.

Firstly, I'm not subscribed? :O

Secondly, it's my turn to say I'm lost. :p

bd808 added a comment.Aug 13 2016, 5:35 AM

Secondly, it's my turn to say I'm lost. :p

@Cyberpower678 https://gerrit.wikimedia.org/r/#/c/302350/ is a patch to add a role to the MediaWiki-Vagrant project that clones the Cyberbot_II repo and sets up configuration for IABot and the local wiki in the Vagrant manged virtual machine. You can test it out by installing MediaWiki-Vagrant, applying the patch, and running vagrant roles apply iabot; vagrant up. After Vagrant is done running you can ssh into the virtual machine and run the bot:

$ vagrant ssh
$ cd /vagrant/srv/iabot/IABot/
$ php deadlink.php

That's pretty cool. :D

Hmm, now it's back to giving me:

Logging on as VagrantInternetArchiveBot...Failed!!
ERROR: Invalid identify response: {"error":"mwoauth-oauth-exception","message":"An error occurred in the OAuth protocol: Invalid signature"}

That's with patchset 12 and a fresh reprovision.

I didn't check if the tokens were valid. Sorry. :p

bd808 added a comment.Aug 19 2016, 8:21 PM

Hmm, now it's back to giving me:

Logging on as VagrantInternetArchiveBot...Failed!!
ERROR: Invalid identify response: {"error":"mwoauth-oauth-exception","message":"An error occurred in the OAuth protocol: Invalid signature"}

That's with patchset 12 and a fresh reprovision.

I'm pretty sure that this is caused by T143448: Unconditionally setting $wgOAuthSecretKey in MWOAuthHooks::onExtensionRegistration breaks LocalSettings.php override. I'll see if I can fix that bug and then retest.

Hmm, now it's back to giving me:

Logging on as VagrantInternetArchiveBot...Failed!!
ERROR: Invalid identify response: {"error":"mwoauth-oauth-exception","message":"An error occurred in the OAuth protocol: Invalid signature"}

That's with patchset 12 and a fresh reprovision.

I'm pretty sure that this is caused by T143448: Unconditionally setting $wgOAuthSecretKey in MWOAuthHooks::onExtensionRegistration breaks LocalSettings.php override. I'll see if I can fix that bug and then retest.

The problems with OAuth signatures not working were caused by a change in the configuration layer of the OAuth extension (https://gerrit.wikimedia.org/r/#/c/305739/). I should have tracked this down when the original configuration data stopped working. That should be fixed in master now, but you will need to run vagrant git-update or manually update your mediawiki/extensions/OAuth clone.

Now I just get the rather generic error...

Logging on as VagrantInternetArchiveBot...Failed!!
ERROR: Missing authorization or authorization failed

Started from a totally clean VM and got the following error...

PHP Warning:  mysqli_connect(): (HY000/1045): Access denied for user 'iabot'@'localhost' (using password: YES) in /Users/kaldari/Sites/vagrant/srv/iabot/IABot/DB.php on line 442

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'iabot'@'localhost' (using password: YES) in /Users/kaldari/Sites/vagrant/srv/iabot/IABot/DB.php on line 442
kaldari closed this task as Resolved.Aug 22 2016, 11:13 PM

Bah! I wasn't running it inside the vagrant ssh. It looks like it works now!

Change 302350 merged by jenkins-bot:
InternetArchiveBot role

https://gerrit.wikimedia.org/r/302350

bd808 moved this task from In Dev/Progress to Archive on the User-bd808 board.Sep 1 2016, 5:13 PM