Проект

Общее

Профиль

Улучшение #16634 » wiki.patch

Проделанная работа с mediawiki и ubcctlt/mediawiki - Арут Меликсетян, 25.02.2026 12:35

Просмотреть отличия:

README.md
## Подготовка
### Субдомены
<!-- TODO: fill ts -->
## Setup
> Для начала перейди в директорию `compose/`:
compose/.env.example
DOMAIN=talksift.ru
LETSENCRYPT_EMAIL=
compose/.secrets.env.example
POSTGRES_PASSWORD=
PGHERO_PASSWORD=
MANAGER_APP_PASSWORD=
MARIADB_ROOT_PASSWORD=
MARIADB_PASSWORD=
WIKI_SECRET_KEY=
MEDIAWIKI_ADMIN_PASS=
compose/.shared.env
POSTGRES_USER=talksift_user
POSTGRES_DB=talksift_db
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}"
MARIADB_DATABASE=wiki_db
MARIADB_USER=wiki_user
WIKI_DB_NAME=${MARIADB_DATABASE}
WIKI_DB_USER=${MARIADB_USER}
WIKI_DB_PASSWORD=${MARIADB_PASSWORD}
WIKI_LOCAL_TIMEZONE=${TZ}
MEDIAWIKI_DB_NAME=${MARIADB_DATABASE}
MEDIAWIKI_DB_USER=${MARIADB_USER}
MEDIAWIKI_DB_PASSWORD=${MARIADB_PASSWORD}
compose/config/mediawiki/LocalSettings.php
<?php
# This file was automatically generated by the MediaWiki 1.41.1
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/MainConfigSchema.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
# https://www.mediawiki.org/wiki/Manual:LocalSettings.php
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = getEnv('WIKI_SITE_NAME');
$wgMetaNamespace = $wgSitename;
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
## The protocol and server name to use in fully-qualified URLs
$wgServer = getEnv('WIKI_SERVER_URL');
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
## The URL paths to the logo. Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogos = [
'1x' => "$wgResourceBasePath/resources/assets/change-your-logo.svg",
'icon' => "$wgResourceBasePath/resources/assets/change-your-logo-icon.svg",
];
## UPO means: this is also a user preference option
$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = "";
$wgPasswordSender = "";
$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;
## Database settings
$wgDBtype = getEnv('WIKI_DB_TYPE');
$wgDBserver = getEnv('WIKI_DB_SERVER');
$wgDBname = getEnv('WIKI_DB_NAME');
$wgDBuser = getEnv('WIKI_DB_USER');
$wgDBpassword = getEnv('WIKI_DB_PASSWORD');
# MySQL specific settings
$wgDBprefix = "";
$wgDBssl = false;
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Shared database table
# This has no effect unless $wgSharedDB is also set.
$wgSharedTables[] = "actor";
## Shared memory settings
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = [];
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
$wgUseInstantCommons = false;
# Periodically send a pingback to https://www.mediawiki.org/ with basic data
# about this MediaWiki instance. The Wikimedia Foundation shares this data
# with MediaWiki developers to help guide future development efforts.
$wgPingback = false;
# Site language code, should be one of the list in ./includes/languages/data/Names.php
$wgLanguageCode = getEnv('WIKI_LANGUAGE_CODE');
# Time zone
$wgLocaltimezone = getEnv('WIKI_LOCAL_TIMEZONE');
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publicly accessible from the web.
#$wgCacheDirectory = "$IP/cache";
$wgSecretKey = getEnv('WIKI_SECRET_KEY');
# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "1";
# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "282578c38b8a2e55";
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";
## Default skin: you can change the default skin. Use the internal symbolic
## names, e.g. 'vector' or 'monobook':
$wgDefaultSkin = "vector-2022";
# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MinervaNeue' );
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
# End of automatically generated settings.
# Add more configuration options below.
# Debug
$wgShowExceptionDetails = $wgShowDBErrorBacktrace = $wgShowSQLErrors = getEnv('WIKI_DEBUG');
compose/config/mediawiki/uploads.ini
upload_max_filesize = 2000M
post_max_size = 2000M
max_execution_time = 7200
max_file_uploads = 1000
compose/docker-compose.yml
name: talksift
services:
pghero:
image: ankane/pghero:v3.7.0
container_name: pghero
restart: unless-stopped
image: ankane/pghero:v3.7.0@sha256:9343a0355c15bcb2a006b5a217ade3a972b65b0bb6a127f0079fcf3894b34451
environment:
PORT: &pghero-port 8888
VIRTUAL_PORT: *pghero-port
VIRTUAL_HOST: &pghero-host hero.talksift.ru
VIRTUAL_HOST: &pghero-host hero.${DOMAIN}
LETSENCRYPT_HOST: *pghero-host
env_file: &env-files
- path: .env
......
networks:
- nginx-proxy
- talksift-network
restart: unless-stopped
postgres:
image: postgres:17.6
container_name: postgres
image: postgres:17.6@sha256:00bc86618629af00d2937fdc5a5d63db3ff8450acf52f0636ec813c7f4902929
volumes: [pg-data:/var/lib/postgresql/data]
env_file: *env-files
networks: [talksift-network]
......
start_period: 80s
tomcat:
image: registry.simplex2.ru/tomcat:v2.22
container_name: tomcat
image: registry.simplex2.ru/tomcat:v2.22@sha256:355b88a80715f14f50490a53cb2f10d1b53b362e3cc7ed7f52df04500d4f3b43
depends_on: {postgres: {condition: service_healthy}}
volumes: [root-app:/usr/local/tomcat/webapps/ROOT]
environment:
VIRTUAL_HOST: &tomcat-host talksift.ru
LETSENCRYPT_HOST: *tomcat-host
VIRTUAL_HOST: ${DOMAIN}
LETSENCRYPT_HOST: ${DOMAIN}
VIRTUAL_PORT: 8080
env_file: *env-files
networks:
......
max-size: "50m"
max-file: "10"
# wiki:
# build:
# context: config/mediawiki
# dockerfile_inline: |
# FROM mediawiki:1.41.1@sha256:918d23123a771bf22d866d06164fc5ff155187c3abf874465c511252b1c2afe8
# COPY LocalSettings.php /var/www/html/LocalSettings.php
# COPY uploads.ini /etc/php5/fpm/conf.d/uploads.ini
# depends_on: {wiki-db: {condition: service_healthy}}
# volumes: [wiki-images:/var/www/html/images]
# environment:
# VIRTUAL_PORT: 80
# # TODO: change 'ghosler' to 'wiki'
# VIRTUAL_HOST: &wiki-host ghosler.${DOMAIN}
# LETSENCRYPT_HOST: *wiki-host
# # NOTE: using `getEnv` in config/mediawiki/LocalSettings.php
# WIKI_SITE_NAME: Talksift
# WIKI_SERVER_URL: https://ghosler.${DOMAIN}
# WIKI_DB_TYPE: mysql
# WIKI_DB_SERVER: wiki-db
# WIKI_LANGUAGE_CODE: ru
# WIKI_DEBUG: true
# env_file: *env-files
# networks:
# - nginx-proxy
# - talksift-network
# restart: unless-stopped
wiki:
image: ubcctlt/mediawiki:REL1_43_B7@sha256:d65a57b6c77e5409f2615a2e7fd89676e56f31b3b93a2c6dbdb98b46fbe7a61c
depends_on: {wiki-db: {condition: service_healthy}}
volumes:
- wiki-images:/var/www/html/images
# - ./LocalSettings.php:/var/www/html/LocalSettings.php
environment:
VIRTUAL_PORT: 80
VIRTUAL_HOST: &wiki-host ghosler.${DOMAIN} # TODO: change 'ghosler' to 'wiki'
LETSENCRYPT_HOST: *wiki-host
# https://github.com/ubc/mediawiki-docker?tab=readme-ov-file#configuration-options
MEDIAWIKI_SITE_NAME: Talksift Wiki
MEDIAWIKI_SITE_SERVER: https://ghosler.${DOMAIN}
# MEDIAWIKI_SITE_LANG: ru
MEDIAWIKI_UPDATE: true
DEBUG: true
# BUG: https://github.com/ubc/mediawiki-docker/issues/21#issuecomment-644512355
RESTBASE_URL: http://localhost
# https://github.com/ubc/mediawiki-docker?tab=readme-ov-file#using-database-server
MEDIAWIKI_DB_HOST: wiki-db
# https://mediawiki.org/wiki/Extension:DrawioEditor
MEDIAWIKI_EXTENSIONS: DrawioEditor
# MEDIAWIKI_UPGRADE_KEY: upgrade
env_file: *env-files
networks:
- nginx-proxy
- talksift-network
restart: unless-stopped
wiki-db:
# BUG: Do not use MariaDB 12.
# https://www.reddit.com/r/mediawiki/comments/1n0vnu8/comment/nb7izm8
# https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/54d2416fbcb3a7d0e2a197ca58a755134bd18866
# https://phabricator.wikimedia.org/T401570
# https://github.com/ubc/mediawiki-docker/blob/ce5dc615adc225f143b8d1e0285c35e756f0769e/docker-compose.yml#L3
# Or you can try this:
# https://www.reddit.com/r/mediawiki/comments/1n0vnu8/comment/nee9i19
image: mariadb:10.11.9@sha256:5c2a279eacfa00bd4453b10569e36d8ee24331cdc09273df70c4dbd383c277b4
volumes: [wiki-db:/var/lib/mysql]
env_file: *env-files
networks: [talksift-network]
restart: unless-stopped
healthcheck:
test: healthcheck.sh --connect --mariadbupgrade --innodb_initialized
interval: 20s
start_period: 30s
timeout: 5s
retries: 10
networks:
talksift-network: {internal: true}
# talksift-network: {internal: true}
talksift-network: {}
nginx-proxy: {external: true}
volumes:
pg-data: {}
root-app: {}
wiki-images: {}
wiki-db: {}
    (1-1/1)