docker-mw-install-all-the-dbs.sh 1.89 KB
Newer Older
Addshore's avatar
Addshore committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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

# Create
./bin/mw docker mediawiki create

# Create: Validate the basic stuff
./bin/mw docker docker-compose ps
16
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

# 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
./bin/mw docker mediawiki install

# 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"