Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/298299
Change subject: [labs/deployment-prep] Switch file backends to swift
......................................................................
[labs/deployment-prep] Switch file backends to swift
Private settings added in 2738c20729b021bb1246638c4b3d076e8872a5f8
TODO:
* Cirrus key?
* Temp url key?
* GWToolset
* Timeline
Bug: T64835
Change-Id: I945ca37e1be79117ef40a5b42fffab3b87ff3b26
---
M wmf-config/LabsServices.php
M wmf-config/filebackend-labs.php
2 files changed, 189 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/99/298299/1
diff --git a/wmf-config/LabsServices.php b/wmf-config/LabsServices.php
index 3340591..012befd 100644
--- a/wmf-config/LabsServices.php
+++ b/wmf-config/LabsServices.php
@@ -30,6 +30,10 @@
'upload' => false,
'cxserver' => 'http://deployment-sca01.eqiad.wmflabs:8080',
'irc' => 'irc.beta.wmflabs.org', // deployment-ircd
+ 'redis_lock' => [
+ 'memc04' => '10.68.23.25', //
deployment-memc04.deployment-prep.eqiad.wmflabs
+ 'memc05' => '10.68.23.49', //
deployment-memc05.deployment-prep.eqiad.wmflabs
+ ],
];
### Logstash
diff --git a/wmf-config/filebackend-labs.php b/wmf-config/filebackend-labs.php
index 9e115ac..9326034 100644
--- a/wmf-config/filebackend-labs.php
+++ b/wmf-config/filebackend-labs.php
@@ -14,22 +14,183 @@
$wgTimelineSettings->fileBackend = '';
}
-// labs does not have swift yet as of 20120525 -- hashar
+// Common OpenStack Swift backend convenience variables
+$wmfSwiftBigWikis = [ # DO NOT change without proper migration first
+ 'commonswiki', 'dewiki', 'enwiki', 'fiwiki', 'frwiki', 'hewiki',
'huwiki', 'idwiki',
+ 'itwiki', 'jawiki', 'rowiki', 'ruwiki', 'thwiki', 'trwiki', 'ukwiki',
'zhwiki'
+];
+$wmfSwiftShardLocal = in_array( $wgDBname, $wmfSwiftBigWikis ) ? 2 : 0; //
shard levels
+$wmfSwiftShardCommon = in_array( 'commonswiki', $wmfSwiftBigWikis ) ? 2 : 0;
// shard levels
+/* DC-specific Swift backend config */
+$wgFileBackends[] = [ // backend config for wiki's local repo
+ 'class' => 'SwiftFileBackend',
+ 'name' => "local-swift-eqiad",
+ 'wikiId' => "{$site}-{$lang}",
+ 'lockManager' => 'redisLockManager',
+ 'swiftAuthUrl' => $wmfSwiftConfig['eqiad']['authUrl'],
+ 'swiftUser' => $wmfSwiftConfig['eqiad']['user'],
+ 'swiftKey' => $wmfSwiftConfig['eqiad']['key'],
+ 'swiftTempUrlKey' => $wmfSwiftConfig['eqiad']['tempUrlKey'],
+ 'shardViaHashLevels' => [
+ 'local-public'
+ => [ 'levels' => $wmfSwiftShardLocal, 'base' => 16,
'repeat' => 1 ],
+ 'local-thumb'
+ => [ 'levels' => $wmfSwiftShardLocal, 'base' => 16,
'repeat' => 1 ],
+ 'local-temp'
+ => [ 'levels' => $wmfSwiftShardLocal, 'base' => 16,
'repeat' => 1 ],
+ 'local-transcoded'
+ => [ 'levels' => $wmfSwiftShardLocal, 'base' => 16,
'repeat' => 1 ],
+ 'local-deleted'
+ => [ 'levels' => $wmfSwiftShardLocal, 'base' => 36,
'repeat' => 0 ]
+ ],
+ 'parallelize' => 'implicit',
+ 'cacheAuthInfo' => true,
+ // When used by FileBackendMultiWrite, read from this cluster if it's
the local one
+ 'readAffinity' => true
+];
+$wgFileBackends[] = [ // backend config for wiki's access to shared repo
+ 'class' => 'SwiftFileBackend',
+ 'name' => "shared-swift-eqiad",
+ 'wikiId' => "wikipedia-commons",
+ 'lockManager' => 'redisLockManager',
+ 'swiftAuthUrl' => $wmfSwiftConfig['eqiad']['authUrl'],
+ 'swiftUser' => $wmfSwiftConfig['eqiad']['user'],
+ 'swiftKey' => $wmfSwiftConfig['eqiad']['key'],
+ 'swiftTempUrlKey' => $wmfSwiftConfig['eqiad']['tempUrlKey'],
+ 'shardViaHashLevels' => [
+ 'local-public'
+ => [ 'levels' => $wmfSwiftShardCommon, 'base' => 16,
'repeat' => 1 ],
+ 'local-thumb'
+ => [ 'levels' => $wmfSwiftShardCommon, 'base' => 16,
'repeat' => 1 ],
+ 'local-temp'
+ => [ 'levels' => $wmfSwiftShardCommon, 'base' => 16,
'repeat' => 1 ],
+ 'local-transcoded'
+ => [ 'levels' => $wmfSwiftShardCommon, 'base' => 16,
'repeat' => 1 ],
+ ],
+ 'parallelize' => 'implicit',
+ 'cacheAuthInfo' => true,
+ // When used by FileBackendMultiWrite, read from this cluster if it's
the local one
+ 'readAffinity' => true
+];
+$wgFileBackends[] = [ // backend config for wiki's access to shared files
+ 'class' => 'SwiftFileBackend',
+ 'name' => "global-swift-eqiad",
+ 'wikiId' => "global-data",
+ 'lockManager' => 'redisLockManager',
+ 'swiftAuthUrl' => $wmfSwiftConfig['eqiad']['authUrl'],
+ 'swiftUser' => $wmfSwiftConfig['eqiad']['user'],
+ 'swiftKey' => $wmfSwiftConfig['eqiad']['key'],
+ 'swiftTempUrlKey' => $wmfSwiftConfig['eqiad']['tempUrlKey'],
+ 'shardViaHashLevels' => [
+ 'math-render' => [ 'levels' => 2, 'base' => 16, 'repeat' => 0
],
+ ],
+ 'parallelize' => 'implicit',
+ 'cacheAuthInfo' => true,
+ // When used by FileBackendMultiWrite, read from this cluster if it's
the local one
+ 'readAffinity' => true
+];
+$wgFileBackends[] = [ // backend config for wiki's access to shared test repo
+ 'class' => 'SwiftFileBackend',
+ 'name' => "shared-testwiki-swift-eqiad",
+ 'wikiId' => "wikipedia-test",
+ 'lockManager' => 'redisLockManager',
+ 'swiftAuthUrl' => $wmfSwiftConfig['eqiad']['authUrl'],
+ 'swiftUser' => $wmfSwiftConfig['eqiad']['user'],
+ 'swiftKey' => $wmfSwiftConfig['eqiad']['key'],
+ 'swiftTempUrlKey' => $wmfSwiftConfig['eqiad']['tempUrlKey'],
+ 'parallelize' => 'implicit',
+ 'cacheAuthInfo' => true,
+ // When used by FileBackendMultiWrite, read from this cluster if it's
the local one
+ 'readAffinity' => true
+];
+/* end DC-specific Swift backend config */
+
+/* Common multiwrite backend config */
+$wgFileBackends[] = [
+ 'class' => 'FileBackendMultiWrite',
+ 'name' => 'local-multiwrite',
+ 'wikiId' => "{$site}-{$lang}",
+ 'lockManager' => 'redisLockManager',
+ # DO NOT change the master backend unless it is fully trusted or
autoRsync is off
+ 'backends' => [
+ [ 'template' => 'local-swift-eqiad', 'isMultiMaster' => true ],
+ ],
+ 'replication' => 'sync', // read-after-update for assets
+ 'syncChecks' => ( 1 | 4 ), // (size & sha1)
+ 'autoResync' => 'conservative'
+];
+$wgFileBackends[] = [
+ 'class' => 'FileBackendMultiWrite',
+ 'name' => 'shared-multiwrite',
+ 'wikiId' => "wikipedia-commons",
+ 'lockManager' => 'redisLockManager',
+ # DO NOT change the master backend unless it is fully trusted or
autoRsync is off
+ 'backends' => [
+ [ 'template' => 'shared-swift-eqiad', 'isMultiMaster' => true ],
+ ],
+ 'replication' => 'sync', // read-after-update for assets
+ 'syncChecks' => ( 1 | 4 ), // (size & sha1)
+];
+$wgFileBackends[] = [
+ 'class' => 'FileBackendMultiWrite',
+ 'name' => 'global-multiwrite',
+ 'wikiId' => "global-data",
+ 'lockManager' => 'redisLockManager',
+ # DO NOT change the master backend unless it is fully trusted or
autoRsync is off
+ 'backends' => [
+ [ 'template' => 'global-swift-eqiad', 'isMultiMaster' => true ],
+ ],
+ 'replication' => 'sync', // read-after-update for assets
+ 'syncChecks' => ( 1 | 4 ) // (size & sha1)
+];
+$wgFileBackends[] = [
+ 'class' => 'FileBackendMultiWrite',
+ 'name' => 'shared-testwiki-multiwrite',
+ 'wikiId' => "wikipedia-test",
+ 'lockManager' => 'redisLockManager',
+ # DO NOT change the master backend unless it is fully trusted or
autoRsync is off
+ 'backends' => [
+ [ 'template' => 'shared-testwiki-swift-eqiad' ]
+ ],
+ 'replication' => 'sync', // read-after-update for assets
+ 'syncChecks' => ( 1 | 4 ), // (size & sha1)
+];
+/* end multiwrite backend config */
+
+// Lock manager config must use the master datacenter
+$wgLockManagers[] = [
+ 'name' => 'redisLockManager',
+ 'class' => 'RedisLockManager',
+ 'lockServers' => $wmfMasterServices['redis_lock'],
+ 'srvsByBucket' => [
+ 0 => [ 'memc04', 'memc05' ]
+ ],
+ 'redisConfig' => [
+ 'connectTimeout' => 2,
+ 'readTimeout' => 2,
+ 'password' => $wmgRedisPassword
+ ]
+];
+
+// Temp during copy
$wgLocalFileRepo = [
- 'class' => 'LocalRepo',
- 'name' => 'local',
- 'directory' => $wgUploadDirectory,
- 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath :
$wgUploadPath,
- 'scriptDirUrl' => $wgScriptPath,
- 'hashLevels' => 2,
- 'thumbScriptUrl' => $wgThumbnailScriptPath,
- 'transformVia404' => true,
- 'initialCapital' => $wgCapitalLinks,
- 'deletedDir' =>
"/data/project/upload7/private/archive/$site/$lang",
- 'deletedHashLevels' => 3,
- 'abbrvThreshold' => 160,
- 'isPrivate' => $wmgPrivateWiki
+ 'class' => 'LocalRepo',
+ 'name' => 'local-swift',
+ 'backend' => 'local-multiwrite',
+ 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl .
$wgUploadPath : $wgUploadPath,
+ 'scriptDirUrl' => $wgScriptPath,
+ 'hashLevels' => 2,
+ 'thumbScriptUrl' => $wgThumbnailScriptPath,
+ 'transformVia404' => true,
+ 'initialCapital' => $wgCapitalLinks,
+ 'deletedHashLevels' => 3,
+ 'abbrvThreshold' => 160,
+ 'isPrivate' => $wmgPrivateWiki,
+ 'zones' => $wmgPrivateWiki
+ ? [
+ 'thumb' => [ 'url' => "$wgScriptPath/thumb_handler.php"
] ]
+ : [],
];
# New commons settings
@@ -37,7 +198,7 @@
$wgForeignFileRepos[] = [
'class' => 'ForeignDBViaLBRepo',
'name' => 'shared',
- 'directory' => '/data/project/upload7/wikipedia/commons',
+ 'backend' => 'shared-multiwrite',
'url' =>
"//upload.beta.wmflabs.org/wikipedia/commons",
'hashLevels' => 2,
'thumbScriptUrl' => false,
@@ -45,10 +206,18 @@
'hasSharedCache' => true,
'descBaseUrl' =>
"//commons.wikimedia.beta.wmflabs.org/wiki/File:",
'scriptDirUrl' => "//commons.wikimedia.beta.wmflabs.org/w",
+ 'favicon' => "/static/favicon/commons.ico",
'fetchDescription' => true,
+ 'descriptionCacheExpiry' => 86400,
'wiki' => 'commonswiki',
'initialCapital' => true,
- 'abbrvThreshold' => 160,
+ 'zones' => [ // actual swift containers have
'local-*'
+ 'public' => [ 'container' => 'local-public' ],
+ 'thumb' => [ 'container' => 'local-thumb' ],
+ 'temp' => [ 'container' => 'local-temp' ],
+ 'deleted' => [ 'container' => 'local-deleted' ]
+ ],
+ 'abbrvThreshold' => 160 /* Keep in sync with with local repo
on commons or things break. */
];
}
--
To view, visit https://gerrit.wikimedia.org/r/298299
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I945ca37e1be79117ef40a5b42fffab3b87ff3b26
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits