openstf / stf

Control and manage Android devices from your browser.
https://openstf.io
Other
13.36k stars 2.78k forks source link

docker setup guide #374

Open Ashraf-Ali-aa opened 8 years ago

Ashraf-Ali-aa commented 8 years ago

I was wondering if someone can update the documentation to get STF setup using docker, I have seen the current doc's and it's slightly confusing to people who never used docker before. I have got STF running on a mac very easily via the terminal, but would like a similar guide on setting up STF docker container via the terminal.

https://github.com/openstf/stf/blob/master/doc/DEPLOYMENT.md

Allsimon commented 7 years ago

Yup, a setup guide would be nice... I tried with this docker-compose.yml:

rethinkdb:
    image: rethinkdb

openstf:
    image: openstf/stf
    links:
        - rethinkdb
    ports:
        - "7100:7100"
        - "7110:7110"
    command: stf local

I get access to the login page at http://localhost:7100, can login, but I'm stuck with the No devices connected message (I tried 3 different devices, adb works fine but stf doesn't seems to find them). Did I miss something ?

mirceanis commented 7 years ago

Hi, There must be a good reason people keep saying stf local is not meant for docker. However, I've managed to put together a docker-compose.yml that seems to work.

rethinkdb:
  image: rethinkdb:2.3
  ports:
    - "8080:8080"
    - "28015:28015"
    - "29015:29015"
  restart: always
  volumes:
    - "/srv/rethinkdb:/data"
  command: "rethinkdb --bind all --cache-size 2048"

adbd:
  image: sorccu/adb
  privileged: true
  ports:
    - "5037:5037"
  restart: always
  volumes:
    - "/dev/bus/usb:/dev/bus/usb"

stf-local:
  image: openstf/stf
  links:
    - rethinkdb
    - adbd
  ports:
    - "7100:7100"
    - "7110:7110"
    - "7120:7120"
    - "7400-7500:7400-7500"
  restart: always
  command: stf local --public-ip 192.168.1.127 --provider-min-port 7400 --provider-max-port 7500 --adb-host adbd

Obviously, you'll have to replace the --public-ip from the last line with the IP address of your docker host.

With this setup, I'm able to access my devices by going to http://192.168.1.127:7100

I hope it helps

sorccu commented 7 years ago

Thanks, that's useful. Just to be clear though, it only works on Linux right (and not with Docker for Mac)? Someone's bound to ask later.

On Wed, Jan 4, 2017 at 3:41 mirceanis notifications@github.com wrote:

Hi,

There must be a good reason people keep saying stf local is not meant for docker.

However, I've managed to put together a docker-compose.yml that seems to work.

rethinkdb:

image: rethinkdb:2.3

ports:

- "8080:8080"

- "28015:28015"

- "29015:29015"

restart: always

volumes:

- "/srv/rethinkdb:/data"

command: "rethinkdb --bind all --cache-size 2048"

adbd:

image: sorccu/adb

privileged: true

ports:

- "5037:5037"

restart: always

volumes:

- "/dev/bus/usb:/dev/bus/usb"

stf-local:

image: openstf/stf

links:

- rethinkdb

- adbd

ports:

- "7100:7100"

- "7110:7110"

- "7120:7120"

- "7400-7500:7400-7500"

restart: always

command: stf local --public-ip 192.168.1.127 --provider-min-port 7400 --provider-max-port 7500 --adb-host adbd

Obviously, you'll have to replace the --public-ip from the last line with the IP address of your docker host.

With this setup, I'm able to access my devices by going to http://192.168.1.127:7100

I hope it helps

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openstf/stf/issues/374#issuecomment-270189145, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_TaQHbyZkGVuGenIKBN7h3vbvWqPks5rOpZRgaJpZM4JTpf2 .

jabed-m-talukder commented 7 years ago

"mirceanis" solution works on my mac, thanks.

coding-yogi commented 7 years ago

@jabed-m-talukder, did you change links to depends_on in docker compose file? I think links doesnt make sense when all 3 containers are in same network

lgvalle commented 6 years ago

I found this project for a single host deployment of STF by @nikosch86 using docker images It works well for me on Linux

https://github.com/nikosch86/stf-poc

luizlohn commented 5 years ago

@lgvalle did you try to up in this docker-compose appium to use togheter?

jagsme commented 4 years ago

@lgvalle did you try to up in this docker-compose appium to use togheter?

any updates?

linusali commented 4 years ago

Here is how I ran the containers using podman on a Fedora desktop

# Create a Podman pod for placing all containers and to share resources.
podman pod create -n stf \
 -p 5037:5037 \
 -p 7100:7100 -p 7110:7110 -p 7120:7120 -p 7400-7410:7400-7410 \
 -p 8080:8080 \
 -p 28015:28015 -p 29015:29015 

# Start rethinkdb container , you may add a volume for permanently storing data.
podman run -dt --pod stf   rethinkdb:2.3 rethinkdb --bind all --cache-size 2048

# Start ADB with privileged flag, else it won't detect new devices.
podman run -d --privileged  --rm  --pod stf --name adb  \
  -v /dev/bus/usb:/dev/bus/usb  sorccu/adb

# Finally start STF 
podman run -dt --pod stf  openstf/stf:latest \
  stf local --public-ip 192.168.1.47 \
   --provider-min-port 7400 --provider-max-port 7500 --adb-host 127.0.0.1