forked from amazeeio/docker-performance-testbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·72 lines (54 loc) · 1.78 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
function printtime {
START=$(date +%s)
"$@"
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
echo -e "\033[97;48;5;21m ${DIFF} seconds\x1B[K\033[0m\n"
}
function colorecho {
echo -e "\033[30;48;5;82m $1 \x1B[K\033[0m"
}
function runTest {
pushd "$1" || exit
colorecho "### $1: removing old containers"
printtime docker-compose down -v >/dev/null || true
chmod -R +w ./ || true
rm -rf drupal
colorecho "### $1: cloning base repo"
printtime git clone https://github.com/amazeeio/drupal-example.git drupal
colorecho "### $1: starting container"
printtime docker-compose up -d --force >/dev/null
colorecho "### $1: composer install"
printtime docker-compose exec cli bash -c 'composer install --no-dev --no-interaction'
colorecho "### $1: drush site install 3x"
for i in `seq 1 3`;
do
printtime docker-compose exec cli bash -c 'cd web && drush -y si config_installer --account-name=blub [email protected]'
done
colorecho "### $1: drush cr 3x"
for i in `seq 1 3`;
do
printtime docker-compose exec cli bash -c 'cd web && drush -y cr'
done
colorecho "### $1: removing container and data"
printtime docker-compose down -v >/dev/null || true
chmod -R +w ./ || true
rm -rf drupal
popd || exit
}
colorecho "### CACHALOT"
# Loading env variables so that we use Cachalot (Docker Machine)
cachalot up >/dev/null
eval $(amazeeio-cachalot env)
runTest cachalot
# Removing Cachalot Docker Environment Variables again, now we use Docker for Mac
# see https://docs.docker.com/docker-for-mac/docker-toolbox/
cachalot halt >/dev/null
unset ${!DOCKER_*}
colorecho "### Docker for Mac - delegated"
runTest delegated
colorecho "### Docker for Mac - cached"
runTest cached
colorecho "### Docker for Mac - consistent"
runTest consistent