2018-10-04 13:42:34 +02:00
|
|
|
#!/bin/bash
|
2018-10-05 10:55:01 +02:00
|
|
|
containers=(
|
2018-10-06 15:34:57 +02:00
|
|
|
webmail
|
|
|
|
imap
|
|
|
|
smtp
|
|
|
|
antispam
|
|
|
|
admin
|
|
|
|
redis
|
|
|
|
antivirus
|
|
|
|
webdav
|
2018-10-06 15:46:01 +02:00
|
|
|
# fetchmail
|
2018-10-06 15:34:57 +02:00
|
|
|
front
|
2018-10-05 10:55:01 +02:00
|
|
|
)
|
|
|
|
|
2018-10-07 13:08:45 +02:00
|
|
|
# Time to sleep in minutes after starting the containers
|
|
|
|
WAIT=1
|
2018-10-06 15:25:12 +02:00
|
|
|
|
2018-10-04 16:18:48 +02:00
|
|
|
containers_check() {
|
2018-10-06 15:34:57 +02:00
|
|
|
status=0
|
2018-10-05 10:55:01 +02:00
|
|
|
for container in "${containers[@]}"; do
|
2018-10-06 15:34:57 +02:00
|
|
|
name="${DOCKER_ORG}_${container}_1"
|
|
|
|
echo "Checking $name"
|
|
|
|
docker inspect "$name" | grep '"Status": "running"' || status=1
|
2018-10-04 16:18:48 +02:00
|
|
|
done
|
2018-10-06 15:12:05 +02:00
|
|
|
docker ps -a
|
2018-10-06 15:34:57 +02:00
|
|
|
return $status
|
2018-10-04 16:18:48 +02:00
|
|
|
}
|
|
|
|
|
2018-10-05 10:55:01 +02:00
|
|
|
container_logs() {
|
|
|
|
for container in "${containers[@]}"; do
|
2018-10-06 15:34:57 +02:00
|
|
|
name="${DOCKER_ORG}_${container}_1"
|
|
|
|
echo "Showing logs for $name"
|
|
|
|
docker container logs "$name"
|
2018-10-05 10:55:01 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-10-06 15:03:07 +02:00
|
|
|
clean() {
|
|
|
|
docker-compose -f tests/compose/run.yml -p $DOCKER_ORG down || exit 1
|
|
|
|
rm -fv .env
|
|
|
|
}
|
|
|
|
|
|
|
|
# Cleanup before callig exit
|
|
|
|
die() {
|
|
|
|
clean
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2018-10-04 14:19:40 +02:00
|
|
|
for file in tests/compose/*.env ; do
|
2018-10-04 13:42:34 +02:00
|
|
|
cp $file .env
|
2018-10-05 11:52:19 +02:00
|
|
|
docker-compose -f tests/compose/run.yml -p $DOCKER_ORG up -d
|
2018-10-07 13:08:45 +02:00
|
|
|
echo -e "\nSleeping for ${WAIT} minutes" # Clean terminal distortion from docker-compose in travis
|
|
|
|
travis_wait sleep ${WAIT}m || sleep ${WAIT}m #Fallback sleep for local run
|
2018-10-05 10:55:01 +02:00
|
|
|
container_logs
|
2018-10-06 15:03:07 +02:00
|
|
|
containers_check || die 1
|
|
|
|
clean
|
2018-10-04 13:42:34 +02:00
|
|
|
done
|
2018-10-04 16:18:48 +02:00
|
|
|
|