• Ubuntu-Docker-STF(devicefarmer)环境搭建 (android 12)


    install docker

    1. sudo apt update
    2. sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    3. sudo apt-get install ca-certificates curl gnupg lsb-release
    4. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    5. echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
    6. $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    7. sudo apt-get update
    8. sudo apt-get install docker-ce docker-ce-cli containerd.io
    9. sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    pull images

    1. # stf 镜像
    2. docker pull devicefarmer/stf:latest
    3. # adb 镜像
    4. docker pull sorccu/adb:latest
    5. #rethinkdb镜像
    6. docker pull rethinkdb:latest
    7. #ambassador 镜像
    8. docker pull openstf/ambassador:latest
    9. #nginx 镜像
    10. docker pull nginx:latest

     check image status

    1. iffy@iffy-EP43-DS3L:~$ sudo docker images
    2. REPOSITORY TAG IMAGE ID CREATED SIZE
    3. nginx latest bc649bab30d1 6 days ago 187MB
    4. rethinkdb latest e957f5cf787c 6 days ago 122MB
    5. devicefarmer/stf latest f5002a3bdc11 2 weeks ago 1.73GB
    6. openstf/ambassador latest 938a816f078a 3 years ago 8.63MB
    7. sorccu/adb latest 7123ee61b746 5 years ago 30.5MB

    start service by order

    1. sudo docker run -d --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 8192 --http-port 8090
    2. sudo docker run -d --name adbd --privileged -v /dev/bus/usb:/dev/bus/usb --net host sorccu/adb:latest
    3. sudo docker run -d --name stf --net host devicefarmer/stf stf local --public-ip 192.168.xx.247 --allow-remote

    check container running status

    1. iffy@iffy-EP43-DS3L:~$ sudo docker ps -a
    2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    3. 162efd735480 devicefarmer/stf "stf local --public-…" 2 minutes ago Up 2 minutes stf
    4. b0cfcdab540e sorccu/adb:latest "/sbin/tini -- adb -…" 3 minutes ago Up 3 minutes adbd
    5. db85319f71a1 rethinkdb "rethinkdb --bind al…" 5 minutes ago Up 5 minutes rethinkdb

    if phone and server not connected with physical usb cable, you can use below command

    sudo docker exec -i -t d35657ce5d1e adb connect 172.16.250.xxx

    windows not work just for reference



    1.download docker for win

    2.打开PowerShell,更新 wsl 

    wsl --update, 然后重启

    3. https://github.com/nikosch86/stf-poc 下载stf-poc-master文件夹到docker服务所在机器上,要做的修改如下:

        1) .env文件:将ip改成docker服务所在机器的ip

        2) docker-compose.yml文件:

            adb配置模块:将 - /dev/bus/usb:/dev/bus/usb,改成- D:/dockerdisk/dev/bus/usb:/dev/bus/usb(D:/dockerdisk这个位置随便写,只要是windows上的地址就行,因为连接手机时要使用wifi方式,所以地址可以随便写)

        3)配置好后,win+R打开cmd命令行方式,需要在stf-poc-master文件夹目录下进行,可参考readme。执行docker-compose up -d --build,出现下述展示,说明启动成功

    Starting stf-poc-master_adb_1 ... done

    Starting stf-poc-master_storage-temp_1 ... done

    Starting stf-poc-master_auth_1                ... done

    Starting stf-poc-master_triproxy_1    ... done

    Starting stf-poc-master_rethinkdb_1            ... done

    Starting stf-poc-master_dev-triproxy_1        ... done

    Starting stf-poc-master_storage-plugin-image_1 ... done

    Starting stf-poc-master_storage-plugin-apk_1  ... done

    Starting stf-poc-master_provider_1            ... done

    Starting stf-poc-master_migrate_1              ... done

    Starting stf-poc-master_processor_1            ... done

    Starting stf-poc-master_websocket_1            ... done

    Starting stf-poc-master_reaper_1              ... done

    Starting stf-poc-master_api_1                  ... done

    Starting stf-poc-master_app_1                  ... done

    Starting stf-poc-master_nginx_1                ... done

    4. 在浏览器中输入http://192.168.31.247/,回车,提示登陆STF,就可以看到STF界面了。

    5.adb device 有设备,STF检测不到设备

    6.下载安装apk https://github.com/openstf/stf/blob/master/vendor/STFService/STFService.apk

    7. 打开app adb shell am start -n jp.co.cyberagent.stf/.IdentityActivity

    3.docker pull openstf/stf:latest 拉取stf镜像

    4. docker pull sorccu/adb:latest  // 拉取adb镜像


    5.docker pull rethinkdb:latest  // 拉取rethinkdb数据库镜像

    6.docker pull openstf/ambassador:latest  // 拉取ambassador镜像


    7.docker pull nginx:latest  // 拉取nginx镜像

    8. 启动STF服务

    1. C:\docker>docker run -d --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 8192 --http-port 8090
    2. aca1fa84a8ff4afaf580f7ebe04a6aa5051e2f2ffd5c77de9e45a6eec41a9807

    9.启动adb service

    1. C:\docker>docker run -d --name adbd --privileged -v /dev/bus/usb:/dev/bus/usb --net host sorccu/adb:latest
    2. ccc79779ae7b1a390a783ff86f34bc956a155b8eaacf5df687d243e72d962b79

    10. 查找IP

    1. C:\docker>ipconfig
    2. IPv4 地址 . . . . . . . . . . . . : 192.168.31.247

    11.启动stf

    docker run -d --name stf --net host openstf/stf stf local --public-ip 192.168.31.247

    12.查看docker进程

    1. C:\docker>docker ps -a
    2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    3. 81fdfccd474b openstf/stf "stf local --public-…" 14 seconds ago Up 13 seconds stf
    4. ccc79779ae7b sorccu/adb:latest "/sbin/tini -- adb -…" 2 minutes ago Up 2 minutes adbd
    5. aca1fa84a8ff rethinkdb "rethinkdb --bind al…" 3 minutes ago Up 3 minutes rethinkdb

    13. http://192.168.31.247:7100

    ubuntu 环境

    1.1 下载相关镜像

    使用Docker部署,首先下载以下镜像(全部复制,一并粘贴执行就可以):

    # stf镜像
    docker pull openstf/stf:latest
    # STF镜像
    docker pull sorccu/adb:latest
     # android adb 镜像
    docker pull rethinkdb:latest
    # rethinkdb 镜像
    docker pull openstf/ambassador:latest
    # openstf 镜像
    docker pull nginx:latest
    # nginx 代理镜像

    1.2 启动STF服务

    # 启动数据库
    sudo docker run -d --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 8192 --http-port 8090
    # 启动adb service
    sudo docker run -d --name adbd --privileged -v /dev/bus/usb:/dev/bus/usb --net host sorccu/adb:latest
    # 启动stf
    docker run -d --name stf --net host openstf/stf stf local --public-ip 192.168.25.25(填写本机ip)

    1.3 访问STF云测平台

    #访问STF云测平台(使用7100端口,前方需要填写本机ip)
    http://192.168.25.25:7100


     

  • 相关阅读:
    python基础语法(1)
    python神经网络编程 代码,python神经网络编程 豆瓣
    浙大恩特客户资源管理系统fileupload.jsp,machord_doc.jsp接口任意文件上传漏洞复现 [附POC]
    Shell-AI:基于LLM实现自然语言理解的CLI工具
    基于pytorch的AOD-net模型构建
    微服务理论知识
    靠这份业界最强算法及数据结构宝典,我挺进字节跳动
    全国计算机等级考试二级考试(Python)题库
    一些并查集的题~~判树,连通,带权
    区块链加密虚拟货币交易平台安全解决方案
  • 原文地址:https://blog.csdn.net/iffy1/article/details/133847398