Data items/Technical Site Configuration

From OpenStreetMap Wiki
Jump to navigation Jump to search

Completed steps

  • Add a small custom extension OsmWikibase to modify Wikibase defaults:
cd /srv/wiki.openstreetmap.org/w/extensions
git clone https://github.com/nyurik/OsmWikibase.git
  • Update all Mediawiki extensions to REL1_31
  • Add wikibase extensions code from REL1_31, e.g.
cd /srv/wiki.openstreetmap.org/w/extensions
git clone -b REL1_31 https://gerrit.wikimedia.org/r/mediawiki/extensions/Wikibase.git
cd Wikibase
git submodule update --init --recursive
  • Create /srv/wiki.openstreetmap.org/w/composer.local.json, of if exists, add Wikibase to it:
{
  "extra": {
    "merge-plugin": {
      "include": [
        "extensions/Wikibase/composer.json"
      ]
    }
  }
}
  • Configure Wikibase extension. See Current OSM LocalSettings.php config
  • Run composer install --no-dev from the MW root. We may have to do composer update to get the latest dependencies instead of the locked ones.
  • Update databases: php maintenance/update.php
  • Add this OSM wiki site to the sites table:
/srv/wiki.openstreetmap.org/w# php maintenance/shell.php
>>>
  $site = new OsmWikibase\OsmSite();
  $site->setGlobalId( 'wiki' );
  $site->setGroup( 'osm' );
  $site->setPath( Site::PATH_LINK, "https://wiki.openstreetmap.org/wiki/$1" );
  
  // If updating, make sure to keep internal ID  
  $store = SiteSQLStore::newInstance();
  $oldSite = $store->getSite( $site->getGlobalId() );
  if ( $oldSite ) $site->setInternalId( $oldSite->getInternalId() );
  $store->saveSites( [ $site ] );
  • Edit LocalSettings.php - bump per request memory limit to 500MB:
  $wgMemoryLimit = "500M";

TODO

  • Automate Wikibase data dumps, e.g. via a weekly cron job:
# All params except no-cache are the same as default, so technically not required
# we only have two types of entities, so entity-type is also a noop
php extensions/Wikibase/repo/maintenance/dumpRdf.php \
				--wiki wiki \
				--format ttl \
				--flavor full-dump \
				--entity-type item \
				--entity-type property \
				--no-cache \
     2>> $errorLog | gzip -9 > $tempDir/osmwikibase.gz
mv $tempDir/osmwikibase.gz $publicDir/osmwikibase.gz