Docker
From syn2cat - HackerSpace.lu
My little page about getting docker to run, done by somebody having no idea what docker is.
Yeah, DAU-docker!
ATTENTION this uses default passwords, and is completely unsecure !!!!
First install docker
- sudo apt-get install docker.io
- sudo usermod -a -G docker $(id -un)
- # logoout/login to get your group attribution
Mediawiki
Fist some settings
- WEBPORT=8080 # on which port the webserver should listen on the main host, if you have already a webserver, 80 won't work
- DBPASSWORD="$(openssl rand -base64 9)" # the password for the database (humm... save it :-)
- DOCKERNAME="mediawiki"
Create a database
- # inspired from https://hub.docker.com/_/mysql/
- docker run --name wiki-mysql -e MYSQL_ROOT_PASSWORD=$DBPASSWORD -d mysql:latest
Create a mediawiki
- # well probably something like found here https://hub.docker.com/r/synctree/mediawiki/
- docker run --name $DOCKERNAME --link wiki-mysql:mysql -p $WEBPORT:80 -d synctree/mediawiki
Configure mediawiki
- echo "connect to http://localhost:$WEBPORT/"
- click on "setup the wiki"
- database host: mysql
- database name: mysql
- table prefix: mw #change this if you install more than one mediawiki into this database
- username: root
- echo password: $DBPASSWORD
- at end of setup you get a LocalSettings.php to download
- this file has to be provided to the docker or put into the container. Seems to be several ways to do it, but none work. So this one works:
- cat LocalSettings.php | docker exec -i $DOCKERNAME sh -c 'cat > /var/www/html/LocalSettings.php'
- docker exec -i $DOCKERNAME chown www-data:www-data /var/www/html/LocalSettings.php
- docker exec -i $DOCKERNAME chmod 444 /var/www/html/LocalSettings.php
- echo "wiki is on http://localhost:$WEBPORT/index.php"
More help: well the usual mediawiki help
Engelsystem
Give some configuration stuff
- ENGELPORT=80 # on which port the engel system should listen on the main host, if you have a webserver, 80 won't work
- ENGELDB=3306 # on which port the mysql of the engelsystem should be visible on the main host
- DBPASSWORD="$(openssl rand -base64 9)" # the password for the database (humm... save it it :-)
- ENGELPASSWORD="$(openssl rand -base64 9)" # the password for the engelsystem (humm... save it it :-)
- DOCKERNAME="engelsystem"
- ENGELADMIN="engeladmin" # well just use it
from https://github.com/ruep/dockerfile-engel
- git clone https://github.com/ruep/dockerfile-engel.git
- cd dockerfile-engel/
- docker build -t engelweb-app . # this takes a long time
- docker run --name "$DOCKERNAME" -d -p ${ENGELPORT}:80 -p ${ENGELDB}:3306 -e MYSQL_PASS="$DBPASSWORD" engelweb-app
- docker exec -t "$DOCKERNAME" sed -i 's/-pengel/-p'$DBPASSWORD'/' /engelweb/db/createdb.sh # needed coz db pass hardcoded
- docker exec -t "$DOCKERNAME" /engelweb/db/createdb.sh engelsystem engeladmin "$ENGELPASSWORD"
- docker exec -t "$DOCKERNAME" sh -c "/usr/bin/mysql -uadmin -p$DBPASSWORD engelsystem < /engelweb/db/install.sql"
- docker exec -t "$DOCKERNAME" sh -c "/usr/bin/mysql -uadmin -p$DBPASSWORD engelsystem < /engelweb/db/update.sql"
- echo "Please remember the database password: $DBPASSWORD"
- echo "Please remember the engelsystem login: ${ENGELADMIN} ${ENGELPASSWORD}"
- echo login to http://localhost:$ENGELPORT/ with user 'admin' and password 'asdfasdf'