-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from zebrunner/develop
2.0 rc1
- Loading branch information
Showing
5 changed files
with
132 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,155 +1,49 @@ | ||
FROM ubuntu:16.04 | ||
|
||
ENV ANDROID_HOME /opt/mcloud/android-sdk-linux | ||
ENV PATH ${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/build-tools:$PATH | ||
|
||
ENV SELENIUM_HUB_HOST selenium-hub | ||
ENV SELENIUM_HUB_PORT 4444 | ||
ENV PROXY_PORT 9000 | ||
|
||
ENV ADB_PORT 5037 | ||
|
||
# Appium related args | ||
ENV APPIUM_LOG_LEVEL debug | ||
ENV APPIUM_RELAXED_SECURITY --relaxed-security | ||
|
||
ENV STF_PROVIDER_NAME mcloud-android | ||
ENV STF_PROVIDER_PUBLIC_IP localhost | ||
ENV STF_PROVIDER_DEVICE_NAME device | ||
ENV DEVICE_UDID ab12345 | ||
|
||
ENV STF_PROVIDER_HOST localhost | ||
ENV STF_PROVIDER_APPIUM_PORT 4723 | ||
|
||
ENV STF_PROVIDER_CONNECT_SUB tcp://localhost:7250 | ||
ENV STF_PROVIDER_CONNECT_PUSH tcp://localhost:7270 | ||
|
||
ENV STF_PROVIDER_BOOT_COMPLETE_TIMEOUT 60000 | ||
ENV STF_PROVIDER_CLEANUP false | ||
ENV STF_PROVIDER_GROUP_TIMEOUT 3600 | ||
ENV STF_PROVIDER_HEARTBEAT_INTERVAL 10000 | ||
ENV STF_PROVIDER_LOCK_ROTATION false | ||
ENV STF_PROVIDER_MIN_PORT 7400 | ||
ENV STF_PROVIDER_MAX_PORT 7410 | ||
ENV STF_PROVIDER_MUTE_MASTER never | ||
ENV STF_PROVIDER_SCREEN_JPEG_QUALITY 30 | ||
ENV STF_PROVIDER_SCREEN_PING_INTERVAL 30000 | ||
FROM zebrunner/stf:2.0 | ||
|
||
# https://github.com/zebrunner/android-device/issues/70 | ||
# gray screen on android after 48 hours without restart | ||
# https://github.com/openstf/stf/issues/100 | ||
ENV ZMQ_TCP_KEEPALIVE=1 | ||
ENV ZMQ_TCP_KEEPALIVE_IDLE=600 | ||
#ENV ZMQ_IPV6= | ||
|
||
ENV STF_PROVIDER_ADB_HOST=appium | ||
ENV STF_PROVIDER_ADB_PORT=5037 | ||
|
||
ENV STF_PROVIDER_PUBLIC_IP=localhost | ||
ENV PUBLIC_IP_PORT=80 | ||
ENV PUBLIC_IP_PROTOCOL=http | ||
|
||
ENV PLATFORM_NAME=android | ||
ENV STF_PROVIDER_DEVICE_NAME= | ||
|
||
ENV STF_PROVIDER_HOST=localhost | ||
ENV STF_PROVIDER_CONNECT_SUB=tcp://localhost:7250 | ||
ENV STF_PROVIDER_CONNECT_PUSH=tcp://localhost:7270 | ||
|
||
ENV STF_PROVIDER_BOOT_COMPLETE_TIMEOUT=60000 | ||
ENV STF_PROVIDER_CLEANUP=false | ||
ENV STF_PROVIDER_GROUP_TIMEOUT=3600 | ||
ENV STF_PROVIDER_HEARTBEAT_INTERVAL=10000 | ||
ENV STF_PROVIDER_LOCK_ROTATION=false | ||
ENV STF_PROVIDER_MIN_PORT=7404 | ||
ENV STF_PROVIDER_MAX_PORT=7410 | ||
ENV STF_PROVIDER_MUTE_MASTER=never | ||
ENV STF_PROVIDER_SCREEN_JPEG_QUALITY=30 | ||
ENV STF_PROVIDER_SCREEN_PING_INTERVAL=30000 | ||
# disable screen reset by default to not hide applications and corrupt automated runs | ||
ENV STF_PROVIDER_SCREEN_RESET false | ||
ENV STF_PROVIDER_VNC_INITIAL_SIZE 600x800 | ||
ENV STF_PROVIDER_VNC_PORT 5900 | ||
ENV STF_PROVIDER_SCREEN_RESET=false | ||
ENV STF_PROVIDER_VNC_INITIAL_SIZE=600x800 | ||
ENV STF_PROVIDER_VNC_PORT=5900 | ||
|
||
# #56 disable ssl verification by stf provider slave (fix screenshots generation over ssl) | ||
ENV NODE_TLS_REJECT_UNAUTHORIZED 0 | ||
|
||
ENV NODE_TLS_REJECT_UNAUTHORIZED=0 | ||
|
||
##################### STF ################## | ||
# Sneak the stf executable into $PATH. | ||
ENV PATH /app/bin:$PATH | ||
# Work in app dir by default. | ||
WORKDIR /app | ||
# Switch to the app user. | ||
USER stf | ||
|
||
COPY files/configgen.sh /opt/configgen.sh | ||
COPY files/healthcheck /usr/local/bin/ | ||
|
||
COPY files/configgen.sh /opt/ | ||
COPY files/start_all.sh /opt/ | ||
|
||
RUN mkdir -p /opt/apk /var/lib/jenkins/workspace /app | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
useradd --system \ | ||
--create-home \ | ||
--shell /usr/sbin/nologin \ | ||
stf-build && \ | ||
useradd --system \ | ||
--create-home \ | ||
--shell /usr/sbin/nologin \ | ||
stf && \ | ||
dpkg --add-architecture i386 && \ | ||
sed -i'' 's@http://archive.ubuntu.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@' /etc/apt/sources.list && \ | ||
apt-get update && apt-get install -y \ | ||
openjdk-8-jdk \ | ||
curl \ | ||
gettext-base \ | ||
lib32ncurses5 \ | ||
lib32stdc++6 \ | ||
lib32z1 \ | ||
unzip \ | ||
wget \ | ||
python build-essential \ | ||
libgtk2.0-0:i386 \ | ||
libnss3-dev \ | ||
libgconf-2-4 \ | ||
dnsutils \ | ||
telnet \ | ||
net-tools \ | ||
nano \ | ||
|
||
# Install 8.x and 10.x node and npm (6.x) | ||
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \ | ||
&& apt-get -qqy install nodejs \ | ||
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \ | ||
&& apt-get install -y nodejs | ||
|
||
#=============== | ||
# Set JAVA_HOME | ||
#=============== | ||
ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre" | ||
|
||
# Install STF dependencies | ||
RUN npm link --force node@8 \ | ||
&& su stf-build -s /bin/bash -c '/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install' \ | ||
&& apt-get -qqy update \ | ||
&& apt-get -qqy install libzmq3-dev libprotobuf-dev git graphicsmagick yasm \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/* \ | ||
|
||
# Reload cache after add location of graphic libraries | ||
&& ldconfig -v \ | ||
&& chmod +x /opt/configgen.sh | ||
|
||
# Install add-apt-repository and ffmpeg | ||
RUN apt-get -qqy update \ | ||
&& apt-get -qqy install software-properties-common \ | ||
&& add-apt-repository ppa:jonathonf/ffmpeg-4 \ | ||
&& apt-get -qqy update \ | ||
&& apt-get -qqy install ffmpeg | ||
|
||
# Clone STF | ||
RUN git clone --single-branch --branch master https://github.com/zebrunner/stf.git /opt/stf | ||
|
||
# Give permissions to our build user. | ||
RUN chown -R stf-build:stf-build /opt /app /usr/lib/node_modules/npm /var/lib/apt | ||
|
||
# Switch over to the build user. | ||
USER stf-build | ||
|
||
# Run the build. | ||
RUN set -x && \ | ||
cd /opt/stf && \ | ||
export PATH=$PWD/node_modules/.bin:$PATH && \ | ||
npm install --loglevel http && \ | ||
npm pack && \ | ||
tar xzf devicefarmer-stf-*.tgz --strip-components 1 -C /app && \ | ||
bower cache clean && \ | ||
npm prune --production && \ | ||
mv node_modules/* /app/node_modules/ && \ | ||
# npm cache clean && \ | ||
rm -rf /var/lib/apt/lists/* ~/.node-gyp && \ | ||
cd /app | ||
|
||
# Install websockify | ||
RUN git clone https://github.com/novnc/websockify.git /opt/websockify && \ | ||
cd /opt/websockify && git checkout tags/v0.9.0 -b v0.9.0 && make | ||
|
||
# Unable to use stf user as device can not be detected by adb! | ||
## Switch to the app user. | ||
#USER stf | ||
|
||
USER root | ||
RUN rm -rf /tmp/* /var/tmp/* | ||
|
||
CMD bash /opt/start_all.sh | ||
|
||
HEALTHCHECK CMD ["healthcheck"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# android-device | ||
Docker image used by Zebrunner Device Farm ([MCloud](https://github.com/zebrunner/mcloud)). | ||
* Appium | ||
* STF provider | ||
* Websockify | ||
Zebrunner MCloud Device | ||
================== | ||
|
||
Feel free to support the development with a [**donation**](https://www.paypal.com/donate?hosted_button_id=JLQ4U468TWQPS) for the next improvements. | ||
|
||
<p align="center"> | ||
<a href="https://zebrunner.com/"><img alt="Zebrunner" src="https://github.com/zebrunner/zebrunner/raw/master/docs/img/zebrunner_intro.png"></a> | ||
</p> | ||
|
||
MCloud Device is docker image with enhanced STF provider service for Android and iOS devices. | ||
Follow [MCloud](https://github.com/zebrunner/mcloud) instructions to reuse this image effectively for manual and automated testing. | ||
|
||
## Documentation and free support | ||
* [Zebrunner PRO](https://zebrunner.com) | ||
* [Zebrunner CE](https://zebrunner.github.io/community-edition) | ||
* [Zebrunner Reporting](https://zebrunner.com/documentation) | ||
* [Carina Guide](http://zebrunner.github.io/carina) | ||
* [Demo Project](https://github.com/zebrunner/carina-demo) | ||
* [Telegram Channel](https://t.me/zebrunner) | ||
|
||
## License | ||
Code - [Apache Software License v2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
Documentation and Site - [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/deed.en_US) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Android device container is considered healthy if adb, stf provider/cli and appium up&running | ||
# STF device container is considered healthy if stf provider/cli and wda for iOS up&running | ||
# 0 - healthy | ||
# 1 - unhealthy | ||
|
||
#ADB_STATUS=$(adb devices | grep -c ${DEVICE_UDID}) | ||
#if [ ! "$ADB_STATUS" -eq "1" ]; then | ||
# echo "ADB service is not detected!" | ||
# pkill adb | ||
# exit 1 | ||
#fi | ||
|
||
stf_device_pid=`pgrep -f "cli device"` | ||
stf_device_pid=`pgrep -f "cli"` | ||
if [[ -z $stf_device_pid ]]; then | ||
echo "STF device cli is not detected!" | ||
pkill node | ||
exit 1 | ||
fi | ||
|
||
curl --silent http://localhost:${STF_PROVIDER_APPIUM_PORT}/wd/hub/status | grep "\"status\":0" | ||
if [[ ! $? -eq 0 ]]; then | ||
echo "Appium service is not detected!" | ||
pkill node | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
Oops, something went wrong.