ILIAS-7-Install-Tutorial for Ubuntu 20.04

Way II: No portforwarding to 443

Creating server.cfg

  • cd /opt/iliasdata/clientname/chatroom
  • nano server.cfg
  • Delete the old code (STRG+K)
  • Paste this code in:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"protocol": "https",
"port": "8080",
"address": "bbs-ilias.de",
"cert": "\/etc\/letsencrypt\/live\/bbs-ilias.de\/fullchain.pem",
"key": "\/etc\/letsencrypt\/live\/bbs-ilias.de\/privkey.pem",
"dhparam": "\/etc\/letsencrypt\/live\/bbs-ilias.de\/dhparam.pem",
"log": "\/opt\/iliasdata\/log\/chat.log",
"error_log": "\/opt\/iliasdata\/log\/chaterror.log",
"sub_directory": "",
"deletion_mode": "1",
"deletion_unit": "days",
"deletion_value": "10",
"deletion_time": "22:30"
}
  • Change the following lines so that they fit to your installation:
    • 4: Your FQDN
    • 5-6: You can find the paths in the config files in /etc/apache2/site-available
    • 7: Use the path from line 6. The file does not exist at the moment
    • 8-9: Check if this path realy exists!
      • touch /opt/iliasdata/log/chat.log
      • touch /opt/iliasdata/log/chaterror.log
    • 10: Leave empty

Creation of dhparam.pem

  • cd /etc/letsencrypt/live/bbs-ilias.de
  • openssl dhparam -out dhparam.pem 2048

Create the Startscripts

  • Btw: Every ILIAS-instance needs a seperate startscript that starts the chatserver with its own unique internal port (eg. 8080)
  • Remember: Info is the Clientname: nano /etc/init.d/ilchat
  • Its normally the same as stated in the client.cfg. However it must be the same like in client.cfg
  • Fill in the following code:
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
### BEGIN INIT INFO
# Provides: ilchat3
# Author: Wolfgang Hubesch wolfgang.huebsch@gmx.de
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ILIAS-Chatserver nodebased
### END INIT INFO
 
# Do NOT "set -e"
 
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="ilchat"
NAME=ilchat
#DAEMON=/usr/sbin/$NAME
#DAEMON_ARGS="--options args"
 
SCRIPTNAME=/etc/init.d/$NAME
ilroot=/var/www/html/ilias
ildata=/opt/iliasdata
client=info
url=https://bbs-ilias.de
chatport=8080
code="404"
USER=www-data
node_path=/usr/bin/node
 
#################################################
status=$(curl -s --head ${url}:${chatport} | head -n 1)
 
case "$1" in
start)
 
if [[ $status == *${code}* ]];
then
 
echo "Chat-Server for client ${client} on port ${chatport} seems to be running"
else
echo "Chat-Server for client ${client} on port ${chatport} seems to be DOWN. Try to start..."
sudo -H -u $USER bash -c "${node_path} ${ilroot}/Modules/Chatroom/chat/chat.js ${ildata}/${client}/chatroom/server.cfg ${ildata}/${client}/chatroom/client.cfg" &
 
sleep 5
status=$(curl -s --head ${url}:${chatport} | head -n 1)
if [[ $status == *${code}* ]];
then
echo "Chatserver for client ${client} on port ${chatport} is up!"
exit
 
else
echo "Sorry, I was not able to start the Chatserver for client ${client} on port ${chatport}. Try user root instead of ${USER} (edit line 28 of this script)"
exit
fi
 
 
 
 
fi
 
;;
 
stop)
 
if [[ $status == *${code}* ]];
then
echo "Chatserver for client ${client} on port ${chatport} is running...try to stop..."
kill $(ps aux | grep chat.js | awk '{print $2}') > /dev/null 2>&1
exit
 
else
echo "Chatserver for client ${client} on port ${chatport} is already down..."
exit
fi
 
;;
 
status)
 
if [[ $status == *${code}* ]];
then
echo "Chatserver is running...exit now..."
exit
 
else
echo "Chatserver is down...exit now..."
exit
 
fi
 
;;
 
*)
echo "Usage: $0 {start|stop|status}"
exit 1
esac
 
exit 0
  • Change lines 23-24 so that they fit to your installation and client
  • Exit nano
  • chmod +x /etc/init.d/ilchat
  • Check if Node is installed
  • Thats enough to start the chatserver. You can do this manually: /etc/init.d/ilchat start|stop|status
  • Check if there are any messages in the errorlog that would indicate a false configuration: nano /opt/iliasdata/log/chaterror.log 

Crontab settings

  • nano /etc/crontab
  • Add a line like this to check every 5 minutes, if the chatserver still runs
1
2
#Line for Chat-Server:  checks every 5 minutes if sevice is up
*/5 * * * * root /etc/init.d/ilchat start >/dev/null 2>&1

Connect the Server to the Database

  • As I said before, the chatserver may run but the chat will still not work. So please copy the the whole content of server.cfg to the right table of the database as described here  (JSON or PHPMyAdmin method)


No comment has been posted yet.