Big restructuring by moving to python

This commit is contained in:
budtmo
2023-05-09 19:34:44 +02:00
parent abcdf3f4d1
commit 6767970307
448 changed files with 2493 additions and 5679 deletions
+61
View File
@@ -0,0 +1,61 @@
VNC-CLIENT
----------
Vnc-server inside container is run on port 5900
1. Run docker-android:
```
docker run -d -p 5900:5900 -e EMULATOR_DEVICE="Samsung Galaxy S10" --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0
```
2. Connect docker-container using vnc-client
Environment variables that can be passed to docker container for vnc configuration:
|Environment Variable |Description |Example|
|:---|:---|:---|
|VNC_PASSWORD|protect vnc connection with password|docker run ... -e VNC_PASSWORD=thisissecret ...|
VNC-WEB
-------
Vnc-web inside container is run on port 6080
Environment variables that can be passed to docker container for vnc configuration:
|Environment Variable |Description |Example|
|:---|:---|:---|
|WEB_VNC|access inside of the container through web-ui|docker run ... -p 6080:6080 -e WEB_VNC=true ...|
|WEB_VNC_PORT|access inside of the container through web-ui on given port (default port 6080)|docker run ... -p 6081:6081 -e WEB_VNC=true -e WEB_VNC_PORT=6081 ...|
Possible endpoints if WEB_VNC is activated:
|Endpoint |Description |Example|
|:---|:---|:---|
|autoconnect|access web-ui of vnc direclty|http://localhost:6080/?autoconnect=true|
|view_only|give only view access|http://localhost:6080/?autoconnect=true&view_only=true|
|password|access web-ui of vnc directly with protected password|http://localhost:6080/?autoconnect=true&password=thisissecret|
LOG-SHARING
-----------
The user has possibility to access log-files through web-ui:
|Environment Variable |Description |Example|
|:---|:---|:---|
|WEB_LOG|access log-files through web-ui|docker run ... -e WEB_LOG=true ...|
|WEB_LOG_PORT|access log-files through web-ui on given port (default port 9000)|docker run ... -e WEB_LOG=true -e WEB_LOG_PORT=9001 ...|
EMULATOR
--------
Possible environment variable to configure the Emulator:
|Environment Variable |Description |Example|
|:---|:---|:---|
|EMULATOR_NAME|give emulator name (default name is a combination between Device name and Android version)|docker run ... -e EMULATOR_NAME=my_emu ...|
|EMULATOR_DATA_PARTITION|set data partition on emulator (default value 550m)|docker run ... -e EMULATOR_DATA_PARTITION=900m ...|
|EMULATOR_NO_SKIN|deploying emulator without skin|docker run ... -e EMULATOR_NO_SKIN=true ...|
The user can also pass needed arguments to android emulator through environment variable ***EMULATOR_ADDITIONAL_ARGS***. Please check [this page](https://developer.android.com/studio/run/emulator-commandline) for possible arguments that can be passed.
[<- BACK TO README](../README.md)
+85
View File
@@ -0,0 +1,85 @@
Docker-Android-Pro
------------------
Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo). After donation, please send email [here](mailto:budtmo2.os@gmail.com) with following format on subject email: ```<github_id>-<date-when-donation-is-made>-<email>``` e.g. ```budtmo-30.01.2021-myemail@test.com```. The script will validate everything and it will send the access token to that email within 48 hours to be able to pull the pro version of docker-android image. Contact [@budtmo](https://github.com/budtmo) if you dont get access token after donation. The access token will be removed as soon as the user become inactive sponsor.
The differences between normal version and pro version are:
|Feature |Normal |Pro |Comment|
|:---|:---|:---|:---|
|user-behavior-analytics|Yes|No|-|
|proxy|No|Yes|Set up company proxy on Android emulator on fly|
|language|No|Yes|Set up language on Android emulator on fly|
|root-privileged|No|Yes|Able to run command with security privileged|
|headless-mode|No|Yes|Save resources by using headless mode|
|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container|
|Google Play Store|No|Yes (soon)|-|
|Video Recording|No|Yes (soon)|Helpful for debugging|
List of Docker-Images
---------------------
|Android |API |Type |Image with latest release version |Image with specific release version|
|:---|:---|:---|:---|:---|
|9.0|28|Normal|budtmo2/docker-android-pro:emulator_9.0_v2.0|budtmo2/docker-android-pro:emulator_9.0_<release_version>|
|10.0|29|Normal|budtmo2/docker-android-pro:emulator_10.0|budtmo2/docker-android-pro:emulator_10.0_<release_version>|
|11.0|30|Normal|budtmo2/docker-android-pro:emulator_11.0|budtmo2/docker-android-pro:emulator_11.0_<release_version>|
|12.0|32|Normal|budtmo2/docker-android-pro:emulator_12.0|budtmo2/docker-android-pro:emulator_12.0_<release_version>|
|13.0|33|Normal|budtmo2/docker-android-pro:emulator_13.0|budtmo2/docker-android-pro:emulator_13.0_<release_version>|
|9.0|28|Headless|budtmo2/docker-android-pro:emulator_headless_9.0_v2.0|budtmo2/docker-android-pro:emulator_headless_9.0_<release_version>|
|10.0|29|Headless|budtmo2/docker-android-pro:emulator_headless_10.0|budtmo2/docker-android-pro:emulator_headless_10.0_<release_version>|
|11.0|30|Headless|budtmo2/docker-android-pro:emulator_headless_11.0|budtmo2/docker-android-pro:emulator_headless_11.0_<release_version>|
|12.0|32|Headless|budtmo2/docker-android-pro:emulator_headless_12.0|budtmo2/docker-android-pro:emulator_headless_12.0_<release_version>|
|13.0|33|Headless|budtmo2/docker-android-pro:emulator_headless_13.0|budtmo2/docker-android-pro:emulator_headless_13.0_<release_version>|
***Note: Headless mode does not have any Web-UI***
You can always pull the latest image tag. In case you want to see the release version that has been built with a changelog note and use that specific release version, you can see that information by logging into [docker-hub-ui](https://hub.docker.com) using given access token.
List of Devices
---------------
Type | Device Name
----- | -----
Phone | Samsung Galaxy S10
Phone | Samsung Galaxy S9
Phone | Samsung Galaxy S8
Phone | Samsung Galaxy S7 Edge
Phone | Samsung Galaxy S7
Phone | Samsung Galaxy S6
Phone | Nexus 4
Phone | Nexus 5
Phone | Nexus One
Phone | Nexus S
Tablet | Nexus 7
Proxy
-----
You can enable proxy inside container and Android emulator by passing following environment variables:
- HTTP_PROXY="http://\<docker\_bridge\_ip>:<port>"
- HTTPS_PROXY="http://\<docker\_bridge\_ip>:<port>"
- NO_PROXY="localhost"
- EMULATOR_PROXY_URL="http://\<docker\_bridge\_ip>:<port>"
- EMULATOR_PROXY_USER="\<proxy_user>"
- EMULATOR_PROXY_PASS="\<proxy_pass>"
Language
--------
You can change the language setting of Android Emulator on the fly by passing following environment variable:
- EMULATOR_LANGUAGE="\<language>"
- EMULATOR_COUNTRY="\<country>"
Version
-------
[<- BACK TO README](../README.md)
+44
View File
@@ -0,0 +1,44 @@
Genymotion Cloud
----------------
![Genymotion](../images/logo_genymotion.png)
You can use Genymotion Android virtual devices in the cloud. They are available on [SaaS](http://bit.ly/2YP0P1l) or as virtual images on AWS, GCP or Alibaba Cloud.
1. On SaaS <br />
Use [saas.json](../example/genymotion/saas.json) to define the devices that you want to use. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command
```
export USER="xxx"
export PASS="xxx"
docker run -d -p 4723:4723 -v ${PWD}/example/genycloud/saas.json:/home/androidusr/genymotion_template/saas.json -e DEVICE_TYPE=geny_saas -e GENY_SAAS_USER=${USER} -e GENY_SAAS_PASS=${PASS} -e APPIUM=true --name android-container budtmo/docker-android:genymotion
```
The deployed device(s) are automatically connected with adb inside docker container. Stopping the emulator will remove all deployed device(s) on Genymotion SaaS and user will be logged out at the end.
```
docker stop android-container
```
In case you are interesed to play around with Genymotion on SaaS, you can register to [this link](http://bit.ly/2YP0P1l) to get free minutes for free.
2. On AWS <br />
Use [aws.json](../example/genymotion/aws.json) to define the devices that you want to use. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command
```
export AWS_ACCESS_KEY_ID="xxx"
export AWS_SECRET_ACCESS_KEY="xxx"
docker run -it --rm -p 4723:4723 -v ${PWD}/example/genycloud/aws.json:/home/androidusr/genymotion_template/aws.json -e DEVICE_TYPE=geny_aws -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -e GENY_SAAS_PASS=${AWS_SECRET_ACCESS_KEY} -e APPIUM=true budtmo/docker-android:genymotion
```
The deployed device(s) are automatically connected with adb inside docker container. Stopping the emulator will remove all deployed device(s) on Genymotion SaaS and user will be logged out at the end. As destroying all deployed ressources take time in AWS (it takes around 3 min), you need to specify the waiting time on docker stop
```
docker stop --time=180 android-container
```
[<- BACK TO README](../README.md)
+46
View File
@@ -0,0 +1,46 @@
# Docker-Android's Anonymous Aggregate User Behavior Analytics
Docker-Android has begun gathering anonymous aggregate user behavior analytics and reporting these to Google Sheets through Google Forms API (Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw). You are notified about this when you start Docker-Android.
## Why?
We don't have direct communication with its users nor time resources to ask directly for their feedback. As a result, we now use anonymous aggregate user behavior analytics to help us understand how Docker-Android is being used, the most common used features based on how, where and when people use it. With this information we can prioritize some features over other ones.
## What?
Docker-Android's Sheets record some shared information for every event:
* Date and time when Docker-Android started
* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts
* City (the information come from https://ipinfo.io)
* Region (the information come from https://ipinfo.io)
* Country (the information come from https://ipinfo.io)
* Release version of Docker-Android
* Appium (Whether user use Appium or not - The possible value will be "true" or "false")
* Appium Additional Arguments
* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false")
* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false")
* Screen-Resolution
* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws")
* Emulator Device (Which device profile and skin is used if the user use device_type "emulator")
* Emulator Android Version (Which Android version is used if the user use device_type "emulator"
* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false")
* Emulator Data Partition
* Emulator Additional Arguments
With the recorded information, it is not possible for us to match any particular real user.
## When/Where?
Docker-Android's user behavior analytics are sent throughout Docker-Android's execution to Google Sheets through Google Forms API over HTTPS.
## Who?
Docker-Android's analytics are accessible to Docker-Android's current maintainers. Contact [@budtmo](https://github.com/budtmo) if you are a maintainer and need access.
## How?
The code is viewable in [these scripts](../cli/src/device).
## Opting out before starting Docker-Android
Docker-Android analytics helps us, maintainers and leaving it on is appreciated. However, if you want to opt out and not send any information, you can do this by using passing environment variable USER_BEHAVIOR_ANALYTICS=false to the Docker container.
## Disclaimer
This document and the implementation are based on the great idea implemented by [Homebrew](https://github.com/Homebrew/brew/blob/master/docs/Analytics.md)
[<- BACK TO LICENSE](../LICENSE.md)
+19
View File
@@ -0,0 +1,19 @@
Run Appium Server
-----------------
Appium is automation test framework to test mobile website and mobile application, including Android. To be able to use Appium, you need to run Appium-Server. You run Appium-Server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=true***.
```
docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0
```
### Additional parameters to Appium Server
The user can pass the additional parameter to Appium Server through environment variable ***APPIUM_ADDITIONAL_ARGS***. Please check [this page](http://appium.io/docs/en/2.0/cli/args/) for possible arguments that can be passed to Appium 2.x.
### Connect to Selenium Grid 4.x
The user can connect docker-android that contains Appium 2.x to Selenium Grid 4.x without any additional configurations / changes in docker-android project. Please check [this page](http://appium.io/docs/en/2.0/guides/grid/) for detail information
[<- BACK TO README](../README.md)
@@ -0,0 +1,19 @@
Build Android project
---------------------
Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project:
1. Clone [this sample test project](https://github.com/android/testing-samples).
```
git clone git@github.com:android/testing-samples.git
```
2. Build the project
```
docker run -it --rm -v $PWD/testing-samples/ui/espresso/BasicSample:/home/androidusr/tmp -w /home/androidusr/tmp --entrypoint "/bin/bash" budtmo/docker-android:emulator_11.0_v2.0 -c "./gradlew build"
```
[<- BACK TO README](../README.md)
+18
View File
@@ -0,0 +1,18 @@
Azure
-----
Make sure that the nodes, pods, containers for your emulators are generated within a **VM** of series **Dv3** or **Ev3**.
Reference: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nested-virtualization
AWS
-----
Make sure that containers for your emulators are generated within a EC2 Bare Metal Instance(i3.metal)
Reference: https://aws.amazon.com/jp/blogs/aws/new-amazon-ec2-bare-metal-instances-with-direct-access-to-hardware/
Google Cloud (GCE)
------------------
Make sure your instances for your emulators have Nested Virtualization enabled
Reference: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances
[<- BACK TO README](../README.md)
@@ -0,0 +1,17 @@
Control emulator from host machine
----------------------------------
1. Open port 5554 and 5555 while running docker-android container
```
docker run ... -p 5554:5554 -p 5555:5555 ...
```
2. Connect emulator inside docker-android container with host adb
```
adb connect <docker-machine-ip-address>:5555
```
![connect_emulator_with_host_machine](../images/use-case_control-emulator.png)
[<- BACK TO README](../README.md)
+9
View File
@@ -0,0 +1,9 @@
Jenkins
-------
Following Jenkins plug-ins supports Docker-Android to optimize your work.
1. Live preview: [budtmo/jenkins-plugin-vncviewer-docker-container](https://github.com/budtmo/vncviewer-docker-container-plugin)
[<- BACK TO README](../README.md)
+15
View File
@@ -0,0 +1,15 @@
SMS
---
- Example by using adb
```bash
docker exec -it android-container adb emu sms send <phone_number> <message>
```
- The user can also integrate it inside project using adb library.
![sms](../images/use-case_sms.png)
[<- BACK TO README](../README.md)