@drumee/setup-infra 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/init-acme CHANGED
@@ -6,8 +6,10 @@ function make_certs(){
6
6
  sum=0
7
7
  dom=$1
8
8
  echo Generating "${dom}" cetificates...
9
+ OPTIONS="--issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $ACME_CERTS_DIR --dns dns_nsupdate"
10
+ ./acme.sh $OPTIONS
9
11
  while [ ! -f ${ACME_CERTS_DIR}/${dom}_ecc/fullchain.cer ]; do
10
- ./acme.sh --issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $ACME_CERTS_DIR --dns dns_nsupdate
12
+ ./acme.sh $OPTIONS
11
13
  if [ $? = "0" ]; then
12
14
  echo Certificate have been sucessfully created.
13
15
  else
@@ -16,7 +18,8 @@ function make_certs(){
16
18
  fi
17
19
  if [ "$sum" -gt "10" ]; then
18
20
  echo Failed to create certifiicates. Please run manually
19
- echo $ACME_DIR/acme.sh --issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $ACME_CERTS_DIR --dns dns_nsupdate
21
+ echo $ACME_DIR/acme.sh $OPTIONS
22
+ return
20
23
  fi
21
24
  sum=$(expr 1 + $sum)
22
25
  done
package/bin/install CHANGED
@@ -4,8 +4,9 @@ set -e
4
4
  echo "Configuring Drumee Infrastructure"
5
5
  script_dir=$(dirname $(readlink -f $0))
6
6
 
7
- export base=$(dirname $script_dir)
7
+ clean_vendor_files
8
8
 
9
+ export base=$(dirname $script_dir)
9
10
  $base/bin/init-mail $DRUMEE_DOMAIN_NAME
10
11
 
11
12
  # Write configs
@@ -16,12 +17,8 @@ if [ -d /etc/cron.d/drumee ]; then
16
17
  crontab /etc/cron.d/drumee
17
18
  fi
18
19
 
19
-
20
-
21
20
  source $base/bin/env
22
- source $base/bin/jitsi
23
-
24
- install_jitsi
21
+ source $base/bin/prosody
25
22
 
26
23
  protect_dir $DRUMEE_RUNTIME_DIR "no" "mkdir"
27
24
  protect_dir $DRUMEE_DATA_DIR "yes" "mkdir"
@@ -49,10 +46,8 @@ protect_dir $DRUMEE_IMPORT_DIR
49
46
  $base/bin/init-named
50
47
  $base/bin/init-acme
51
48
 
52
- clean_vendor_files
53
49
  setup_dirs
54
50
  setup_prosody
55
- write_version
56
51
 
57
52
  crontab < /etc/cron.d/drumee
58
53
  echo "Drumee infrastructure done !"
@@ -43,18 +43,34 @@ function addUser() {
43
43
  prosodyctl register ${user} ${host} $secret
44
44
  }
45
45
 
46
+ #-------------------
47
+ # Sometime service prosody restart is not working
48
+ function restart_prosody() {
49
+ if [ -f /var/run/prosody/prosody.pid ]; then
50
+ set +e
51
+ ppid=$(cat /var/run/prosody/prosody.pid)
52
+ echo "Prosody PID =$ppid"
53
+ if [ "$ppid" != "" ]; then
54
+ kill $ppid;
55
+ sleep 3
56
+ service prosody start
57
+ else
58
+ service prosody restart
59
+ fi
60
+ else
61
+ service prosody restart
62
+ fi
63
+ }
46
64
 
47
65
  #-------------------
48
66
  function setup_prosody() {
49
67
  echo Configuring prosody creadentials
50
68
 
51
69
  # Ensure prosody start before using prosodyctl
52
- service prosody restart
53
- host="auth.${JITSI_DOMAIN}"
54
- #jic_pw=$(grep password /etc/jitsi/jicofo/jicofo.conf | awk '{print $3}' | sed -e s/\"//g)
55
- #jvb_pw=$(grep PASSWORD /etc/jitsi/videobridge/jvb.conf | awk '{print $3}' | sed -e s/\"//g)
56
- addUser focus $JICOFO_PASSWORD $host
57
- addUser jvb $JVB_PASSWORD $host
70
+ restart_prosody
71
+ auth_host="auth.${JITSI_DOMAIN}"
72
+ addUser focus $JICOFO_PASSWORD $auth_host
73
+ addUser jvb $JVB_PASSWORD $auth_host
58
74
  addUser $APP_ID $APP_PASSWORD $JITSI_DOMAIN
59
75
 
60
76
  pub_ip=$(grep public-address /etc/jitsi/videobridge/jvb.conf | awk '{print $3}' | sed -e s/\"//g)
@@ -64,9 +80,8 @@ function setup_prosody() {
64
80
  echo "${pub_ip} ${JITSI_DOMAIN}" >>/etc/hosts
65
81
  fi
66
82
  fi
67
- echo Subscribing roster command for focus."${JITSI_DOMAIN}" focus@${host}
68
- prosodyctl mod_roster_command subscribe focus."${JITSI_DOMAIN}" focus@${host}
69
- #echo prosodyctl mod_roster_command subscribe focus."${JITSI_DOMAIN}" focus@${host}
83
+ echo prosodyctl mod_roster_command subscribe "focus.${JITSI_DOMAIN}" "focus@${auth_host}"
84
+ prosodyctl mod_roster_command subscribe "focus.${JITSI_DOMAIN}" "focus@${auth_host}"
70
85
  echo Prosody creadentials done
71
86
  }
72
87
 
@@ -80,46 +95,7 @@ function clean_vendor_files() {
80
95
  rm -f /etc/prosody/conf.avail/jaas.cfg.lua
81
96
  rm -f /etc/prosody/conf.avail/jitsi.meet.cfg.lua
82
97
  rm -rf /etc/prosody/certs/*
98
+ rm -rf /var/lib/prosody/*jitsi.meet.*
83
99
  }
84
100
 
85
- #-------------------
86
- function restart_prosody() {
87
- if [ -f /var/run/prosody/prosody.pid ]; then
88
- set +e
89
- ppid=$(cat /var/run/prosody/prosody.pid)
90
- echo "Prosody PID =$ppid"
91
- fi
92
- }
93
-
94
- #-------------------
95
- function write_version() {
96
- echo Creating versions file
97
- mkdir -p /etc/jitsi
98
- dest=/etc/jitsi/versions.js
99
- echo "module.exports={" >$dest
100
- dpkg -l | egrep "ii +jitsi" | awk '{print "\"", $2, "\"", ":", "\"", $3, "\"", ","}' | sed -E "s/ +//g" >>$dest
101
- echo "}" >>$dest
102
- echo Versions file created
103
- }
104
-
105
- #-------------------
106
- function install_jitsi() {
107
- # Jitsi package
108
- echo Checking jitsi-meet packages
109
- installed=$(dpkg -l | egrep "^ii +jitsi-meet ")
110
- if [ "$installed" = "" ]; then
111
- key=/etc/apt/trusted.gpg.d/jitsi-key.gpg
112
- if [ ! -f $key ]; then
113
- curl -sS https://download.jitsi.org/jitsi-key.gpg.key | gpg --dearmor | tee j$key >/dev/null 2>&1
114
- fi
115
101
 
116
- source=/etc/apt/sources.list.d/jitsi-stable.list
117
- if [ ! -f $jitsi_source ]; then
118
- echo "deb https://download.jitsi.org stable/" | tee $source
119
- apt update
120
- fi
121
- DEBIAN_FRONTEND="noninteractive" apt install -y jitsi-meet
122
- else
123
- echo "Jitsi package alreay installed. Skipped."
124
- fi
125
- }
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ if [ -e /etc/drumee/drumee.sh ]; then
3
+ if [ -e /etc/prosody/defaults/credentials.sh ]; then
4
+ source /etc/drumee/drumee.sh
5
+ source /etc/prosody/defaults/credentials.sh
6
+ turn_secret=$(grep static-auth-secret /etc/turnserver.conf | sed -E "s/^.+=//")
7
+ db_set jitsi-videobridge/jvb-hostname $JITSI_DOMAIN
8
+ db_set jitsi-videobridge/jvbsecret $JVB_PASSWORD
9
+ db_set jicofo/jicofo-authpassword $JICOFO_PASSWORD
10
+ db_set jitsi-meet-prosody/jvb-hostname $JITSI_DOMAIN
11
+ db_set jitsi-meet-prosody/turn-secret $turn_secret
12
+ fi
13
+ fi
package/custom.sh ADDED
@@ -0,0 +1,21 @@
1
+ apt install -y git
2
+ mkdir /root/reinstall
3
+ cd /root/reinstall
4
+ curl -O https://download.jitsi.org/stable/jitsi-videobridge2_2.3-92-g64f9f34f-1_all.deb
5
+ curl -O https://download.jitsi.org/stable/jicofo_1.0-1075-1_all.deb
6
+ curl -O https://download.jitsi.org/stable/jitsi-meet-prosody_1.0.7874-1_all.deb
7
+ curl -O https://download.jitsi.org/stable/jitsi-meet-turnserver_1.0.7874-1_all.deb
8
+ curl -O https://download.jitsi.org/stable/jitsi-meet-web-config_1.0.7874-1_all.deb
9
+ curl -O https://download.jitsi.org/stable/jitsi-meet-web_1.0.7874-1_all.deb
10
+ curl -O https://download.jitsi.org/stable/jitsi-meet_2.0.9364-1_all.deb
11
+
12
+
13
+ apt install /root/reinstall/jicofo_1.0-1075-1_all.deb -y
14
+ apt install /root/reinstall/jitsi-videobridge2_2.3-92-g64f9f34f-1_all.deb -y
15
+ apt install /root/reinstall/jitsi-meet-web-config_1.0.7874-1_all.deb -y
16
+ apt install /root/reinstall/jitsi-meet-web_1.0.7874-1_all.deb -y
17
+ apt install /root/reinstall/jitsi-meet-prosody_1.0.7874-1_all.deb -y
18
+ apt install /root/reinstall/jitsi-meet-turnserver_1.0.7874-1_all.deb -y
19
+ apt install /root/reinstall/jitsi-meet_2.0.9364-1_all.deb -y
20
+
21
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjPCTSuU0ThzsJ3Tp6qP2jQQz2QtV5j4+U3tPgSleqgy3Dkb99jeWcZfknmcNibpxjynw8QrT/tQ+WxUOB0xh/nC0YvWQnPE7rguBQ9gjvOVaTYaVcMSzv+fSckGPDI5KuPpmodmtuvNKw5R8lFlK+2TkOHzZ4WU9xFwZwvgVCuZJbhBOPJWOCW3abqhAZXRYwAvC07wEtivKJ5zeFEPFhDea/wjHxWX0iXTc6utpCxwoydbfDc19cCIqOUHcimbAuoa8aDtc2qt0N2zB/Q2yko3p8+00RouZ41xYXe++JGNbwsvTpogm46H5hj/TuunrLnLApHGWBkw59T6HMGPtp somanos@chrouk.local
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drumee/setup-infra",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Drumee Infrastructure Setup Utilities",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@ root /usr/share/jitsi-meet;
10
10
  ssi on;
11
11
  ssi_types application/x-javascript application/javascript;
12
12
 
13
- # index index.html index.htm;
13
+ index index.html index.htm;
14
14
  error_page 404 /static/404.html;
15
15
 
16
16
  # Security headers
@@ -37,7 +37,7 @@ location = /external_api.js {
37
37
 
38
38
 
39
39
 
40
- ensure all static content can always be found first
40
+ # ensure all static content can always be found first
41
41
  location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ {
42
42
  add_header 'Access-Control-Allow-Origin' '*';
43
43
  alias /usr/share/jitsi-meet/$1/$2;
@@ -22,7 +22,7 @@ server {
22
22
  listen [::]:443 ssl;
23
23
  #
24
24
  root <%= server_dir %>;
25
- server_name _;
25
+ server_name <%= domain %>;
26
26
  client_max_body_size <%= max_body_size %>;
27
27
  include /etc/drumee/ssl/main.conf;
28
28
  include /etc/drumee/infrastructure/routes/*.conf;
@@ -21,7 +21,7 @@ server {
21
21
  server {
22
22
  listen 443 ssl http2;
23
23
  listen [::]:443 ssl http2;
24
- server_name *.<%= jitsi_domain %>;
24
+ server_name <%= jitsi_domain %>;
25
25
  include /etc/jitsi/ssl.conf;
26
26
  include /etc/jitsi/meet.conf;
27
27
  }
package/thidima.sh ADDED
@@ -0,0 +1,44 @@
1
+ # Change below values accordingly to you setup
2
+
3
+ # This text will be shown on the login page
4
+ export DRUMEE_DESCRIPTION="My Drumee Box"
5
+
6
+ # This is the URL base to access your Drumee Instance
7
+ # It's recommanded not to share the domain name
8
+ # with any oher applications
9
+ export DRUMEE_DOMAIN_NAME="thidima.org"
10
+
11
+ # Fix IPV4 address bound to your doamain_name
12
+ export PUBLIC_IP4="51.195.89.55"
13
+
14
+ # IPV6 address bound to your doamain_name
15
+ export PUBLIC_IP6="2001:41d0:700:4837::"
16
+
17
+ # This email will be use as the admin account
18
+ export ADMIN_EMAIL="somanos@drumee.com"
19
+
20
+ # Dedicated to data base server. Do not share with any
21
+ # other application. Default value is /srv/db.
22
+ # At least 100GB should be allocated
23
+ export DRUMEE_DB_DIR="/db"
24
+
25
+ # Dedicated to Drumee Filesystem Management.
26
+ # Do not share with any # other application.
27
+ # Default value is /data
28
+ # At least 100GB should be allocated
29
+ export DRUMEE_DATA_DIR="/data" # defaulted to /data
30
+
31
+ # Optional setting
32
+ # Drumee use rsync to backup data (FMS, DB and configs)
33
+ # If you plan to make a backup on a remote host, ensure
34
+ # ssh keys are properly setup
35
+ export STORAGE_BACKUP="/backup" # [user@host-or-ip:]/path/
36
+
37
+ # If not set, will be defaulted to ADMIN_EMAIL.
38
+ # SSL certificates are generated using zerossl.com ACME server
39
+ # This requires an emal to be provided.
40
+ export ACME_EMAIL_ACCOUNT=""
41
+
42
+ mkdir -p $DRUMEE_DB_DIR
43
+ mkdir -p $DRUMEE_DATA_DIR
44
+ mkdir -p $STORAGE_BACKUP