Added integration with Genymotion in AWS

This commit is contained in:
butomo1989
2018-08-11 19:38:47 +02:00
parent d7c9730712
commit dd7ef41590
6 changed files with 196 additions and 17 deletions
+26 -5
View File
@@ -11,10 +11,11 @@ services:
- 4444:4444
# Please stop this container by using docker stop instead of docker-compose stop
genymotion:
cloud:
image: butomo1989/docker-android-genymotion
depends_on:
- selenium_hub
privileged: true
ports:
- 6080:6080
- 4723:4723
@@ -22,8 +23,28 @@ services:
- $PWD/sample_apk:/root/tmp/sample_apk
- $PWD/sample_devices:/root/tmp
environment:
- GENY_TEMPLATE=/root/tmp/devices.json
- USER=xxx
- PASS=xxx
- LICENSE=xxx
- TYPE=genycloud
- TEMPLATE=/root/tmp/devices.json
- USER=$USER
- PASS=$PASS
- LICENSE=$LICENSE
- CONNECT_TO_GRID=true
# Please stop this container by using docker stop instead of docker-compose stop
# The implementation still in progress
aws:
image: butomo1989/docker-android-genymotion
depends_on:
- selenium_hub
privileged: true
ports:
- 6080:6080
- 4723:4723
volumes:
- ~/.aws:/root/.aws
- $PWD/sample_apk:/root/tmp/sample_apk
- $PWD/sample_devices:/root/tmp
environment:
- TYPE=aws
- TEMPLATE=/root/tmp/aws.json
#TODO - CONNECT_TO_GRID=true
+12
View File
@@ -0,0 +1,12 @@
[
{
"region": "eu-west-1",
"ami": "ami-861125ff",
"instance": "t2.small"
},
{
"region": "eu-west-1",
"ami": "ami-861125ff",
"instance": "t2.small"
}
]
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
(export USER=$USER && export PASS=$PASS && export LICENSE=$LICENSE && docker-compose -f geny.yml up -d)
+38 -6
View File
@@ -1,18 +1,44 @@
#!/bin/bash
# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
if [ -z "$GENY_TEMPLATE" ]; then
GENY_TEMPLATE="/root/tmp/devices.json"
types=(genycloud aws)
if [ -z "$TYPE" ]; then
echo "Please specify one of following types: ${types[@]}"
exit 1
fi
TYPE=$(echo "$TYPE" | tr '[:upper:]' '[:lower:]')
if [ -z "$TEMPLATE" ]; then
case $TYPE in
"${types[0]}" )
TEMPLATE="/root/tmp/devices.json"
;;
"${types[1]}" )
TEMPLATE="/root/tmp/aws.json"
;;
*)
"Type $TYPE is not supported! Valid types: ${types[@]}"
exit 1
;;
esac
fi
if [ ! -f "$GENY_TEMPLATE" ]; then
if [ ! -f "$TEMPLATE" ]; then
echo "File not found! Nothing to do!"
exit 1
fi
echo "[geny_start] Available types: ${types[@]}"
echo "[geny_start] Selected type of deployment: $TYPE, Template file: $TEMPLATE"
export TYPE=$TYPE
export TEMPLATE=$TEMPLATE
export TYPES=${types[@]}
getAbort() {
if [ "$GENYMOTION" = true ]; then
contents=$(cat $GENY_TEMPLATE)
case $TYPE in
"${types[0]}" )
contents=$(cat $TEMPLATE)
echo "ABORT SIGNAL detected! Stopping all created emulators..."
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
get_value() {
@@ -22,7 +48,13 @@ getAbort() {
gmtool --cloud admin stopdisposable $(get_value '.device')
done
echo "Done"
fi
;;
"${types[1]}" )
contents=$(cat $TEMPLATE)
echo "ABORT SIGNAL detected! Detroy all EC2 instance(s)..."
./terraform destroy -auto-approve
;;
esac
}
trap 'getAbort; exit' EXIT