Docker

From syn2cat - HackerSpace.lu
(Difference between revisions)
Jump to: navigation, search
(Engelsystem)
(Engelsystem)
Line 37: Line 37:
  
 
==Engelsystem==
 
==Engelsystem==
Grabbed infos from https://hub.docker.com/r/whiledo/engelsystem-fhmuc-tool/
+
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
  
Make a DB
+
from https://github.com/ruep/dockerfile-engel
* docker run --name mysql-engelsystem -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 3306:3306 -d mysql
+
  
Setup engels. This is not tested, just plastered together in hope that it works
+
* git clone https://github.com/ruep/dockerfile-engel.git
* docker run -d -p 9090:80 -e mysqlhost="localhost" --link mysql-engelsystem:mysql -e installmysql="yes" whiledo/engelsystem-fhmuc-tool
+
* cd dockerfile-engel/
* firefox http://localhost:9090/
+
* 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
  
If running the docker again, do not give the '-e installmysql="yes" ' part
+
For some unknown reason the --name parameter is not used and you find yourself with a silly name WTF
 +
* # docker ps  - ( Die CONTAINER_ID merken... )
 +
* # docker exec -i -t "$DOCKERNAME" bash  # da stand anstatt engelsystem die containerid
 +
* # docker rename containerid "$DOCKERNAME"
 +
* 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"
 +
 
 +
* echo "Please remember the database password: $DBPASSWORD"
 +
* echo "Please remember the engelsystem login: ${ENGELADMIN} ${ENGELPASSWORD}"

Revision as of 20:18, 31 January 2016

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

Create a database

  • # no idea what this does, I just pasted it from https://hub.docker.com/_/mysql/
  • docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest

Create a mediawiki

  • firefox http://localhost:8080/
    • database host: mysql
    • database name: mysql
    • table prefix: mw
    • username: root
    • password: my-secret-pw
    • 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 some-mediawiki sh -c 'cat > /var/www/html/LocalSettings.php'
  • docker exec -i some-mediawiki chown www-data:www-data /var/www/html/LocalSettings.php
  • docker exec -i some-mediawiki chmod 444 /var/www/html/LocalSettings.php
  • firefox http://localhost:8080/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

For some unknown reason the --name parameter is not used and you find yourself with a silly name WTF

  • # docker ps - ( Die CONTAINER_ID merken... )
  • # docker exec -i -t "$DOCKERNAME" bash # da stand anstatt engelsystem die containerid
  • # docker rename containerid "$DOCKERNAME"
  • 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"
  • echo "Please remember the database password: $DBPASSWORD"
  • echo "Please remember the engelsystem login: ${ENGELADMIN} ${ENGELPASSWORD}"
Personal tools
Namespaces

Variants
Actions
Navigation
syn2cat
Hackerspace
Activities
Initiatives
Community
Tools
Tools