@drumee/setup-infra 1.0.6 → 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,8 @@ function make_certs(){
6
6
  sum=0
7
7
  dom=$1
8
8
  echo Generating "${dom}" cetificates...
9
- ./acme.sh
10
- OPTIONS=--issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $ACME_CERTS_DIR --dns dns_nsupdate
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
11
11
  while [ ! -f ${ACME_CERTS_DIR}/${dom}_ecc/fullchain.cer ]; do
12
12
  ./acme.sh $OPTIONS
13
13
  if [ $? = "0" ]; then
@@ -19,6 +19,7 @@ function make_certs(){
19
19
  if [ "$sum" -gt "10" ]; then
20
20
  echo Failed to create certifiicates. Please run manually
21
21
  echo $ACME_DIR/acme.sh $OPTIONS
22
+ return
22
23
  fi
23
24
  sum=$(expr 1 + $sum)
24
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,15 +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
- debconf-set-selections $base/bin/preset-jitsi
25
- if [ "$SKIP_JITSI" = "" ]; then
26
- install_jitsi
27
- fi
21
+ source $base/bin/prosody
28
22
 
29
23
  protect_dir $DRUMEE_RUNTIME_DIR "no" "mkdir"
30
24
  protect_dir $DRUMEE_DATA_DIR "yes" "mkdir"
@@ -52,10 +46,8 @@ protect_dir $DRUMEE_IMPORT_DIR
52
46
  $base/bin/init-named
53
47
  $base/bin/init-acme
54
48
 
55
- clean_vendor_files
56
49
  setup_dirs
57
50
  setup_prosody
58
- write_version
59
51
 
60
52
  crontab < /etc/cron.d/drumee
61
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" = "" -o "$FORCE_INSTALL" = "yes" ]; 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.6",
3
+ "version": "1.0.7",
4
4
  "description": "Drumee Infrastructure Setup Utilities",
5
5
  "main": "index.js",
6
6
  "scripts": {
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