浏览代码

jitsi config

Bob Mottram 8 年前
父节点
当前提交
b39c34fbb6
共有 1 个文件被更改,包括 44 次插入130 次删除
  1. 44
    130
      src/freedombone-app-jitsi

+ 44
- 130
src/freedombone-app-jitsi 查看文件

46
 JITSI_DOMAIN_NAME=
46
 JITSI_DOMAIN_NAME=
47
 JITSI_CODE=
47
 JITSI_CODE=
48
 JITSI_ONION_HOSTNAME=
48
 JITSI_ONION_HOSTNAME=
49
-JITSI_VIDEOBRIDGE_ONION_HOSTNAME=
50
 JITSI_AUTH_ONION_HOSTNAME=
49
 JITSI_AUTH_ONION_HOSTNAME=
51
 
50
 
52
-# repos
53
-JITSI_MEET_REPO="https://github.com/jitsi/jitsi-meet"
54
-JITSI_MEET_COMMIT='4d335e086be74fd9074ff302ff56401beb62bf80'
55
-
56
-# secrets
57
-JITSI_VIDEOBRIDGE_SECRET=
58
-JITSI_FOCUS_SECRET=
59
-JITSI_CONFERENCE_SECRET=
60
-
61
 jitsi_variables=(ONION_ONLY
51
 jitsi_variables=(ONION_ONLY
62
                  JITSI_DOMAIN_NAME
52
                  JITSI_DOMAIN_NAME
63
                  JITSI_CODE
53
                  JITSI_CODE
64
                  JITSI_MEET_REPO
54
                  JITSI_MEET_REPO
65
                  JITSI_MEET_COMMIT
55
                  JITSI_MEET_COMMIT
66
                  DEFAULT_DOMAIN_NAME
56
                  DEFAULT_DOMAIN_NAME
67
-                 JITSI_VIDEOBRIDGE_SECRET
68
-                 JITSI_FOCUS_SECRET
69
-                 JITSI_CONFERENCE_SECRET
70
                  JITSI_ONION_HOSTNAME
57
                  JITSI_ONION_HOSTNAME
71
-                 JITSI_VIDEOBRIDGE_ONION_HOSTNAME
72
                  MY_USERNAME)
58
                  MY_USERNAME)
73
 
59
 
74
 function change_password_jitsi {
60
 function change_password_jitsi {
118
         fi
104
         fi
119
     fi
105
     fi
120
 
106
 
121
-    JITSI_VIDEOBRIDGE_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-videobridge ${VIDEOBRIDGE_PORT} ${JITSI_VIDEOBRIDGE_ONION_PORT})
122
-    JITSI_AUTH_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-auth 5222 ${JITSI_AUTH_ONION_PORT})
123
-    JITSI_FOCUS_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-focus 5222 ${JITSI_FOCUS_ONION_PORT})
107
+    #JITSI_VIDEOBRIDGE_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-videobridge ${VIDEOBRIDGE_PORT} ${JITSI_VIDEOBRIDGE_ONION_PORT})
108
+    #JITSI_AUTH_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-auth 5222 ${JITSI_AUTH_ONION_PORT})
109
+    #JITSI_FOCUS_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-focus 5222 ${JITSI_FOCUS_ONION_PORT})
124
 }
110
 }
125
 
111
 
126
 function remove_jitsi_subdomains {
112
 function remove_jitsi_subdomains {
127
     function_check remove_onion_service
113
     function_check remove_onion_service
128
     remove_onion_service jitsi ${JITSI_ONION_PORT}
114
     remove_onion_service jitsi ${JITSI_ONION_PORT}
129
-    remove_onion_service jitsi-videobridge ${JITSI_VIDEOBRIDGE_ONION_PORT}
130
-    remove_onion_service jitsi-auth ${JITSI_AUTH_ONION_PORT}
131
-    remove_onion_service jitsi-focus ${JITSI_FOCUS_ONION_PORT}
115
+    #remove_onion_service jitsi-videobridge ${JITSI_VIDEOBRIDGE_ONION_PORT}
116
+    #remove_onion_service jitsi-auth ${JITSI_AUTH_ONION_PORT}
117
+    #remove_onion_service jitsi-focus ${JITSI_FOCUS_ONION_PORT}
132
 }
118
 }
133
 
119
 
134
 function remove_user_jitsi {
120
 function remove_user_jitsi {
223
 
209
 
224
     # remove videobridge
210
     # remove videobridge
225
     #firewall_remove ${VIDEOBRIDGE_PORT}
211
     #firewall_remove ${VIDEOBRIDGE_PORT}
226
-    apt-get -yq remove --purge jitsi-videobridge jicofo
212
+    apt-get -yq remove --purge jitsi-videobridge jicofo jitsi-meet
227
     if [ -d /etc/jitsi ]; then
213
     if [ -d /etc/jitsi ]; then
228
         rm -rf /etc/jitsi
214
         rm -rf /etc/jitsi
229
     fi
215
     fi
243
     remove_ddns_domain $JITSI_DOMAIN_NAME
229
     remove_ddns_domain $JITSI_DOMAIN_NAME
244
 }
230
 }
245
 
231
 
246
-function install_jitsi_videobridge {
247
-    apt-get -yq install wget debconf-utils
248
-    echo 'deb http://download.jitsi.org/nightly/deb unstable/' >> /etc/apt/sources.list
249
-    wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add -
250
-    apt-get update
251
-
252
-    debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string jitsi-videobridge.${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}"
253
-    apt-get -yq install jitsi-videobridge
254
-    if [ ! -d /etc/jitsi ]; then
255
-        echo $'Videobridge package failed to install'
256
-        exit 63983
257
-    fi
258
-    #firewall_add videobridge ${VIDEOBRIDGE_PORT}
259
-}
260
-
261
-function install_jitsi_jicofo {
262
-    apt-get -yq install jicofo
263
-    if [ ! -f /usr/share/jicofo/jicofo.sh ]; then
264
-        echo $'jicofo package install failed'
265
-        exit 6238345
266
-    fi
267
-
268
-    systemctl stop jicofo
269
-
270
-    jicofo_config=/etc/jitsi/jicofo/config
271
-    sed -i "s|JICOFO_HOST=.*|JICOFO_HOST=localhost|g" $jicofo_config
272
-    sed -i "s|JICOFO_HOSTNAME=.*|JICOFO_HOSTNAME=${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}|g" $jicofo_config
273
-    sed -i "s|JICOFO_SECRET=.*|JICOFO_SECRET=${JITSI_VIDEOBRIDGE_SECRET}|g" $jicofo_config
274
-    sed -i "s|JICOFO_PORT=.*|JICOFO_PORT=${VIDEOBRIDGE_PORT}|g" $jicofo_config
275
-    sed -i "s|JICOFO_AUTH_DOMAIN=.*|JICOFO_AUTH_DOMAIN=${JITSI_AUTH_ONION_HOSTNAME}|g" $jicofo_config
276
-    sed -i "s|JICOFO_AUTH_USER=.*|JICOFO_AUTH_USER=focus|g" $jicofo_config
277
-    sed -i "s|JICOFO_AUTH_PASSWORD=.*|JICOFO_AUTH_PASSWORD=${JITSI_FOCUS_SECRET}|g" $jicofo_config
278
-
279
-    if [ ! -f /etc/init.d/jicofo ]; then
280
-        echo $'jicofo daemon not found'
281
-        exit 737279
282
-    fi
283
-    sed -i 's|exec $DAEMON|exec /usr/bin/torify $DAEMON|g' /etc/init.d/jicofo
284
-    systemctl daemon-reload
285
-    systemctl start jicofo
286
-}
287
-
288
 function install_jitsi_xmpp {
232
 function install_jitsi_xmpp {
289
     if [ ! -d /etc/prosody/conf.avail ]; then
233
     if [ ! -d /etc/prosody/conf.avail ]; then
290
         echo $'Missing directory /etc/prosody/conf.avail'
234
         echo $'Missing directory /etc/prosody/conf.avail'
340
     prosodyctl register focus ${JITSI_AUTH_ONION_HOSTNAME} "${JITSI_CONFERENCE_SECRET}"
284
     prosodyctl register focus ${JITSI_AUTH_ONION_HOSTNAME} "${JITSI_CONFERENCE_SECRET}"
341
 }
285
 }
342
 
286
 
343
-function install_jitsi_meet {
344
-    if [ ${#JITSI_DOMAIN_NAME} -eq 0 ]; then
345
-        exit 367839
287
+function install_jitsi {
288
+    if [[ "$(can_install_videobridge)" == "0" ]]; then
289
+        echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
290
+        exit 83562
346
     fi
291
     fi
347
 
292
 
348
-    function_check install_nodejs
349
-    install_nodejs jitsi
293
+    if [ ! ${JITSI_DOMAIN_NAME} ]; then
294
+        echo $'No domain name was given for jitsi'
295
+        exit 47682
296
+    fi
350
 
297
 
351
-    if [ ! -d /var/www/${JITSI_DOMAIN_NAME} ]; then
352
-        mkdir -p /var/www/${JITSI_DOMAIN_NAME}
298
+    if [ ! -d /etc/prosody ]; then
299
+        echo $'xmpp must be installed before installing jitsi'
300
+        exit 62394
353
     fi
301
     fi
354
-    if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
355
-        function_check git_clone
356
-        git_clone ${JITSI_MEET_REPO} /var/www/${JITSI_DOMAIN_NAME}/htdocs
357
-        if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
358
-            echo $'Unable to clone jitsi meet repo'
359
-            exit 345673
360
-        fi
302
+
303
+    if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
304
+        echo $'The jitsi domain name should not be the same as the main domain name'
305
+        exit 78372
361
     fi
306
     fi
362
 
307
 
363
-    cd /var/www/${JITSI_DOMAIN_NAME}/htdocs
364
-    git checkout ${JITSI_MEET_COMMIT} -b ${JITSI_MEET_COMMIT}
365
-    set_completion_param "jitsi commit" "${JITSI_MEET_COMMIT}"
308
+    # add jitsi repo
309
+    apt-get -yq install wget debconf-utils
310
+    echo 'deb http://download.jitsi.org/nightly/deb unstable/' >> /etc/apt/sources.list
311
+    wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add -
312
+    apt-get update
366
 
313
 
367
-    install_jitsi_xmpp
314
+    # create onion domains
315
+    create_jitsi_subdomains
368
 
316
 
369
-    chmod a+w /var/www/${JITSI_DOMAIN_NAME}/htdocs
317
+    # videobridge
318
+    debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string localhost"
319
+    apt-get -yq install jitsi-videobridge
320
+    if [ ! -d /etc/jitsi ]; then
321
+        echo $'Videobridge package failed to install'
322
+        exit 63983
323
+    fi
324
+    firewall_add videobridge ${VIDEOBRIDGE_PORT}
370
 
325
 
371
-    npm install -g browserify@13.1.1
372
-    npm install
373
-    make
326
+    # meet
327
+    debconf-set-selections <<< "jitsi-meet jitsi-meet/cert-choice multiselect 2"
328
+    apt-get -yq install jitsi-meet
374
 
329
 
375
     jitsi_nginx_site=/etc/nginx/sites-available/$JITSI_DOMAIN_NAME
330
     jitsi_nginx_site=/etc/nginx/sites-available/$JITSI_DOMAIN_NAME
376
     if [[ $ONION_ONLY == "no" ]]; then
331
     if [[ $ONION_ONLY == "no" ]]; then
394
         echo '  error_log off;' >> $jitsi_nginx_site
349
         echo '  error_log off;' >> $jitsi_nginx_site
395
         echo '' >> $jitsi_nginx_site
350
         echo '' >> $jitsi_nginx_site
396
         echo '  # Root' >> $jitsi_nginx_site
351
         echo '  # Root' >> $jitsi_nginx_site
397
-        echo "  root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
352
+        echo "  root /usr/share/jitsi-meet;" >> $jitsi_nginx_site
398
         echo '' >> $jitsi_nginx_site
353
         echo '' >> $jitsi_nginx_site
399
         echo '  index index.html;' >> $jitsi_nginx_site
354
         echo '  index index.html;' >> $jitsi_nginx_site
400
         echo '' >> $jitsi_nginx_site
355
         echo '' >> $jitsi_nginx_site
432
     echo '  error_log off;' >> $jitsi_nginx_site
387
     echo '  error_log off;' >> $jitsi_nginx_site
433
     echo '' >> $jitsi_nginx_site
388
     echo '' >> $jitsi_nginx_site
434
     echo '  # Root' >> $jitsi_nginx_site
389
     echo '  # Root' >> $jitsi_nginx_site
435
-    echo "  root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
390
+    echo "  root /usr/share/jitsi-meet;" >> $jitsi_nginx_site
436
     echo '' >> $jitsi_nginx_site
391
     echo '' >> $jitsi_nginx_site
437
     echo '  index index.html;' >> $jitsi_nginx_site
392
     echo '  index index.html;' >> $jitsi_nginx_site
438
     echo '' >> $jitsi_nginx_site
393
     echo '' >> $jitsi_nginx_site
458
     if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
413
     if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
459
         mv /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
414
         mv /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
460
     fi
415
     fi
461
-    if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
462
-        chown jitsi: /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
463
-    fi
464
-    if [ -f /etc/ssl/private/${JITSI_DOMAIN_NAME}.key ]; then
465
-        chown jitsi: /etc/ssl/private/${JITSI_DOMAIN_NAME}.key
466
-    fi
416
+
417
+    # install_jitsi_xmpp
467
 
418
 
468
     function_check nginx_ensite
419
     function_check nginx_ensite
469
     nginx_ensite ${JITSI_DOMAIN_NAME}
420
     nginx_ensite ${JITSI_DOMAIN_NAME}
472
 
423
 
473
     chown -R www-data:www-data /var/www/${JITSI_DOMAIN_NAME}/htdocs
424
     chown -R www-data:www-data /var/www/${JITSI_DOMAIN_NAME}/htdocs
474
     systemctl restart nginx
425
     systemctl restart nginx
475
-}
476
-
477
-function install_jitsi {
478
-    if [[ "$(can_install_videobridge)" == "0" ]]; then
479
-        echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
480
-        exit 83562
481
-    fi
482
-
483
-    if [ ! ${JITSI_DOMAIN_NAME} ]; then
484
-        echo $'No domain name was given for jitsi'
485
-        exit 47682
486
-    fi
487
-
488
-    if [ ! -d /etc/prosody ]; then
489
-        echo $'xmpp must be installed before installing jitsi'
490
-        exit 62394
491
-    fi
492
-
493
-    if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
494
-        echo $'The jitsi domain name should not be the same as the main domain name'
495
-        exit 78372
496
-    fi
497
-
498
-    if [ ! ${JITSI_VIDEOBRIDGE_SECRET} ]; then
499
-        JITSI_VIDEOBRIDGE_SECRET="$(create_password 30)"
500
-    fi
501
-    if [ ! ${JITSI_FOCUS_SECRET} ]; then
502
-        JITSI_FOCUS_SECRET="$(create_password 30)"
503
-    fi
504
-    if [ ! ${JITSI_CONFERENCE_SECRET} ]; then
505
-        JITSI_CONFERENCE_SECRET="$(create_password 30)"
506
-    fi
507
-
508
-    create_jitsi_subdomains
509
-    install_jitsi_videobridge
510
-    install_jitsi_jicofo
511
-    install_jitsi_meet
512
 
426
 
513
     function_check add_ddns_domain
427
     function_check add_ddns_domain
514
     add_ddns_domain $JITSI_DOMAIN_NAME
428
     add_ddns_domain $JITSI_DOMAIN_NAME