revive this repository into an extension of the official mediawiki image to be used on malacodapedia and eventually other monarch-pass wikis

This commit is contained in:
Adrian Kuschelyagi Malacoda 2019-06-16 00:28:13 -05:00
parent 226e9f6665
commit 17e4d119c5
7 changed files with 21 additions and 112 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
data

View File

@ -1,36 +0,0 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# MediaWiki Short URL
RedirectMatch ^/$ /wiki/
RedirectMatch ^/wiki$ /wiki/
Alias /wiki /var/www/w/index.php
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -1,62 +1,16 @@
# Mediawiki-Apache
#
# Version 1.2
FROM tutum/apache-php:latest
FROM mediawiki:latest
MAINTAINER Adrian Malacoda <adrian.malacoda@monarch-pass.net>
# Install ImageMagick
RUN apt-get -y update && apt-get -y install imagemagick
ARG MW_VERSION=REL1_30
#RUN apt-get -y update && apt-get -y install imagemagick
WORKDIR /
# Update composer
RUN composer self-update
# Remove the old hello world app and grab Mediawiki source
RUN apt-get update && apt-get install -yq git && rm -rf /var/lib/apt/lists/*
RUN rm -fr /app && mv /var/www/html /var/www/w && git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git /app
RUN cd /app && git checkout -b $MW_VERSION origin/$MW_VERSION && git submodule update --init
# Install extensions
ADD add_extension.sh /add_extension.sh
RUN chmod +x add_extension.sh
RUN ./add_extension.sh Renameuser $MW_VERSION && \
./add_extension.sh ImageMap $MW_VERSION && \
./add_extension.sh Cite $MW_VERSION && \
./add_extension.sh InputBox $MW_VERSION && \
./add_extension.sh LocalisationUpdate $MW_VERSION && \
./add_extension.sh Interwiki $MW_VERSION && \
./add_extension.sh TitleBlacklist $MW_VERSION && \
./add_extension.sh Gadgets $MW_VERSION && \
./add_extension.sh WikiEditor $MW_VERSION && \
./add_extension.sh SpamBlacklist $MW_VERSION && \
./add_extension.sh ParserFunctions $MW_VERSION && \
./add_extension.sh SyntaxHighlight_GeSHi $MW_VERSION && \
./add_extension.sh ConfirmEdit $MW_VERSION && \
./add_extension.sh Nuke $MW_VERSION && \
./add_extension.sh Poem $MW_VERSION && \
./add_extension.sh PdfHandler $MW_VERSION
# Install skins
ADD add_skin.sh /add_skin.sh
RUN chmod +x add_skin.sh
RUN ./add_skin.sh Vector $MW_VERSION && \
./add_skin.sh MonoBook $MW_VERSION
# Create the section for persistent files
RUN mkdir /var/lib/mediawiki
RUN ln -s /var/lib/mediawiki/LocalSettings.php /app/LocalSettings.php
RUN ./add_extension.sh Scribunto $MEDIAWIKI_BRANCH
ADD setup.sh /setup.sh
RUN chmod +x setup.sh
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf
# Install composer dependencies
RUN cd /app && composer install --no-dev
EXPOSE 80
CMD ./setup.sh && ./run.sh
RUN chmod +x /setup.sh
CMD ["/setup.sh"]

View File

@ -3,7 +3,7 @@
EXT_NAME=$1
EXT_VERSION=$2
cd "app/extensions"
cd "/var/www/html/extensions"
if [[ -e "${EXT_NAME}" ]]; then
cp -Rv "${EXT_NAME}" .
@ -17,6 +17,12 @@ if [[ "${EXT_VERSION}" ]]; then
git checkout -b "${EXT_VERSION}" "origin/${EXT_VERSION}"
fi
if [[ -e ".git" ]]; then
git submodule update --init
fi
if [[ -e "composer.json" ]]; then
composer install --no-dev
fi
chown -R www-data:www-data .

View File

@ -3,7 +3,7 @@
EXT_NAME=$1
EXT_VERSION=$2
cd /app/skins
cd "/var/www/html/skins"
git clone https://gerrit.wikimedia.org/r/p/mediawiki/skins/$1
cd $1
git checkout -b $2 origin/$2

View File

@ -10,7 +10,8 @@ services:
web:
build: .
volumes:
- ./data:/var/lib/mediawiki
- ./data/images:/var/www/html/images
- ./data/LocalSettings.php:/var/www/html/LocalSettings.php
ports:
- "8001:80"
links:

View File

@ -1,28 +1,11 @@
#!/bin/bash
if [[ ! -h /app/skins ]]; then
mkdir -p /var/lib/mediawiki/skins
cp -R /app/skins/* /var/lib/mediawiki/skins
rm -rf /app/skins
ln -s /var/lib/mediawiki/skins /app/skins
fi
if [[ ! -h /app/extensions ]]; then
mkdir -p /var/lib/mediawiki/extensions
cp -R /app/extensions/* /var/lib/mediawiki/extensions
rm -rf /app/extensions
ln -s /var/lib/mediawiki/extensions /app/extensions
fi
if [[ ! -h /app/images ]]; then
mkdir -p /var/lib/mediawiki/images
cp -R /app/images/* /var/lib/mediawiki/images
rm -rf /app/images
ln -s /var/lib/mediawiki/images /app/images
fi
HTML_ROOT=/var/www/html
# Run updater if we have an existing install
if [[ -e /var/lib/mediawiki/LocalSettings.php ]]; then
cd /app/maintenance
if [[ -e "$HTML_ROOT/LocalSettings.php" ]]; then
cd "$HTML_ROOT/maintenance"
php update.php
fi
apache2-foreground