-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallation.txt
83 lines (66 loc) · 3 KB
/
installation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
= Installation on Ubuntu 16.04
Ľubomír Mlích
17.9.2016
$ sudo apt install turnserver apache2 php libapache2-mod-php
$ sudo a2enmod proxy_wstunnel ssl
$ sudo service apache2 restart
$ cat /etc/opt/websocketd_with_webrtc_chat.ini
# enter hostname and base_dir
[global]
# install dir
BASE_DIR=/opt/chat/
# bash locale, user can become anonymous, when incorrect unicodedecode error
LANG=cs_CZ.UTF-8
# ICE server is needed to make communication possible behind NAT
ICE_SERVER_DNS=ec2-54-174-64-242.compute-1.amazonaws.com
# URL for javascript, where to connect to websocket
WEBSOCKETD_SERVER_URL=wss://ec2-54-174-64-242.compute-1.amazonaws.com/rooms/
[room descriptions]
Železná-hospoda=Znějí tu tóny tvrdší než ocel, ve jménu Edwina
$ mkdir -p /opt/chat/sessions /opt/chat/users /opt/chat/rooms /opt/chat/log /opt/chat/bin
$ cp -r /source/py /opt/chat
$ cp -r /source/sh /opt/chat
# change dir of config file to CONFIG_FILE=/etc/opt/websocketd_with_webrtc_chat.ini in chat_server.sh
$ mkdir /opt/chat/bin
$ cd /opt/chat/bin
$ wget https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip
$ unzip websocketd-0.3.0-linux_amd64.zip
$ rm websocketd-0.3.0-linux_amd64.zip CHANGES LICENSE README.md
$ cd -
$ cp -r /source/htdocs/* /var/www/html
$ rm /var/www/html/index.html
$ openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/chat-key.pem -out /etc/ssl/certs/chat-cert.pem -days 365 -nodes
$ openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/web-key.pem -out /etc/ssl/certs/web-cert.pem -days 365 -nodes
$ chmod 600 /etc/ssl/private/chat-key.pem /etc/ssl/private/web-key.pem
$ chown www-data:www-data /etc/ssl/private/chat-key.pem /etc/ssl/private/web-key.pem
$ vi /etc/apache2/sites-available/default-ssl.conf
SSLCertificateFile /etc/ssl/certs/web-cert.pem
SSLCertificateKeyFile /etc/ssl/private/web-key.pem
SSLProxyEngine On
ProxyPass "/rooms/" "wss://localhost:8089/"
$ a2ensite default-ssl.conf
$ vi /etc/apache2/sites-available/000-default.conf
Redirect permanent / https://ec2-52-59-228-145.eu-central-1.compute.amazonaws.com/
$ vi /opt/chat/sh/start.sh
/opt/chat/bin/websocketd --address=127.0.0.1 --port=8089 bash /opt/chat/sh/chat_server.sh 1>/opt/chat/log/websocketd.log 2>&1
$ vi /opt/chat/sh/start-ssl.sh
/opt/chat/bin/websocketd --address=127.0.0.1 --port=8089 --ssl --sslkey=/etc/ssl/private/chat-key.pem --sslcert=/etc/ssl/certs/chat-cert.pem bash /opt/chat/sh/chat_server.sh 1>/opt/chat/log/websocketd.log 2>&1
$ vi /opt/chat/sh/stop.sh
PID=`ps -ef |grep websocketd |grep www-data |cut -f2 -d" "|head -1`
kill -9 ${PID}
find /opt/chat/users/ -type f -exec rm {} \;
$ chmod u+x /opt/chat/sh/*
$ chmod u+x /opt/chat/bin/*
$ service apache2 restart
$ chown -R www-data:www-data /opt/chat
$ useradd -g ssl-cert www-data
$ sudo -u www-data /opt/chat/sh/start-ssl.sh &
$ vi /etc/logrotate.d/websocketd_chat
/opt/chat/rooms/*.log {
daily
missingok
nocompress
notifempty
copytruncate
maxage 7
}