@drumee/setup-infra 1.0.6 → 1.0.8

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,8 @@ set -e
4
4
  echo "Configuring Drumee Infrastructure"
5
5
  script_dir=$(dirname $(readlink -f $0))
6
6
 
7
- export base=$(dirname $script_dir)
8
7
 
8
+ export base=$(dirname $script_dir)
9
9
  $base/bin/init-mail $DRUMEE_DOMAIN_NAME
10
10
 
11
11
  # Write configs
@@ -16,15 +16,10 @@ if [ -d /etc/cron.d/drumee ]; then
16
16
  crontab /etc/cron.d/drumee
17
17
  fi
18
18
 
19
-
20
-
21
19
  source $base/bin/env
22
- source $base/bin/jitsi
20
+ source $base/bin/prosody
23
21
 
24
- debconf-set-selections $base/bin/preset-jitsi
25
- if [ "$SKIP_JITSI" = "" ]; then
26
- install_jitsi
27
- fi
22
+ clean_vendor_files
28
23
 
29
24
  protect_dir $DRUMEE_RUNTIME_DIR "no" "mkdir"
30
25
  protect_dir $DRUMEE_DATA_DIR "yes" "mkdir"
@@ -52,10 +47,8 @@ protect_dir $DRUMEE_IMPORT_DIR
52
47
  $base/bin/init-named
53
48
  $base/bin/init-acme
54
49
 
55
- clean_vendor_files
56
50
  setup_dirs
57
51
  setup_prosody
58
- write_version
59
52
 
60
53
  crontab < /etc/cron.d/drumee
61
54
  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,14 @@
1
+ #!/bin/sh
2
+ if [ -e /etc/drumee/drumee.sh ]; then
3
+ if [ -e /etc/prosody/defaults/credentials.sh ]; then
4
+ . /etc/drumee/drumee.sh
5
+ . /etc/prosody/defaults/credentials.sh
6
+ . /usr/share/debconf/confmodule
7
+ turn_secret=$(grep static-auth-secret /etc/turnserver.conf | sed -E "s/^.+=//")
8
+ db_set jitsi-videobridge/jvb-hostname $JITSI_DOMAIN
9
+ db_set jitsi-videobridge/jvbsecret $JVB_PASSWORD
10
+ db_set jicofo/jicofo-authpassword $JICOFO_PASSWORD
11
+ db_set jitsi-meet-prosody/jvb-hostname $JITSI_DOMAIN
12
+ db_set jitsi-meet-prosody/turn-secret $turn_secret
13
+ fi
14
+ fi
package/index.js CHANGED
@@ -227,7 +227,7 @@ function makeData(opt) {
227
227
  if (/.+\+$/.test(value)) {
228
228
  value = value.replace(/\+$/, data[key]);
229
229
  }
230
- data[key] = value || fallback;
230
+ data[key] = value.trim() || fallback;
231
231
  }
232
232
  }
233
233
  return data;
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.8",
4
4
  "description": "Drumee Infrastructure Setup Utilities",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,10 +7,10 @@
7
7
  location / {
8
8
  index /-/;
9
9
 
10
- location ~ (.+)\.(.+)$ {
10
+ location ~ (.+)$ {
11
11
  add_header Cache-Control max-age=31536000;
12
12
  fastcgi_hide_header Set-Cookie;
13
13
  add_header Access-Control-Allow-Origin <%= domain %>;
14
- rewrite /(.+)$ <%= public_ui_root %>/svc/media.raw?p=$1&d=inline;
14
+ rewrite /(.+)$ <%= public_ui_root %>/svc/media.raw?p=/$1&d=inline;
15
15
  }
16
16
  }
@@ -4,7 +4,9 @@ charset utf8;
4
4
 
5
5
  client_max_body_size 0;
6
6
 
7
- root /usr/share/jitsi-meet;
7
+ # Disable direct access to jitsi UI
8
+ # root /usr/share/jitsi-meet;
9
+ root <%= static_dir %>;
8
10
 
9
11
  # ssi on with javascript for multidomain variables in config.js
10
12
  ssi on;
@@ -24,6 +24,13 @@ server {
24
24
  root <%= server_dir %>;
25
25
  server_name <%= domain %>;
26
26
  client_max_body_size <%= max_body_size %>;
27
+
28
+ # Security headers
29
+ add_header X-Content-Type-Options nosniff;
30
+ add_header X-XSS-Protection "1; mode=block";
31
+
32
+ set $prefix "";
33
+
27
34
  include /etc/drumee/ssl/main.conf;
28
35
  include /etc/drumee/infrastructure/routes/*.conf;
29
36
  include /etc/drumee/infrastructure/internals/*.conf;
@@ -0,0 +1,32 @@
1
+
2
+ # -------------------------------------------------------------
3
+ # !!!!!!! DO NOT EDIT !!!!!!!!
4
+ # Config file automatically generated by <setup-infra>
5
+ # Purpose : Provide Nginx config to a specific server
6
+ # Server name : loopback
7
+ # Date : <%= date %>
8
+ # -------------------------------------------------------------
9
+
10
+
11
+ proxy_cache_path <%= cache_dir %>/loopback levels=1:2 keys_zone=loopback_keys_zone:10m max_size=10g inactive=60m;
12
+ server {
13
+ listen 127.0.0.1:80;
14
+ server_name _;
15
+ #
16
+ root <%= server_dir %>;
17
+ server_name _;
18
+ client_max_body_size <%= max_body_size %>;
19
+
20
+ # Security headers
21
+ add_header X-Content-Type-Options nosniff;
22
+ add_header X-XSS-Protection "1; mode=block";
23
+
24
+ set $prefix "";
25
+
26
+ include /etc/drumee/ssl/main.conf;
27
+ include /etc/drumee/infrastructure/routes/*.conf;
28
+ include /etc/drumee/infrastructure/internals/*.conf;
29
+ include /etc/drumee/infrastructure/mfs.conf;
30
+ }
31
+
32
+
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