Make Spreed WebRTC work on the Nextcloud box

This commit is contained in:
oparoz 2016-09-25 00:11:54 +02:00
Родитель d7aa1923a2
Коммит 4c38f8656d
9 изменённых файлов: 71 добавлений и 46 удалений

Просмотреть файл

Просмотреть файл

@ -1,17 +1,44 @@
# Spreed WebRTC snap
This repository can be used to build a Spreed WebRTC snap for Ubuntu Snappy 16.04 by using
[Snapcraft](https://github.com/ubuntu-core/snapcraft).
## Description
## Build requirements
Chat and make audio/video calls using [Spreed WebRTC](https://github.com/strukturag/spreed-webrtc/) on Ubuntu Snappy.
- Snapcraft 2.2
- Ubuntu 16.04
A good hardware companion for this Snap is the [Nextcloud Box](https://nextcloud.com/box) which comes with a 1TB hard drive and Nextcloud, a next-generation Files, Sync and Share solution.
## Building
If you are a user, just wanting a secure and private alternative for online communication make sure to check out the [Spreedbox](http://spreedbox.com/), providing a ready to use hardware with Spreed WebRTC included.
## Authors
* [Simon Eisenmann](https://github.com/longsleep)
* [Olivier Paroz](https://github.com/oparoz)
## Compilation
*Prerequisite: You need to have both snapcraft and snapd installed. See https://snapcraft.io*
Download the source
`$ git clone https://github.com/oparoz/spreed-webrtc-snap`
Compile the snap
```bash
$ snapcraft snap
$ cd spreed-webrtc-snap
$ sudo snapcraft
```
-- (c)2016 struktur AG
Install it locally
`$ sudo snap install spreed-webrtc_0.28.1-1_amd64.snap --force-dangerous`
*Note: Replace the filename with the one which has been generated*
## Installation
This downloads the app from the Ubuntu app store
`$ sudo snap install spreed-webrtc`
----
Spreed-WebRTC (c)2016 struktur AG

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.4 KiB

После

Ширина:  |  Высота:  |  Размер: 4.4 KiB

Просмотреть файл

@ -1,37 +1,31 @@
name: spreed-webrtc
version: 0.24.11-1
version: 0.28.1oparoz1
summary: WebRTC audio/video calls and conferences
description: Spreed WebRTC implements a WebRTC audio/video call and conferencing server and web client
icon: spreedWaves.svg
grade: stable
confinement: strict
apps:
spreed-webrtc:
command: bin/start
daemon: simple
uses: [listener-service]
uses:
listener-service:
type: migration-skill
caps: [network-listener, network-service]
config: bin/config
plugs: [network, network-bind]
parts:
spreed:
plugin: autotools
source: https://github.com/strukturag/spreed-webrtc
source-type: git
source-branch: develop
source-branch: release-0.28
build-packages: [golang-go, nodejs]
glue:
plugin: copy
files:
plugin: dump
source: src
organize:
start: bin/start
ssleay.cnf: ssleay.cnf
redirector: bin/redirector
config:
plugin: copy
files:
config.py: bin/config
server.conf.in: server.conf.in
plugin: dump
source: src
organize:
config.py: bin/config

6
config.py → src/config.py Executable file → Normal file
Просмотреть файл

@ -8,12 +8,12 @@ import subprocess
import sys
import yaml
SPREED_WEBRTC_DATA_PATH = os.environ['SNAP_APP_DATA_PATH']
SPREED_WEBRTC_DATA_PATH = os.environ['SNAP_DATA']
SPREED_WEBRTC_VERSION = os.environ['SNAP_VERSION']
SPREED_WEBRTC_CONFIG_FILE = os.path.join(SPREED_WEBRTC_DATA_PATH,
'server.conf')
START_CONFIG_FILE = os.path.join(SPREED_WEBRTC_DATA_PATH, 'start.conf')
SPREED_WEBRTC_CONFIG_FILE_IN = os.path.join(os.environ['SNAP_APP_PATH'],
SPREED_WEBRTC_CONFIG_FILE_IN = os.path.join(os.environ['SNAP'],
'server.conf.in')
DEFAULT_REDIRECTOR_PORT = 8000
@ -22,7 +22,7 @@ DEFAULT_HTTPS_PORT = 8443
OPENSSL = "/usr/bin/openssl"
if not os.path.exists(OPENSSL):
OPENSSL = os.path.join(os.path.join(os.environ['SNAP_APP_PATH'],
OPENSSL = os.path.join(os.path.join(os.environ['SNAP'],
'usr', 'bin', 'openssl'))

0
redirector → src/redirector Executable file → Normal file
Просмотреть файл

Просмотреть файл

@ -27,7 +27,7 @@ listen = 127.0.0.1:8080
; Full path to PEM encoded private key.
;key = server.key
; Mimimal supported encryption standard (SSLv3, TLSv1, TLSv1.1 or TLSv1.2).
;minVersion = SSLv3
minVersion = TLSv1.2
; HTTPS socket read timeout in seconds.
;readtimeout = 10
; HTTPS socket write timeout in seconds.
@ -133,7 +133,7 @@ serverRealm = local
;contacts = true
[log]
;logfile = /var/log/spreed-webrtc-server.log
logfile = spreed-webrtc-server.log
[users]
; Set to true to enable user functionality.

Просмотреть файл

34
start → src/start Executable file → Normal file
Просмотреть файл

@ -3,21 +3,25 @@
set -e
umask 027
SERVER_CONF="$SNAP_APP_DATA_PATH/server.conf"
START_CONF="$SNAP_APP_DATA_PATH/start.conf"
CONFIG_MARK="$SNAP_APP_DATA_PATH/version.2"
# Create a tmp folder
TMPDIR="$SNAP_COMMON/tmp"
mkdir -p -m 750 $TMPDIR
SPREED_WEBRTC_PID=
REDIRECTOR_PID=
SERVER_CONF="$SNAP_DATA/server.conf"
START_CONF="$SNAP_DATA/start.conf"
CONFIG_MARK="$SNAP_DATA/version.2"
TLS_KEY="$SNAP_APP_DATA_PATH/tls.key"
TLS_CERT="$SNAP_APP_DATA_PATH/tls.crt"
SPREED_WEBRTC_PID="$SNAP_DATA/spreed.pid"
REDIRECTOR_PID="$SNAP_DATA/redirector.pid"
TLS_KEY="$SNAP_DATA/tls.key"
TLS_CERT="$SNAP_DATA/tls.crt"
TLS_DAYS=3650
TLS_BITS=2048
OPENSSL="/usr/bin/openssl"
RANDFILE="$SNAP_APP_DATA_PATH/.rnd"
RANDFILE="$SNAP_DATA/.rnd"
export RANDFILE
cleanup () {
@ -29,7 +33,7 @@ cleanup () {
if [ -n "$SPREED_WEBRTC_PID" ]; then
kill -TERM $SPREED_WEBRTC_PID 2>/dev/null
fi
rm -f "$SNAP_APP_TMPDIR/spreed-webrtc.conf"
rm -f "$TMPDIR/spreed-webrtc.conf"
echo "Done."
}
trap "cleanup" INT QUIT TERM EXIT
@ -37,7 +41,7 @@ trap "cleanup" INT QUIT TERM EXIT
config () {
if [ ! -e "$START_CONF" -o ! -e "$SERVER_CONF" -o ! -e "$CONFIG_MARK" ]; then
echo "Updating configuraion ..."
"$SNAP_APP_PATH/bin/config" update >/dev/null
"$SNAP/bin/config" update >/dev/null
touch "$CONFIG_MARK"
fi
if [ -e "$START_CONF" ]; then
@ -55,7 +59,7 @@ make_tls_key_and_cert () {
$OPENSSL req -new -x509 -nodes -newkey rsa:$TLS_BITS \
-keyout "$TLS_KEY" \
-out "$TLS_CERT" -days $TLS_DAYS \
-config "$SNAP_APP_PATH/ssleay.cnf" -sha256 -extensions req_v3
-config "$SNAP/ssleay.cnf" -sha256 -extensions req_v3
fi
}
@ -67,12 +71,12 @@ make_tls_key_and_cert () {
spreed_webrtc () {
# Create runtime configuration.
sed "\
s|root = .*|root = $SNAP_APP_PATH/share/spreed-webrtc-server/www|; \
s|root = .*|root = $SNAP/share/spreed-webrtc-server/www|; \
s|key = .*|key = $TLS_KEY|; \
s|certificate = .*|certificate = $TLS_CERT|; \
" $SERVER_CONF > "$SNAP_APP_TMPDIR/spreed-webrtc.conf"
" $SERVER_CONF > "$TMPDIR/spreed-webrtc.conf"
"$SNAP_APP_PATH/sbin/spreed-webrtc-server" -c "$SNAP_APP_TMPDIR/spreed-webrtc.conf" &
"$SNAP/sbin/spreed-webrtc-server" -c "$TMPDIR/spreed-webrtc.conf" &
SPREED_WEBRTC_PID=$!
}
@ -80,7 +84,7 @@ redirector () {
if [ -z "$REDIRECTOR_PORT" -o -z "$WEBAPP_PORT" ]; then
return
fi
"$SNAP_APP_PATH/bin/redirector" --port $REDIRECTOR_PORT $WEBAPP_PORT &
"$SNAP/bin/redirector" --port $REDIRECTOR_PORT $WEBAPP_PORT &
REDIRECTOR_PID=$!
}