From c61d56b86200e872a8ff84b9a326f7ee1bf37313 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 18 Mar 2022 23:15:25 -0400 Subject: [PATCH] Add `diagrams` extension and service --- Dockerfile | 2 ++ LocalSettings.php | 3 +++ apache-mediawiki.conf | 21 +++++++++++++++++++++ composer.local.json | 3 ++- diagrams/Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 9 +++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 apache-mediawiki.conf create mode 100644 diagrams/Dockerfile diff --git a/Dockerfile b/Dockerfile index dc2eba5..68fe0fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,8 @@ RUN git clone --depth 1 -b REL${MEDIAWIKI_MAJOR_VERSION/./_} \ RUN git clone --depth 1 -b REL${MEDIAWIKI_MAJOR_VERSION/./_} \ https://gerrit.wikimedia.org/r/mediawiki/extensions/ApprovedRevs \ /var/www/html/extensions/ApprovedRevs +RUN a2enmod proxy_http proxy_html +COPY apache-mediawiki.conf /etc/apache2/sites-available/000-default.conf # reset back to default shell SHELL ["/bin/sh", "-c"] diff --git a/LocalSettings.php b/LocalSettings.php index 3aa5d08..1115357 100644 --- a/LocalSettings.php +++ b/LocalSettings.php @@ -226,6 +226,9 @@ wfLoadExtension( 'CSS' ); wfLoadExtension( 'Widgets' ); wfLoadExtension( 'ApprovedRevs' ); +wfLoadExtension( 'Diagrams' ); +$wgDiagramsServiceUrl ='https://wiki.claremontmakerspace.org/diagrams'; + require_once "$IP/extensions/QRLite/QRLite.php"; wfLoadExtension( 'ExternalData' ); diff --git a/apache-mediawiki.conf b/apache-mediawiki.conf new file mode 100644 index 0000000..b96a1ab --- /dev/null +++ b/apache-mediawiki.conf @@ -0,0 +1,21 @@ + + ServerAdmin webmaster@claremontmakerspace.org + DocumentRoot /var/www/html + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + AllowEncodedSlashes NoDecode + + ProxyPass /diagrams/ http://diagrams:5003/diagrams/ + # ProxyPassReverse /diagrams/ http://diagrams:5003/ + ProxyPreserveHost On + + # + # ProxyPassReverse / + # SetOutputFilter proxy-html + # ProxyHTMLURLMap http://diagrams:5003/ /diagrams/ + # ProxyHTMLURLMap / /diagrams/ + # + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet \ No newline at end of file diff --git a/composer.local.json b/composer.local.json index f0bd17b..52ccb4c 100644 --- a/composer.local.json +++ b/composer.local.json @@ -2,7 +2,8 @@ "require": { "mediawiki/semantic-media-wiki": "^4.0", "mediawiki/semantic-scribunto": "^2.0", - "mediawiki/data-transfer": "^1.0" "mediawiki/semantic-result-formats": "^4.0", + "mediawiki/data-transfer": "^1.0", + "samwilson/diagrams": "^0.9" } } diff --git a/diagrams/Dockerfile b/diagrams/Dockerfile new file mode 100644 index 0000000..9680daa --- /dev/null +++ b/diagrams/Dockerfile @@ -0,0 +1,19 @@ +FROM alpine as source + +RUN apk add git curl +RUN git clone https://github.com/ad1217/diagrams -b fix-stuff +RUN curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download -o diagrams/plantuml.jar + +FROM python:3-alpine + +COPY --from=source diagrams diagrams +WORKDIR diagrams + +# TODO: missing mscgen +RUN apk add graphviz openjdk8-jre +RUN pip3 install -r dgs/requirements.txt gunicorn + +VOLUME /root/.diagrams + +env SCRIPT_NAME=/diagrams +CMD ["gunicorn", "dgs.webserver:app", "--bind", "0.0.0.0:5003", "--forwarded-allow-ips=*"] diff --git a/docker-compose.yml b/docker-compose.yml index 2fd1171..53fb8b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,13 @@ services: - ./LocalSettings.php:/var/www/html/LocalSettings.php:ro - ./secrets.php:/var/www/html/secrets.php:ro - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini:ro + + diagrams: + build: ./diagrams + restart: always + volumes: + - diagrams-vol:/root/.diagrams + database: image: mariadb volumes: @@ -22,5 +29,7 @@ services: MYSQL_DATABASE: mediawiki #MYSQL_USER and MYSQL_PASSWORD in .env MYSQL_RANDOM_ROOT_PASSWORD: 'yes' + volumes: mysql-vol: + diagrams-vol: