Skip to content

Commit

Permalink
Merge pull request #15 from VKCOM/new-doc
Browse files Browse the repository at this point in the history
New doc
  • Loading branch information
irdkwmnsb authored Nov 2, 2024
2 parents de9c8b8 + 75acf3c commit 7b81d49
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Run `docker compose -f docker-compose-prod.yaml --env-file scripts/variables.env
All that's left for you is to add the devices.
To add the devices you will need a running provider instance and one or multiple adb servers that are connected to the devices.
The easiest way to run the provider is to do
1) npm ci
2) npm link --force
3) MONGODB_PORT_27017_TCP=mongodb://localhost:27017 stf provider --connect-sub "tcp://localhost:7250" --connect-push "tcp://localhost:7270" --storage-url "http://localhost:8082"
1) Ensure you have python and that setuptools is installed (needed for zeromq npm dependency)
2) Install node version 20.17 or later
3) npm ci
4) npm link --force
5) MONGODB_PORT_27017_TCP=mongodb://localhost:27017 stf provider --connect-sub "tcp://localhost:7250" --connect-push "tcp://localhost:7270" --storage-url "http://localhost:8082"

Note: some features require direct access to the provider instance from the browser, so if you are running the provider on a different machine - make sure you pass accessible url to the --public-ip.

Expand Down
7 changes: 4 additions & 3 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ VK DeviceHub - это форк проекта DeviceFarmer/stf, разработ
Для этого нужно запустить провайдер и иметь работающее adb соединение с устройством.
Самый простой способ это:
1) Убедиться что установлен питон и в нём установлен setuptools (нужен для одной из наших npm зависимостей)
2) `npm ci` - скачать и установить зависимости
3) `npm link --force` - Добавить исполняемый файл в текущий PATH
4) `MONGODB_PORT_27017_TCP=mongodb://localhost:27017 stf provider --connect-sub "tcp://localhost:7250" --connect-push "tcp://localhost:7270" --storage-url "http://localhost:8082"`
2) Установить npm версии не меньше 20.17 (рекомендуем nvm)
3) `npm ci` - скачать и установить зависимости
4) `npm link --force` - Добавить исполняемый файл в текущий PATH
5) `MONGODB_PORT_27017_TCP=mongodb://localhost:27017 stf provider --connect-sub "tcp://localhost:7250" --connect-push "tcp://localhost:7270" --storage-url "http://localhost:8082"`

Замечание:
Некоторый функционал требует наличия прямого доступа до провайдера из браузера. Поэтому в случае сложных инсталляций не забудьте передать внешнедоступный url в параметр --public-url
Expand Down
14 changes: 7 additions & 7 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ services:
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.88.0.2
ipv4_address: 172.19.0.2
mongo2:
image: mongo:6.0.10
hostname: mongo2
container_name: mongo2
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.88.0.3
ipv4_address: 172.19.0.3
mongo3:
image: mongo:6.0.10
hostname: mongo3
container_name: mongo3
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.88.0.4
ipv4_address: 172.19.0.4
mongosetup:
image: mongo:6.0.10
depends_on:
Expand All @@ -34,7 +34,7 @@ services:
volumes:
- ./scripts/mongo_setup.sh:/scripts/mongo_setup.sh
restart: "no"
entrypoint: [ "bash", "/scripts/mongo_setup.sh"]
entrypoint: ["bash", "/scripts/mongo_setup.sh"]
adb:
container_name: adb
image: devicefarmer/adb:latest
Expand All @@ -44,12 +44,12 @@ services:
privileged: true
networks:
default:
ipv4_address: 172.88.0.6
ipv4_address: 172.19.0.6
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.88.0.0/16
gateway: 172.88.0.1
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
18 changes: 17 additions & 1 deletion docker-compose-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
version: "3"

networks:
devicehub:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.19.0.0/16
gateway: 172.19.0.1

services:
nginx:
Expand All @@ -26,16 +33,25 @@ services:
ports:
- 27017:27017
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.19.0.2
mongo2:
image: mongo:6.0.10
hostname: mongo2
container_name: mongo2
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.19.0.3
mongo3:
image: mongo:6.0.10
hostname: mongo3
container_name: mongo3
entrypoint: ["mongod", "--replSet", "myReplicaSet", "--bind_ip_all"]
networks:
default:
ipv4_address: 172.19.0.4
mongosetup:
image: mongo:6.0.10
container_name: mongosetup
Expand Down
16 changes: 8 additions & 8 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
["mongod", "--replSet", "myReplicaSet", "--bind_ip", "localhost,mongo1"]
networks:
default:
ipv4_address: 172.88.0.2
ipv4_address: 172.19.0.2
mongo2:
image: mongo:6.0.10
hostname: mongo2
Expand All @@ -18,7 +18,7 @@ services:
["mongod", "--replSet", "myReplicaSet", "--bind_ip", "localhost,mongo2"]
networks:
default:
ipv4_address: 172.88.0.3
ipv4_address: 172.19.0.3
mongo3:
image: mongo:6.0.10
hostname: mongo3
Expand All @@ -27,7 +27,7 @@ services:
["mongod", "--replSet", "myReplicaSet", "--bind_ip", "localhost,mongo3"]
networks:
default:
ipv4_address: 172.88.0.4
ipv4_address: 172.19.0.4
mongosetup:
image: mongo:6.0.10
depends_on:
Expand All @@ -47,7 +47,7 @@ services:
privileged: true
networks:
default:
ipv4_address: 172.88.0.6
ipv4_address: 172.19.0.6
devicehub:
container_name: devicehub
build: .
Expand All @@ -58,19 +58,19 @@ services:
- "7400-7500:7400-7500"
environment:
- TZ='America/Los_Angeles'
- MONGODB_PORT_27017_TCP=mongodb://172.88.0.2:27017
- MONGODB_PORT_27017_TCP=mongodb://172.19.0.2:27017
- STF_ADMIN_EMAIL='test@example.com'
- STF_ADMIN_NAME='test admin'
restart: unless-stopped
command: stf local --adb-host adb --public-ip 0.0.0.0 --provider-min-port 7400 --provider-max-port 7500
networks:
default:
ipv4_address: 172.88.0.5
ipv4_address: 172.19.0.5
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.88.0.0/16
gateway: 172.88.0.1
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
8 changes: 4 additions & 4 deletions scripts/mongo_setup.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#!/bin/bash
sleep 10

mongosh --host mongo1:27017 <<EOF
mongosh --host 172.19.0.2:27017 <<EOF
var cfg = {
"_id": "myReplicaSet",
"version": 1,
"members": [
{
"_id": 0,
"host": "mongo1:27017",
"host": "172.19.0.2:27017",
"priority": 2
},
{
"_id": 1,
"host": "mongo2:27017",
"host": "172.19.0.3:27017",
"priority": 0
},
{
"_id": 2,
"host": "mongo3:27017",
"host": "172.19.0.4:27017",
"priority": 0
}
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/variables.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
STF_SECRET=nosecret
STF_URL=http://localhost:8082
MONGODB_PORT_27017_TCP=mongodb://mongo1:27017
MONGODB_PORT_27017_TCP=mongodb://172.19.0.2:27017
AUTH_TYPE=auth-mock
AUTH_URL=auth/mock/

0 comments on commit 7b81d49

Please sign in to comment.