https://github.com/samdutton/apprtc-pwa
PWA version of appr.tc
https://github.com/samdutton/apprtc-pwa
Last synced: 7 months ago
JSON representation
PWA version of appr.tc
- Host: GitHub
- URL: https://github.com/samdutton/apprtc-pwa
- Owner: samdutton
- License: bsd-3-clause
- Created: 2017-05-04T15:50:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-16T17:53:15.000Z (almost 9 years ago)
- Last Synced: 2025-03-27T01:14:53.287Z (12 months ago)
- Language: JavaScript
- Size: 1020 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://travis-ci.org/webrtc/apprtc)
# AppRTC Demo Code
## Development
Detailed information on devloping in the [webrtc](https://github.com/webrtc) github repo can be found in the [WebRTC GitHub repo developer's guide](https://docs.google.com/document/d/1tn1t6LW2ffzGuYTK3366w1fhTkkzsSvHsBnOHoDfRzY/edit?pli=1#heading=h.e3366rrgmkdk).
The development AppRTC server can be accessed by visiting [http://localhost:8080](http://localhost:8080).
Running AppRTC locally requires the [Google App Engine SDK for Python](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python) and [Grunt](http://gruntjs.com/).
Detailed instructions for running on Ubuntu Linux are provided below.
### Running on Ubuntu Linux
Install grunt by first installing [npm](https://www.npmjs.com/). 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](http://gruntjs.com/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](https://github.com/webrtc/apprtc) repository.*
```
npm install
```
On Ubuntu, you will also need to install the webtest package:
```
sudo apt-get install python-webtest
```
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,
```
/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.
1. Under *APIs & auth* select *Credentials*.
1. Confirm a *Service Account* already exists or create it by selecting *Create new Client ID*.
1. Select *Generate new JSON key* from the *Service Account* area to create and download JSON credentials.
1. 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](#bootstrappingupdating-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
In order to deploy your own AppRTC instance you need a TURN/ICE server and a signaling server, in addition to AppRTC itself. The signaling server (Collider) is part of this repository and can be found [here](https://github.com/webrtc/apprtc/tree/master/src/collider)) while the TURN server used is [rfc5766-turn-server](https://github.com/coturn/rfc5766-turn-server). Credentials and TURN server instances are provided by a [CEOD](https://github.com/juberti/computeengineondemand) service that generates TURN servers on demand in form of a JSON response.
This means you need to either set-up a web server that returns TURN credentials and IP addresses (basically mimic the [CEOD](https://github.com/juberti/computeengineondemand) server) in a JSON response, or replace the [CEOD](https://github.com/webrtc/apprtc/blob/master/src/app_engine/constants.py#L15) details with your own TURN server provider details, and then change https://github.com/webrtc/apprtc/blob/master/src/app_engine/apprtc.py#L256 to turn_url = constants.TURN_URL_TEMPLATE.
You can test using your own TURN server by appending the ?ts=serverUrl parameter, details on AppRTC URL parameters can be found at https://appr.tc/params.html.