Reverting changes to build/get_python_test_deps.py

We are addressing this issue in another branch. See (webrtc/apprtc#407).
1 file changed
tree: af0b2b7d836e77fb53afd33c6c9db6bbf4590444
  1. .gitignore
  2. .travis.yml
  3. CONTRIBUTING.md
  4. Gruntfile.js
  5. ISSUE_TEMPLATE.md
  6. LICENSE.md
  7. PULL_REQUEST_TEMPLATE.md
  8. README.md
  9. build/
  10. karma.conf.js
  11. package.json
  12. src/
  13. tools/
README.md

Build Status

AppRTC Demo Code

Development

Detailed information on developing in the webrtc github repo can be found in the WebRTC GitHub repo developer's guide.

The development AppRTC server can be accessed by visiting http://localhost:8080.

Running AppRTC locally requires the Google App Engine SDK for Python and Grunt.

Detailed instructions for running on Ubuntu Linux are provided below.

Running on Ubuntu Linux

Install grunt by first installing npm. npm is distributed as part of nodejs.

sudo apt-get install nodejs
sudo npm install -g npm

On Ubuntu 14.04 the default packages installs /usr/bin/nodejs but the /usr/bin/node executable is required for grunt. This is installed on some Ubuntu package sets; if it is missing, you can add this by installing the nodejs-legacy package,

sudo apt-get install nodejs-legacy

It is easiest to install a shared version of grunt-cli from npm using the -g flag. This will allow you access the grunt command from /usr/local/bin. More information can be found on gruntjs Getting Started.

sudo npm -g install grunt-cli

Omitting the -g flag will install grunt-cli to the current directory under the node_modules directory.

Finally, you will want to install grunt and required grunt dependencies. This can be done from any directory under your checkout of the webrtc/apprtc repository.

npm install

Before you start the AppRTC dev server and *everytime you update the source code you need to recompile the App Engine package by running,

grunt build

Start the AppRTC dev server from the out/app_engine directory by running the Google App Engine SDK dev server,

<path to sdk>/dev_appserver.py ./out/app_engine

Then navigate to http://localhost:8080 in your browser (given it's on the same machine).

Testing

All tests by running grunt.

To run only the Python tests you can call,

grunt runPythonTests

Enabling Local Logging

Note that logging is automatically enabled when running on Google App Engine using an implicit service account.

By default, logging to a BigQuery from the development server is disabled. Log information is presented on the console. Unless you are modifying the analytics API you will not need to enable remote logging.

Logging to BigQuery when running LOCALLY requires a secrets.json containing Service Account credentials to a Google Developer project where BigQuery is enabled. DO NOT COMMIT secrets.json TO THE REPOSITORY.

To generate a secrets.json file in the Google Developers Console for your project:

  1. Go to the project page.
  2. Under APIs & auth select Credentials.
  3. Confirm a Service Account already exists or create it by selecting Create new Client ID.
  4. Select Generate new JSON key from the Service Account area to create and download JSON credentials.
  5. Rename the downloaded file to secrets.json and place in the directory containing analytics.py.

When the Analytics class detects that AppRTC is running locally, all data is logged to analytics table in the dev dataset. You can bootstrap the dev dataset by following the instructions in the Bootstrapping/Updating BigQuery.

BigQuery

When running on App Engine the Analytics class will log to analytics table in the prod dataset for whatever project is defined in app.yaml.

Schema

bigquery/analytics_schema.json contains the fields used in the BigQuery table. New fields can be added to the schema and the table updated. However, fields cannot be renamed or removed. Caution should be taken when updating the production table as reverting schema updates is difficult.

Update the BigQuery table from the schema by running,

bq update -t prod.analytics bigquery/analytics_schema.json

Bootstrapping

Initialize the required BigQuery datasets and tables with the following,

bq mk prod
bq mk -t prod.analytics bigquery/analytics_schema.json

Deployment

Instructions were performed on Ubuntu 14.04 using Python 2.7.6 and Go 1.6.3.

  1. Clone the AppRTC repository
  2. Do all the steps in the Collider instructions then continue on step 3.
  3. Install and start a Coturn TURN server according to the instructions on the project page.
  4. Open src/app_engine/constants.py and do the following:

Collider

  • If using Google Cloud Engine VM's for Collider
    • Change WSS_INSTANCE_HOST_KEY WSS_, WSS_INSTANCE_NAME_KEY and WSS_INSTANCE_ZONE_KEY to corresponding values for your VM instances which can be found in the Google Cloud Engine management console.
  • Else if using other VM hosting solution
    • Change WSS_INSTANCE_HOST_KEY to the hostname and port Collider is listening too, e.g. localhost:8089 or otherHost:443.

TURN/STUN

  • If using TURN and STUN servers directly

    • Comment out TURN_SERVER_OVERRIDE = [] and then uncomment TURN_SERVER_OVERRIDE = [ { "urls":...] three lines below and fill your TURN server details, e.g.
    TURN_SERVER_OVERRIDE = [
      {
        "urls": [
          "turn:hostnameForYourTurnServer:19305?transport=udp",
          "turn:hostnameForYourTurnServer:19305?transport=tcp"
        ],
        "username": "TurnServerUsername",
        "credential": "TurnServerCredentials"
      },
      {
        "urls": [
          "stun:hostnameForYourStunServer:19302"
        ]
      }
    ]
    
  • Else if using ICE Server provider [1]

    • Change ICE_SERVER_BASE_URL to your ICE server provider host.
    • Change ICE_SERVER_URL_TEMPLATE to a path or empty string depending if your ICE server provider has a specific URL path or not.
    • Change ICE_SERVER_API_KEY to an API key or empty string depending if your ICE server provider requires an API key to access it or not.
    ICE_SERVER_BASE_URL = 'https://networktraversal.googleapis.com'
    ICE_SERVER_URL_TEMPLATE = '%s/v1alpha/iceconfig?key=%s'
    ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
    

8. Build AppRTC using grunt build then deploy/run:

  • If running locally using the Google App Engine dev server (dev/testing purposes)

    • Start it using dev appserver provided by the Google app engine SDK pathToGAESDK/dev_appserver.py out/app_engine/.
  • Else if running on Google App Engine in the Google Cloud (production)

9. Open a WebRTC enabled browser and navigate to http://localhost:8080 or https://[YOUR_VERSION_ID]-dot-[YOUR_PROJECT_ID] (append ?wstls=false to the URL if you have TLS disabled on Collider for dev/testing purposes).

[1] ICE Server provider AppRTC by default uses an ICE server provider to get TURN servers. Previously we used a compute engine on demand service (it created TURN server instances on demand in a region near the connecting users and stored them in shared memory) and web server with a REST API described in draft-uberti-rtcweb-turn-rest-00. This has now been replaced with a Google service. It's similar from an AppRTC perspective but with a different response format.