Skip to content

Instantly share code, notes, and snippets.

@hiroeorz
Last active August 29, 2015 14:12
Show Gist options
  • Save hiroeorz/5eaae05564535decc279 to your computer and use it in GitHub Desktop.
Save hiroeorz/5eaae05564535decc279 to your computer and use it in GitHub Desktop.
WebRTCでビデオ通話するためにpeerjs-serverをインストールした時のメモ ref: http://qiita.com/hiroeorz@github/items/941d8f18cf8ac61fba52
$ sudo apt-get install libevent-core-2.0-5 libevent-extra-2.0-5 libevent-openssl-2.0-5 libevent-pthreads-2.0-5 libhiredis0.10 libmysqlclient18 libpq5 mysql-common
$ wget http://coturn.net/turnserver/v4.3.3.1/turnserver-4.3.3.1-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
$ sudo npm -g install peer
$ /usr/local/bin/peer --port 9000 --key mykey --path /webrtc
$ sudo start peer
$ sudo stop peer
$ sudo apt-get install nginx
$ cd ~/src
$ git clone https://github.com/peers/peerjs.git
$ cd /usr/share/nginx/html
$ sudo cp ~/src/peerjs/examples/videochat ./peerjs
$ sudo cp ~/src/peerjs/dist ./
$ tar xvzf turnserver-4.3.3.1-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
$ dpkg -i coturn_4.3.3.1-1_amd64.deb
#
# Uncomment it if you want to have the turnserver running as
# an automatic system service daemon
#
TURNSERVER_ENABLED=1
$ sudo turnadmin -a -u <ユーザ名> -r <realm> -p <パスワード>
$ sudo turnadmin -a -u myname -r hogehoge.co.jp -p mypass
$ sudo /etc/init.d/coturn start
$ sudo /etc/init.d/coturn stop
$ sudo apt-get install nodejs npm
$ sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
// PeerJS object
var peer = new Peer({ host: '1.2.3.4', port: 9000,
key: 'mykey', path: '/webrtc', debug: 3,
config: {'iceServers': [
{ url: 'stun:1.2.3.4:3478' },
{ url: 'turn:[email protected]:3478', credential: 'mypass' }]}
});
description "PeerJS Server"
author "co-meeting Inc."
# Saves log to /var/log/upstart/peerjs.log
console log
# Starts only after drives are mounted.
start on started mountall
stop on shutdown
# Automatically Respawn. But fail permanently if it respawns 10 times in 5 seconds:
respawn
respawn limit 10 5
script
exec node /usr/local/bin/peerjs -p 9000 -k mykey --path /webrtc
end script
listening-ip=1.2.3.4
relay-ip=1.2.3.4
fingerprint
lt-cred-mech
realm=hogehoge.co.jp
syslog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment