docker-mw-install-all-the-dbs.sh 2.33 KB
Newer Older
Addshore's avatar
Addshore committed
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env bash

set -e # Fail on errors
set -x # Output commands

# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT

11
# Setup the default hosts in hosts file
12
13
# --no-interaction, as the first time we run a docker command it'll prompt us for the port, default selected is 8080
./bin/mw docker hosts add --no-interaction
14

15
16
17
18
# Create, from the mediawiki dir, to allow --no-interaction to detect the existing mediawiki directory, setting the volume path
cd ./mediawiki
./../bin/mw docker mediawiki create --no-interaction
cd ./..
Addshore's avatar
Addshore committed
19
20
21

# Create: Validate the basic stuff
./bin/mw docker docker-compose ps
22
CURL=$(curl -s -L -N http://default.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "Is your database running and wiki database created"
Addshore's avatar
Addshore committed
23
24
25
26
27
28
29
30
31
32

# Turn on all of the services
./bin/mw docker mysql-replica create
./bin/mw docker postgres create
./bin/mw docker phpmyadmin create
./bin/mw docker adminer create

# Install everything (mysql, postgres, sqlite)
./bin/mw docker mediawiki install --dbname mysqlwiki --dbtype mysql
./bin/mw docker mediawiki install --dbname postgreswiki --dbtype postgres
33
./bin/mw docker mediawiki install --dbtype sqlite
34
35
# Update the hosts file as we used new wiki names
./bin/mw docker hosts add
Addshore's avatar
Addshore committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

# Check the DB tools (phpmyadmin, adminer)
CURL=$(curl -s -L -N http://phpmyadmin.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "Open new phpMyAdmin window"
CURL=$(curl -s -L -N http://adminer.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "Login - Adminer"

# And check the installed sites (mysql, postgres, sqlite)
CURL=$(curl -s -L -N http://default.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "MediaWiki has been installed"
CURL=$(curl -s -L -N http://postgreswiki.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "MediaWiki has been installed"
CURL=$(curl -s -L -N http://mysqlwiki.mediawiki.mwdd.localhost:8080) && echo $CURL && echo $CURL | grep -q "MediaWiki has been installed"

# Make sure the expected number of services appear
docker ps
docker ps | wc -l | grep -q "10"

# Destroy it all
./bin/mw docker destroy
# And make sure only 1 line exists after
docker ps
docker ps | wc -l | grep -q "1"