Actual instruction for deploy service on 2023/08/09
- A machine running MacOS ( to build and run the "provider" )
- A machine running Linux with Docker container support ( to run the STF server )
-
Clone this repo down to your build machine
-
Install XCode
-
Add your developer Apple ID to XCode
- XCode -> XCode menu -> Preferences -> Accounts Tab
- Click
+
underApple IDs
list - Choose
Apple ID
- Login to your account
-
Download a "Apple Development certificate" for your user
- Continue from previous step, right after logging into your Developer account in Xcode
- Select
Manage Certificates
- Click
+
in the lower left corner - Select
Apple Development
-
Clone the various needed repos ( includes WebDriverAgent )
- Run
make clone
- Run
-
Configure WebDriverAgent to use your identity for signing
- Open
repos/WebDriverAgent/WebDriverAgent.xcodeproj
in XCode - Select the WebDriverAgentLib target
- Go to the
Signing & Capabilities
tab - Select your team under
Team
- Select the WebDriverAgentRunner target
- Go to the
Signing & Capabilities
tab - Select your team under
Team
- Open
-
Run
./init.sh
- On your Linux machine
-
Copy
server
folder to your Linux machine -
Run
server/cert/gencert.sh
to generate a self-signed cert ( or use your own ) -
Note! Plain http STF server is not supported. It can be done, but it shouldn't and tickets to make it so will be closed.
-
Update
server/.env
to reflect the IP and hostname for your server -
Start STF
- docker-compose up
-
- Setup your server as normal following upstream instructions
- Create an SSL certificate for your server using the method you desire.
- Configure the OpenSTF server for SSL
- Alter stf_ios_support/coordinator/proc_stf_provider --connect-sub and --connect-push lines to match your server config
-
Copy the first {} block from
config.json.example
intoconfig.json
. Do not include any comment lines starting with // -
Update config.json
- Update
xcode_dev_team_id
to be the OU of your developer account. If you add your account into Xcode first, you can then runmake ou
to display what the OU is. You can also find it by opening the keychain, selecting the Apple Development certificate for your account, and then looking at what theOrganization Unit
is. - Update
root_path
to be where provider code should be installed, such as/Users/user/stf
- Update
config_path
to match that, such as/Users/user/stf/config.json
- Update
-
Run
make
thenmake dist
- dist.tgz will be created
- Copy
dist.tgz
from build machine - Run
tar -xf dist.tgz
- Tweak
config.json
as desired
-
Register(provision) your IOS device to your developer account as a developer device.
-
Use the API -or-
- Follow https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api to create an app store connect API key. Give it Developer access.
- Gain a session using JSON Web Tokens
- Create a provisioning profile if none exist using profiles: https://developer.apple.com/documentation/appstoreconnectapi/profiles See also https://github.com/cidertool/asc-go/blob/f08b8151f7fd92ff54924480338dafbf8a383255/asc/provisioning_profiles.go
- Post to the devices endpoint to register a device: https://developer.apple.com/documentation/appstoreconnectapi/devices See also https://github.com/cidertool/asc-go/blob/f08b8151f7fd92ff54924480338dafbf8a383255/asc/provisioning_devices.go
-
Follow these instructions: https://www.telerik.com/blogs/how-to-add-ios-devices-to-your-developer-profile I couldn't find updated instructions on Apple's website. If you find them please let me know so I can link to them.
-
-
Plug your IOS device in
-
Pair it with your system
- Run
idevicepair pair
- Accept pairing on IOS device screen
- Run
-
Have Xcode setup the "developer image" on your IOS device:
- Open Xcode
- Go to Windows... Devices and Simulators
- Wait while Developer Image is installed to your phone
-
Run
./bin/ios_video_pull -devices -decimal
to determine the PID ( product ID ) of your IOS device in decimal -
Run
./bin/devreset [decimal product ID] 1452
to reset the video streaming status of your IOS device -
Run
./run
( and leave it running ) -
Permissions dialog boxes appear for coordinator to listen on various ports; select accept for all of them
-
Device shows up in STF with video and can be controlled. Yay
Runner is a command that runs coordinator in a loop and also enables installation/update of a distribution. Runner is not necessary to use stf_ios_support. It is provided to make it easier to remotely maintain a cluster of providers. To use it:
-
Run
make
to build all the things -
Run
runner/runner -pass [some password]
to generate crypted password of your choice -
Adjust
runner/runner.json
- Update user password with the crypted output of previous step
- Update user to something else ( default user/pass are both replaceme )
- Update update_server to be host/IP address of the server you will use to run update_server
- Update updates path to be path on a provider machine where you want downloaded updates to be saved/cached
- Update install_dir path to be the path where you want
coordinator
to be installed - Update config path to be a path where
config.json
forcoordinator
will be located on provider machine
-
Rerun
make
to rebuildrunner.tgz
-
Run
make updatedist
to buildupdate_server.tgz
-
Copy
update_server.tgz
to a server -
Extract it
tar -xf update_server
-
Run it and leave it running
update_server/server
-
Copy
runner.tgz
to a provider machine -
Extract it
tar -xf runner.tgz
-
Stop any instance you may be running of
coordinator
already on the provider -
Run it in a visual GUI MacOS session
-
Go to
https://[provider ip/host]:8021
in your browser -
Accept the self-signed cert ( or make your own non-self signed cert and adjust updaet_server config )
-
Click the update button to download/install/start
coordinator
on the provider
-
libimobiledevice won't install properly right now from brew
./init.sh
make libimd
( init.sh actually already runs this )
-
Video streaming will sometimes be left in a "stuck" state
- ios_video_pull sub-process of coordinator depends on quicktime_video_hack upstream repo/library. That library does not properly "stop" itself if you start and then stop reading video from an IOS device. As a result, if you run coordinator, stop it, then start it again, it won't be able to start up again correctly.
- To fix this you can use devreset. This is why the devreset command is mentioned above currently to run before starting coordinator. devreset effectively stops the video streaming entirely, resetting it so that it can be started up again.
- Install openvpn-server on your STF server machine
- Create client certificate(s) using your favorite process...
- Create ovpn file(s) with those client certs
- Deploy those cert(s) to your provider machines; setting them up in Tunnelblick
- Alter config.json on each provider to have the name of the cert setup in Tunnelblick
- Start openvpn server on STF server
- Start coordinator/provider on each provider machine
- Run
./view_log proc ios_video_pull
to check for errors fetching h264 data from the IOS device - Run
./view_log -proc ios_video_stream
to check for errors streaming jpegs via websocket to browser - Reboot your IOS device and try again
- run
./view_log
to see list of things that log - run
./view_log -proc [one from list]
See https://github.com/devicefarmer/stf_ios_support/wiki/FAQ