Skip to content

Instantly share code, notes, and snippets.

@yashaka
Last active December 12, 2019 10:32
Show Gist options
  • Select an option

  • Save yashaka/6bb38a97b4c2c7faf8079ec7f5ac3df2 to your computer and use it in GitHub Desktop.

Select an option

Save yashaka/6bb38a97b4c2c7faf8079ec7f5ac3df2 to your computer and use it in GitHub Desktop.
mfarm-install.md

linux server (ubuntu 19.04)

as it happened afterwards, better would be to stick to 16.04 or 18.04... (less tings would need to be installed manually in order to make ansible script pass)

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
    
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
   
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo usermod -aG docker $USER

sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

cd $mcloud_from_macmini

sed -i 's/10.0.147.99/10.0.147.95/g' docker-compose.yml
sed -i 's/mfarmac.local/uadt0064od.local/g' docker-compose.yml

sed -i 's/10.0.147.99/10.0.147.95/g' variables.env
sed -i 's/mfarmac.local/uadt0064od.local/g' variables.env

sed -i 's/10.0.147.99/10.0.147.95/g' ./nginx/conf.d/default.conf
sed -i 's/mfarmac.local/uadt0064od.local/g' ./nginx/conf.d/default.conf

# setup android slave

docker pull qaprosoft/appium-device:1.17
cd ..
git clone https://github.com/qaprosoft/infrappium
cd infrappium

edit infrappium/roles/devices/vars/main.yml to

---
stf_private_host: 10.0.147.95
stf_public_host: uadt0064od.local
stf_tcp_sub_port: 7250
stf_tcp_pub_port: 7270
selenium_hub_host: selenium-hub
selenium_hub_port: 4444

devices:
  - id: adb9a4ab65bffec 
    name: HT7A71A01751
    adb_port: 5038
    min_port: 7401
    max_port: 7410
    proxy_port: 9000

device name can be get in device Settings>About phone> ... device id can be get by adb devices

edited infrappium/roles/docker/tasks/main.yml to

# ...
- name: 'Installing APT packages'
  apt:
    name: "{{ item }}"
    state: present
  with_items:
# maybe here it is good to add 
#   - python
# to not install it manually afterwards...
    - python-setuptools
    - docker-ce
    - python-pip

# - name: 'Installing Ansible dependencies'
#   easy_install:
#     name: pip

#...

install prerequisites:

sudo apt install ansible
sudo apt install python
sudo apt install npm
sudo apt remove nodejs npm
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
nvm install --lts
sudo apt  install cmake
ansible-playbook -vvv -i hosts devices.yml

if the ansible script failed on cmake for opencv, disable opencv in devices.yml, and rerun ansible-playbook

add to /etc/profile

# ...
ANDROID_HOME=/opt/android-sdk-linux
PATH=/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:$PATH

probably reboot or just restart x window...

  • ensure device has developer options availabe,
  • usb debugging turned on
  • Verify apps over USB - turned off
  • usb configuration - MTP or PTP

plug device and check stf at localhost ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment