Skip to content

Commit 1eb9310

Browse files
author
Jkbr
committed
Make LocalSettings.php a host mount to facilitate edits and prevent db install phase.
1 parent 88f311c commit 1eb9310

File tree

3 files changed

+107
-9
lines changed

3 files changed

+107
-9
lines changed

LocalSettings.php

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* ----------------------------------------------------------------------------------------
4+
* This file is provided by the wikibase/wikibase docker image.
5+
* This file will be passed through envsubst which will replace "$" with "$".
6+
* If you want to change MediaWiki or Wikibase settings then either mount a file over this
7+
* template and or run a different entrypoint.
8+
* ----------------------------------------------------------------------------------------
9+
*/
10+
11+
## Database settings
12+
## Environment variables will be substituted in here.
13+
$wgDBserver = "mysql.svc:3306";
14+
$wgDBname = "scisrc_wiki";
15+
$wgDBuser = "wikiuser";
16+
$wgDBpassword = "qsV5Hj9D$<b;)6w3";
17+
18+
## Logs
19+
## Save these logs inside the container
20+
$wgDebugLogGroups = array(
21+
'resourceloader' => '/var/log/mediawiki/resourceloader.log',
22+
'exception' => '/var/log/mediawiki/exception.log',
23+
'error' => '/var/log/mediawiki/error.log',
24+
);
25+
26+
## Site Settings
27+
# TODO pass in the rest of this with env vars?
28+
$wgShellLocale = "en_US.utf8";
29+
$wgLanguageCode = "en";
30+
$wgSitename = "ScienceSource";
31+
$wgMetaNamespace = "Project";
32+
# Configured web paths & short URLs
33+
# This allows use of the /wiki/* path
34+
## https://www.mediawiki.org/wiki/Manual:Short_URL
35+
$wgScriptPath = "/w"; // this should already have been configured this way
36+
$wgArticlePath = "/wiki/$1";
37+
38+
#Set Secret
39+
$wgSecretKey = "secretkey";
40+
41+
## RC Age
42+
# https://www.mediawiki.org/wiki/Manual:
43+
# Items in the recentchanges table are periodically purged; entries older than this many seconds will go.
44+
# The query service (by default) loads data from recent changes
45+
# Set this to 1 year to avoid any changes being removed from the RC table over a shorter period of time.
46+
$wgRCMaxAge = 365 * 24 * 3600;
47+
48+
wfLoadSkin( 'Vector' );
49+
50+
## Wikibase
51+
# Load Wikibase repo, client & lib with the example / default settings.
52+
require_once "$IP/extensions/Wikibase/vendor/autoload.php";
53+
require_once "$IP/extensions/Wikibase/lib/WikibaseLib.php";
54+
require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
55+
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
56+
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
57+
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
58+
# OAuth
59+
wfLoadExtension( 'OAuth' );
60+
$wgGroupPermissions['sysop']['mwoauthproposeconsumer'] = true;
61+
$wgGroupPermissions['sysop']['mwoauthmanageconsumer'] = true;
62+
$wgGroupPermissions['sysop']['mwoauthviewprivate'] = true;
63+
$wgGroupPermissions['sysop']['mwoauthupdateownconsumer'] = true;
64+
65+
# WikibaseImport
66+
require_once "$IP/extensions/WikibaseImport/WikibaseImport.php";
67+
68+
# CirrusSearch
69+
wfLoadExtension( 'Elastica' );
70+
require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";
71+
$wgCirrusSearchServers = [ 'elasticsearch.svc' ];
72+
$wgSearchType = 'CirrusSearch';
73+
$wgCirrusSearchExtraIndexSettings['index.mapping.total_fields.limit'] = 5000;
74+
75+
$wgLogo = '/scisrclogo.svg';
76+
77+
# Define constants for additional namespaces.
78+
define("NS_ARTICLE", 3100); // This MUST be even.
79+
define("NS_ARTICLE_TALK", 3101); // This MUST be the following odd integer.
80+
81+
# Add namespaces.
82+
$wgExtraNamespaces[NS_ARTICLE] = "Article";
83+
$wgExtraNamespaces[NS_ARTICLE_TALK] = "Article_talk"; // Note underscores in the namespace name.
84+
85+
$wgScriptPath = "/w"; // this should already have been configured this way
86+
$wgArticlePath = "/wiki/$1";
87+
88+
## Shared memory settings
89+
$wgMainCacheType = CACHE_ANYTHING;
90+
$wgSessionsInObjectCache = true;
91+
92+
# Initially prevent unknown users from creating accounts or editing
93+
#$wgGroupPermissions['*']['edit'] = false;
94+
#$wgGroupPermissions['*']['createaccount'] = false;
95+
96+
require_once "$IP/extensions/NamespaceHTML/NamespaceHTML.php";
97+
98+
$wgRawHtmlNamespaces = array( NS_ARTICLE ); # allow raw HTML but only in the Article namespace
99+
100+
session_save_path("tmp");

docker-compose-build.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ services:
2020
ports:
2121
- "8181:80"
2222
volumes:
23-
- /var/www/html/images:/var/www/html/images
23+
- /var/www/html/images:/var/www/html/images
24+
- /var/www/html/LocalSettings.php:/var/www/html/LocalSettings.php
2425
depends_on:
2526
- mysql
2627
- elasticsearch
@@ -41,7 +42,7 @@ services:
4142
mysql:
4243
image: mariadb:10.3
4344
volumes:
44-
- /var/lib/mysql_wikibase:/var/lib/mysql
45+
- /srv/mysql_wikibase:/var/lib/mysql
4546
environment:
4647
MYSQL_DATABASE: ${MYSQL_DATABASE}
4748
MYSQL_USER: ${MYSQL_USER}
@@ -82,7 +83,7 @@ services:
8283
context: ./wdqs/0.3.1
8384
dockerfile: Dockerfile
8485
volumes:
85-
- query-service-data:/wdqs/data
86+
- /srv/queryservice-data_wikibase:/wdqs/data
8687
command: /runBlazegraph.sh
8788
networks:
8889
default:
@@ -141,7 +142,3 @@ services:
141142
# - "WB_PROPERTY_PREFIX=Property:"
142143
# - WB_ITEM_NAMESPACE=120
143144
# - "WB_ITEM_PREFIX=Item:"
144-
145-
volumes:
146-
query-service-data:
147-

docker-compose.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ services:
2323
- "8181:80"
2424
volumes:
2525
- /var/www/html/images:/var/www/html/images
26+
- /var/www/html/LocalSettings.php:/var/www/html/LocalSettings.php
2627
depends_on:
2728
- mysql
2829
- elasticsearch
@@ -46,7 +47,7 @@ services:
4647
image: mariadb:10.3
4748
restart: always
4849
volumes:
49-
- /var/lib/mysql_wikibase:/var/lib/mysql
50+
- /srv/mysql_wikibase:/var/lib/mysql
5051
environment:
5152
MYSQL_DATABASE: ${MYSQL_DATABASE}
5253
MYSQL_USER: ${MYSQL_USER}
@@ -73,7 +74,7 @@ services:
7374
wdqs:
7475
image: wikibase/wdqs:0.3.1
7576
volumes:
76-
- /var/lib/queryservice-data_wikibase:/wdqs/data
77+
- /srv/queryservice-data_wikibase:/wdqs/data
7778
command: /runBlazegraph.sh
7879
networks:
7980
default:

0 commit comments

Comments
 (0)