config

Pour plus d'infos au sujet de ce document, consulter cette page.

Configuration Wikibase

De nombreuses sources* de documentation existent déjà au sujet instance Wikibase. Le présent document vise donc uniquement à partager les paramètres de configuration utilisés dans le cadre de notre prototype 'DataCegesoma'.

Voici un récapitulatif aussi exhaustif que possible de ces sources :

Fichier docker-compose.yml

In [ ]:
# Wikibase with Query Service
#
# This docker-compose example can be used to pull the images from docker hub.
#
# Examples:
#
# Access Wikibase via "http://localhost:8181"
#   (or "http://$(docker-machine ip):8181" if using docker-machine)
#
# Access Query Service via "http://localhost:8282"
#   (or "http://$(docker-machine ip):8282" if using docker-machine)
version: '3'

services:
  wikibase:
    image: wikibase/wikibase:1.33-bundle #wikibase/wikibase:1.33-bundle
    links:
      - mysql
    ports:
    # CONFIG - Change the 8181 here to expose Wikibase & MediaWiki on a different port
      - "80:80" #"8181:80"
    volumes:
      - mediawiki-images-data:/var/www/html/images
      - quickstatements-data:/quickstatements/data
    depends_on:
    - mysql
    - elasticsearch
    restart: unless-stopped
    networks:
      default:
        aliases:
         - wikibase.svc
           #- adochs1.arch.be
           # CONFIG - Add your real wikibase hostname here, for example wikibase-registry.wmflabs.org
    environment:
      - DB_SERVER=mysql.svc:3306
      - MW_ELASTIC_HOST=elasticsearch.svc
      - MW_ELASTIC_PORT=9200
      # CONFIG - Change the default values below
      - MW_ADMIN_NAME=*** #WikibaseAdmin
      - MW_ADMIN_PASS=*** #WikibaseDockerAdminPass
      - MW_ADMIN_EMAIL=*** #admin@example.com
      - MW_WG_SECRET_KEY=secretkey
      # CONFIG - Change the default values below (should match mysql values in this file)
      - DB_USER=wikiuser
      - DB_PASS=sqlpass
      - DB_NAME=my_wiki
      - QS_PUBLIC_SCHEME_HOST_AND_PORT=https://quickstatements-adochs.arch.be:443
  mysql:
    image: mariadb:10.3
    restart: unless-stopped
    volumes:
      - mediawiki-mysql-data:/var/lib/mysql
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
      # CONFIG - Change the default values below (should match values passed to wikibase)
      MYSQL_DATABASE: 'my_wiki'
      MYSQL_USER: 'wikiuser'
      MYSQL_PASSWORD: 'sqlpass'
    networks:
      default:
        aliases:
         - mysql.svc
  wdqs-frontend:
    image: wikibase/wdqs-frontend:latest
    restart: unless-stopped
    ports:
    # CONFIG - Change the 8282 here to expose the Query Service UI on a different port
     - "8282:80"
    depends_on:
    - wdqs-proxy
    networks:
      default:
        aliases:
         - wdqs-frontend.svc
    environment:
      - WIKIBASE_HOST=adochs.arch.be #wikibase.svc
      - WDQS_HOST=wdqs-proxy.svc
      - BRAND_TITLE=DataCegeSoma Query Service
  wdqs:
    image: wikibase/wdqs:0.3.10
    restart: unless-stopped
    volumes:
      - query-service-data:/wdqs/data
    command: /runBlazegraph.sh
    networks:
      default:
        aliases:
         - wdqs.svc
    environment:
      - WIKIBASE_HOST=adochs.arch.be #wikibase.svc
      - WIKIBASE_SCHEME=https
      - WDQS_HOST=wdqs.svc
      - WDQS_PORT=9999
    expose:
      - 9999
  wdqs-proxy:
    image: wikibase/wdqs-proxy
    restart: unless-stopped
    environment:
      - PROXY_PASS_HOST=wdqs.svc:9999
    ports:
     - "8989:80"
    depends_on:
    - wdqs
    networks:
      default:
        aliases:
         - wdqs-proxy.svc
  wdqs-updater:
    image: wikibase/wdqs:0.3.10
    restart: unless-stopped
    command: /runUpdate.sh
    depends_on:
    - wdqs
    - wikibase
    networks:
      default:
        aliases:
         - wdqs-updater.svc
    environment:
     - WIKIBASE_HOST=adochs.arch.be #wikibase.svc
     - WIKIBASE_SCHEME=https
     - WDQS_HOST=wdqs.svc
     - WDQS_PORT=9999
  elasticsearch:
    image: wikibase/elasticsearch:5.6.14-extra
    restart: unless-stopped
    networks:
      default:
        aliases:
         - elasticsearch.svc
    environment:
      discovery.type: single-node
      ES_JAVA_OPTS: "-Xms512m -Xmx512m"
  # CONFING, in order to not load quickstatements then remove this entire section
  quickstatements:
    image: wikibase/quickstatements:latest
    ports:
     - "9191:80"
    depends_on:
     - wikibase
    volumes:
     - quickstatements-data:/quickstatements/data
    networks:
      default:
        aliases:
         - quickstatements.svc
           #- adochs1.arch.be
           # - adochs.arch.be
    environment:       
     - QS_PUBLIC_SCHEME_HOST_AND_PORT=https://quickstatements-adochs.arch.be:443  #http://localhost:9191
     - WB_PUBLIC_SCHEME_HOST_AND_PORT=https://adochs.arch.be:443  #http://localhost:8181
     - WIKIBASE_SCHEME_AND_HOST=https://adochs.arch.be #http://wikibase.svc
     - WB_PROPERTY_NAMESPACE=122
     - "WB_PROPERTY_PREFIX=Property:"
     - WB_ITEM_NAMESPACE=120
     - "WB_ITEM_PREFIX=Item:"

volumes:
  mediawiki-mysql-data:
  mediawiki-images-data:
  query-service-data:
  quickstatements-data:

Fichier localsettings.php

In [ ]:
<?php
/**
 * ----------------------------------------------------------------------------------------
 * This file is provided by the wikibase/wikibase docker image.
 * This file will be passed through envsubst which will replace "$" with "$".
 * If you want to change MediaWiki or Wikibase settings then either mount a file over this
 * template and or run a different entrypoint.
 * ----------------------------------------------------------------------------------------
 */

## Database settings
## Environment variables will be substituted in here.
$wgDBserver = "mysql.svc:3306";
$wgDBname = "my_wiki";
$wgDBuser = "wikiuser";
$wgDBpassword = "sqlpass";

## Logs
## Save these logs inside the container
$wgDebugLogGroups = [
	'resourceloader' => '/var/log/mediawiki/resourceloader.log',
	'exception' => '/var/log/mediawiki/exception.log',
	'error' => '/var/log/mediawiki/error.log',
];

## Site Settings
# TODO pass in the rest of this with env vars?
$wgShellLocale = "en_US.utf8";
$wgLanguageCode = "${MW_SITE_LANG}"; #MODIF, cf. ec-doris
$wgSitename = "DataCegeSoma"; #MODIF
$wgMetaNamespace = "Project";
# Configured web paths & short URLs
# This allows use of the /wiki/* path
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/w";        // this should already have been configured this way
#$wgScriptPath= ""; #cf. Seb35
$wgArticlePath = "/wiki/$1";

#Set Secret
$wgSecretKey = "secretkey";

## RC Age
# https://www.mediawiki.org/wiki/Manual:
# Items in the recentchanges table are periodically purged; entries older than this many seconds will go.
# The query service (by default) loads data from recent changes
# Set this to 1 year to avoid any changes being removed from the RC table over a shorter period of time.
$wgRCMaxAge = 365 * 24 * 3600;

wfLoadSkin( 'Vector' );

## Wikibase
# Load Wikibase repo, client & lib with the example / default settings.
require_once "$IP/extensions/Wikibase/lib/WikibaseLib.php";
require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";

# OAuth
wfLoadExtension( 'OAuth' );
$wgGroupPermissions['sysop']['mwoauthproposeconsumer'] = true;
$wgGroupPermissions['sysop']['mwoauthmanageconsumer'] = true;
$wgGroupPermissions['sysop']['mwoauthviewprivate'] = true;
$wgGroupPermissions['sysop']['mwoauthupdateownconsumer'] = true;

# WikibaseImport
require_once "$IP/extensions/WikibaseImport/WikibaseImport.php";

# CirrusSearch
wfLoadExtension( 'Elastica' );
require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";
$wgCirrusSearchServers = [ 'elasticsearch.svc' ];
$wgSearchType = 'CirrusSearch';
$wgCirrusSearchExtraIndexSettings['index.mapping.total_fields.limit'] = 5000;

# UniversalLanguageSelector
wfLoadExtension( 'UniversalLanguageSelector' );

# cldr
wfLoadExtension( 'cldr' );

# EntitySchema
wfLoadExtension( 'EntitySchema' );



######
#
#     AJOUTS ANNE (03/04/2020)
#
#####

# add a logo
$wgLogo = "$wgResourceBasePath/images/logo.jpeg";


# Cf. installation Seb35 - NOEMI
#unset ( $wgExtraNamespaces[WB_NS_ITEM] );
#unset ( $wgExtraNamespaces[WB_NS_ITEM_TALK] );
#$wgWBRepoSettings['entityNamespaces']['item'] = NS_MAIN;

$wgWBRepoSettings['siteLinkGroups']=[]; #we don't need sitelinks

$wgLanguageSelectorLanguages= array ("fr","nl","en","de");

# droits et acces

#disallow anonymous editing
$wgGroupPermissions['*']['edit']=false;

#don't let users create their own accounts
$wgGroupPermissions['*']['createaccount']=true;
$wgGroupPermissions['sysop']['createaccount']= true;


# Configure formatterUrl and CanonicalURI
# $wgWBRepoSettings['formatterURLProperty']='P'; 
# $wgWBRepoSettings['canonicalUriProperty']='P';

# Add this to separate the identifiers in a separate section
$wgWBRepoSettings['statementSection']= array(
	'item' => array(
		'statements' => null,
		'identifiers' => array(
			'type' => 'dataType',
			'dataTypes' => array( 'external-id' ),
		),

	),
);


#Allowing file upload
$wgEnableUploads = true;



## EXTENSIONS 
#
wfLoadExtension( 'Gadgets' );

#wfLoadExtension( 'VisualEditor' ); pas compatible avec mediawiki 1.33

wfLoadExtension( 'WikiEditor' );
$wgHiddenPrefs[] = 'usebetatoolbar';

wfLoadExtension('CodeEditor');


#wfLoadExtension('MobileFrontend');
#$wgMFAutodetectMobileView = true;
#$wgMFDefaultSkinClass = 'SkinVector';

wfLoadExtension( 'ConfirmEdit');
wfLoadExtensions(['ConfirmEdit','ConfirmEdit/ReCaptchaNoCaptcha']);

$wgCaptchaClass = 'ReCaptchaNoCaptcha';
$wgReCaptchaSiteKey = '6LfiJegUAAAAAHXtXG4ALYuv0roV4Qo2cwG4kVlb';
$wgReCaptchaSecret = '6LfiJegUAAAAAD6RgOWwmHx2dmxx5Ub7UMULA6eX';

$wgMainCacheType = CACHE_ANYTHING;

$wgCaptchaTriggers['edit'] =false;
$wgCaptchaTriggers['create']=false;
$wgCaptchaTriggers['createtalk'] =true;
$wgCaptchaTriggers['addurl']=false;
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin']= true;
$wgCaptchaTriggers['login']=true;

$wgGroupPermissions['*']['skipcaptcha']=false;
$wgGroupPermissions['user']['skipcaptcha']=false;
$wgGroupPermissions['autoconfirmed']['skipcaptcha']=false;
$wgGroupPermissions['bot']['skipcaptcha']=true; #registered bots
$wgGroupPermissions['sysop']['skipcaptcha']=true;
$wgGroupPermissions['editors']['skipcaptcha']=true;