我建立容器:
docker build -t mediawiki31 .
带有Wikimedia的Dockerfile(标准文件加上VisualEditor):
FROM php:7.2-apache
# System Dependencies.
RUN apt-get update && apt-get install -y \
git \
imagemagick \
libicu-dev \
# Required for SyntaxHighlighting
python3 \
--no-install-recommends && rm -r /var/lib/apt/lists/*
# Install the PHP extensions we need
RUN docker-php-ext-install mbstring mysqli opcache intl
# Install the default object cache.
RUN pecl channel-update pecl.php.net \
&& pecl install apcu \
&& docker-php-ext-enable apcu
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# SQLite Directory Setup
RUN mkdir -p /var/www/data \
&& chown -R www-data:www-data /var/www/data
# Version
ENV MEDIAWIKI_MAJOR_VERSION 1.31
ENV MEDIAWIKI_BRANCH REL1_31
ENV MEDIAWIKI_VERSION 1.31.1
ENV MEDIAWIKI_SHA512 ee49649cc37d0a7d45a7c6d90c822c2a595df290be2b5bf085affbec3318768700a458a6e5b5b7e437651400b9641424429d6d304f870c22ec63fae86ffc5152
# MediaWiki setup
RUN curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz \
&& echo "${MEDIAWIKI_SHA512} *mediawiki.tar.gz" | sha512sum -c - \
&& tar -xz --strip-components=1 -f mediawiki.tar.gz \
&& rm mediawiki.tar.gz \
&& chown -R www-data:www-data extensions skins cache images
RUN cd /var/www/html/extensions &&\
git clone -b REL1_30 https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git &&\
cd VisualEditor &&\
git submodule update --init
docker-compose文件(也是标准文件,但宽度为仿形):
# MediaWiki with MariaDB
#
# Access via "http://localhost:8024"
# (or "http://$(docker-machine ip):8024" if using docker-machine)
version: '3'
services:
mediawiki:
image: mediawiki31
restart: always
ports:
- 8024:80
links:
- database
- parsoid
volumes:
- /var/www/html/images
# After initial setup, download LocalSettings.php to the same directory as
# this yaml and uncomment the following line and use compose to restart
# the mediawiki service
- ./LocalSettings.php:/var/www/html/LocalSettings.php
database:
image: mariadb
restart: always
environment:
# @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.php
MYSQL_DATABASE: my_wiki
MYSQL_USER: pscn
MYSQL_PASSWORD: example
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
parsoid:
image: thenets/parsoid:0.9.0
ports:
- 8035:8000
restart: always
environment:
PARSOID_DOMAIN_localhost: http://localhost:8024/api.php
我用以下命令编写了ffile:
docker-compose -f stack.yml up
生成LocalSettings.php。
添加到LocalSettings.php:
wfLoadExtension( 'VisualEditor');
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions[`usebetatoolbar-cgd`] = 1;
$wgDefaultUserOptions['wikieditor-preview'] = 0;
$wgDefaultUserOptions['wikieditor-publish'] = 0;
#$wgDefaultUserOptions['visualeditor-enable'] = 1;
if ( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) {
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = true;
}
$wgVirtualRestConfig['modules']['parsoid'] = array(
// URL to the Parsoid instance
// Use port 8142 if you use the Debian package
'url' => 'localhost:8035',
// Parsoid "domain", see below (optional)
'domain' => 'localhost',
// Parsoid "prefix", see below (optional)
'prefix' => 'localhost'
);
我打开了Wiki。一切正常。
我试图打开VisualEditor并收到错误消息:
apierror-visualeditor-docserver-http-error: (curl error: 7) Couldn't connect to server.
和
oldidnotfound: There is no revision with ID 0
我检查,URL http://localhost:8024/api.php也有内容,URL http://localhost:8035/也有内容。
问题出在哪里?
我什至不知道什么以及如何检查导致问题的原因。
答案 0 :(得分:0)
在您的docker-compose.yml中,您在PARSOID_DOMAIN_localhost中有错误
parsoid:
environment:
PARSOID_DOMAIN_localhost: http://localhost:8024/api.php
也许localhost:8024-无法在仿形容器中访问。
当我遇到相同的错误时,我已经看到了这样的日志(docker logs -f parsoid)
错误:连接ECONNREFUSED 要么 错误:getaddrinfo ENOTFOUND
然后我更改为
parsoid:
PARSOID_DOMAIN_localhost: http://docker_wiki_app_host/api.php
它将起作用。