Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rlewkowicz-test committed Mar 19, 2018
1 parent fbab640 commit 70d31b5
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 9 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Containerized Mediawiki
=======================
[![Build Status](http://jenkins.binaryoasis.com/buildStatus/icon?job=mediawiki-docker-stack)](http://jenkins.binaryoasis.com/job/mediawiki-docker-stack/)

# I'm rebuilding the project right now. Branch 1_28 is going to be the most functional if you need a working wiki.
Project Compendium: http://binaryoasis.com:8000 (Not quite reflective of the rebuild)

## Considerations for the current rebuild
## Freshly re-engineered!
I just rebuilt everything to be a little less static. The upside is it's easier to pick your version and I have a lot less to maintain, the down side is that it's a little less "wow" factor and probably more prone to code rot. Still better than just time/feature rot I suppose.

First, things that need to be built - PHP and Parsoid in particular need a more central repository. I did pretty ok with it in the current implementation but multiple poorly maintained forks of official docker repos makes collaboration difficult. I like the way laradock does it, but I still will have to fork that because I need features it's not going to have like the syntax highlighting for code blocks. I could go look at the contribution guidelines, but I think I'm just going to poach their structure and adapt it to this project.
## Whats Changed?

If you look at some of the other projects out there, they have env variables that allow you to programmatically launch your wiki. At the same time though many of these repos don't have binary isolation. They just lump stuff into a container. If that's the trade, it's one I don't want to make. I'm making this more for personal wiki's and internal small business. I'm not too worried about being able to deploy 20 of them.
* PHP and Parsoid are now runtime builds
* These builds are now located in this repo at docker-mediawiki-build
* Wiki initialization can be programmatic via environment variables

I have some quality of life stuff that I do like auto placement of the localsettings file at wiki initialization. I gotta bail on that because it's not maintainable I don't think. But we'll see. I need some sort of like, patch applier that is code aware. I have what, 15-20 lines that inject into the mediawiki code. Provided nothing major changes I'd like to just keep injecting that, but I don't want it to break because someone added a single line of code. Then I need a bunch of tests etc etc. Maybe I'll look into something like travis so I don't have to maintain so much.
The PHP image is based on laradock's php (Like, pretty aggressively. I added a few things, but I need to go trim the fat). The build file is for PHP 7.2. This shouldn't be a problem for mediawiki core, I think they backported 7.2 support to the 27 branch but don't quote me on that. If you run into issues open a bug and I can fix it a lot quicker now that I adopted (poached?) laradocks build structure. Or feel free to go grab a build file right from laradock and submit a pull after the needed adjustments.

Mediawiki files, and composer deps. You would be surprised how not easy it is to grab the latest stable release of mediawiki. Their latest is a nightly build and since their github is a clone it doesn't support the "latest" api endpoint. Ultimately I need to decouple the project from mediawiki it's self. That just gets tricky, because of their development schemes. Parsoid does not play well with certain versions of mediawiki and the error messages are often esoteric, obfuscated, or non existent. As the project is now, a year later it all still works. It's pretty resistant to code rot because it's all pre built for the most part.
## Doot
54 changes: 54 additions & 0 deletions autoinstall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: '2'
services:
phpfpm:
container_name: no-one-else-should-be-using-this-name
build:
context: ./docker-mediawiki-build/php-fpm
args:
- INSTALL_XDEBUG=true
- INSTALL_BLACKFIRE=false
- INSTALL_SOAP=true
- INSTALL_IMAP=true
- INSTALL_MONGO=false
- INSTALL_AMQP=false
- INSTALL_MSSQL=true
- INSTALL_ZIP_ARCHIVE=true
- INSTALL_BCMATH=true
- INSTALL_GMP=true
- INSTALL_PHPREDIS=false
- INSTALL_MEMCACHED=true
- INSTALL_OPCACHE=true
- INSTALL_EXIF=true
- INSTALL_AEROSPIKE=false
- INSTALL_MYSQLI=true
- INSTALL_PGSQL=true
- INSTALL_PG_CLIENT=true
- INSTALL_TOKENIZER=true
- INSTALL_INTL=true
- INSTALL_GHOSTSCRIPT=true
- INSTALL_LDAP=true
- INSTALL_SWOOLE=false
- INSTALL_IMAGE_OPTIMIZERS=true
- INSTALL_IMAGEMAGICK=true
dockerfile: "Dockerfile-72"
volumes:
- "./distribution-files/mediawiki:/var/www/mediawiki"
- "/etc/passwd:/etc/passwd:ro"
- "/etc/shadow:/etc/shadow:ro"
- "/etc/group:/etc/group:ro"
depends_on:
- mysql
entrypoint:
- sh
- -c
- 'sleep 100000'

mysql:
container_name: no-one-else-should-be-using-this-name-or-this
image: mariadb:10.0
volumes:
- "./distribution-files/mysql:/var/lib/mysql"
environment:
- MYSQL_ROOT_PASSWORD=HC51qp6xYIK
- MYSQL_USER=root@%
- MYSQL_PASSWORD=HC51qp6xYIK
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ services:
volumes:
- "./distribution-files/mysql:/var/lib/mysql"
environment:
- MYSQL_ROOT_PASSWORD=@6gRzU2k8%
- MYSQL_ROOT_PASSWORD=HC51qp6xYIK
- MYSQL_USER=root@%
- MYSQL_PASSWORD=HC51qp6xYIK
depends_on:
- nginx
parsoid:
Expand Down
35 changes: 33 additions & 2 deletions runfirst.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@ if [[ $EUID -ne 0 ]]; then
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

MEDIAWIKIVERSION="1.27"
MEDIAWIKIVERSION="1.30"

#Auto Install Variables
SERVERURL="http://localhost/" #No Trailing slash
WIKINAME="My Wiki"
DBNAME="mediawiki"
#NOTE: Due to interpolation, may have issues with special charecters on passwords.
#NOTE: This Will override the password set in the docker-compose file
DBPASS="HC51qp6xYIK"
ADMINUSER="Admin"
ADMINPASSWORD="EDI917VJb30" #Due to interpolation, may have issues with special charecters

sed -i "s/MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$DBPASS/g" $DIR/docker-compose.yml
sed -i "s/MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$DBPASS/g" $DIR/autoinstall.yml
sed -i "s/MYSQL_PASSWORD=.*/MYSQL_PASSWORD=$DBPASS/g" $DIR/docker-compose.yml
sed -i "s/MYSQL_PASSWORD=.*/MYSQL_PASSWORD=$DBPASS/g" $DIR/autoinstall.yml

#system prep
command -v docker >/dev/null 2>&1 || { curl -s https://get.docker.com/ | bash; }
Expand All @@ -32,7 +47,8 @@ mv $DIR/distribution-files/$(sed 's/.tar.gz//g' <(echo $MEDIAWIKISEMVAR)) $DIR/d

#And again, but now with the extension
MEDIAWIKIREL=$(sed 's/\./_/g' <(echo $MEDIAWIKIVERSION))
VEXTENTION=$(curl -s https://extdist.wmflabs.org/dist/extensions/ | grep VisualEditor | grep $MEDIAWIKIREL | grep -o \>Visual.*.tar.gz | sed 's/>//g')
#Their website randomly stopped playing nice with curl after working all day. Had to add cruft to make it work.
VEXTENTION=$(curl -s 'https://extdist.wmflabs.org/dist/extensions/' -H 'dnt: 1' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'cache-control: max-age=0' -H 'authority: extdist.wmflabs.org' --compressed | grep VisualEditor | grep $MEDIAWIKIREL | grep -o \>Visual.*.tar.gz | sed 's/>//g')

wget -qO- https://extdist.wmflabs.org/dist/extensions/$VEXTENTION | tar xvz -C $DIR/distribution-files/mediawiki/extensions/

Expand Down Expand Up @@ -101,3 +117,18 @@ sed -i "/return \$localSettings/ {
d
}" $DIR/distribution-files/mediawiki/includes/installer/LocalSettingsGenerator.php
rm $DIR/tmpfile

docker-compose -f $DIR/autoinstall.yml up -d --force-recreate

echo "sleeping 15 for mysql init"
secs=15
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done

docker exec -ti no-one-else-should-be-using-this-name php mediawiki/maintenance/install.php --dbuser="root" --dbpass="$DBPASS" --dbname="$DBNAME" --dbserver="mysql" --installdbuser="root" --installdbpass="$DBPASS" --server="$SERVERURL" --lang=en --pass="$ADMINPASSWORD" "$WIKINAME" "$ADMINUSER"

docker rm -f no-one-else-should-be-using-this-name
docker rm -f no-one-else-should-be-using-this-name-or-this

0 comments on commit 70d31b5

Please sign in to comment.