@drumee/setup-infra 1.0.0 → 1.0.5

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.
Files changed (40) hide show
  1. package/README.md +1 -3
  2. package/bin/env +49 -0
  3. package/{congigure/init/acme → bin/init-acme} +1 -1
  4. package/{congigure/init/mail → bin/init-mail} +3 -3
  5. package/{congigure/utils/configure → bin/install} +11 -9
  6. package/{congigure/utils → bin}/jitsi +3 -0
  7. package/index.js +5 -2
  8. package/package.json +3 -2
  9. package/templates/etc/bind/named.conf.local +1 -1
  10. package/templates/etc/drumee/credential/ovh/dns.sh.tpl +1 -1
  11. package/templates/etc/drumee/dnsapi.sh.tpl +1 -1
  12. package/templates/etc/drumee/drumee.sh.tpl +2 -2
  13. package/templates/etc/drumee/infrastructure/internals/accel.conf.tpl +1 -1
  14. package/templates/etc/drumee/infrastructure/mfs.conf.tpl +1 -1
  15. package/templates/etc/drumee/infrastructure/platform.json.tpl +1 -1
  16. package/templates/etc/drumee/infrastructure/routes/main.conf.tpl +1 -1
  17. package/templates/etc/drumee/ssl/main.conf.tpl +1 -1
  18. package/templates/etc/jitsi/jicofo/sip-cmmunicator.properties +3 -0
  19. package/templates/etc/jitsi/meet.conf.tpl +19 -20
  20. package/templates/etc/nginx/sites-enabled/drumee.conf.tpl +1 -1
  21. package/templates/etc/nginx/sites-enabled/jitsi.conf.tpl +1 -1
  22. package/templates/etc/postfix/main.cf +1 -1
  23. package/templates/etc/prosody/conf.d/vhost.cfg.lua.tpl +9 -9
  24. package/templates/etc/prosody/defaults/credentials.sh +1 -1
  25. package/templates/schema/utils/configs.init.sql.tpl +1 -1
  26. package/templates/schema/utils/configs.update.sql.tpl +1 -1
  27. package/templates/server/ecosystem.config.js.tpl +1 -1
  28. package/congigure/menu/menu -tmp +0 -144
  29. package/congigure/menu/menu-install +0 -147
  30. package/congigure/menu/menu-reinstall +0 -15
  31. package/congigure/prepare +0 -10
  32. package/congigure/setup-infra +0 -58
  33. package/congigure/setup-schemas +0 -57
  34. package/congigure/start +0 -29
  35. package/congigure/utils/dependencies +0 -90
  36. package/congigure/utils/misc +0 -77
  37. package/congigure/utils/prompt.sh +0 -35
  38. package/congigure/utils/setup-versions +0 -7
  39. /package/{congigure/init/named → bin/init-named} +0 -0
  40. /package/{congigure/preset/jitsi → bin/preset-jitsi} +0 -0
package/README.md CHANGED
@@ -1,3 +1 @@
1
- # Drumee Infrastructure Setup Tool
2
- npm i @drumee/setup-infra
3
- This package is intended to be used by @drumee/setup
1
+ # Drumee Infrastructure Setup Utilities
package/bin/env ADDED
@@ -0,0 +1,49 @@
1
+ #!/bin/bash
2
+
3
+ if [ "$SUDO_UID" != "0" -a "$UID" != "0" ]; then
4
+ echo "This install script requires GENUINE root privilege (not sudo)"
5
+ exit 1
6
+ fi
7
+
8
+ export log_dir=/var/log/drumee
9
+ export log_file="${log_dir}/info.log"
10
+ export force_install=/etc/drumee/force-reinsall-existing-data-shall-be-lost
11
+
12
+ if [ ! -d $log_dir ]; then
13
+ mkdir -p $log_dir
14
+ fi
15
+
16
+ #-------------------
17
+ function log(){
18
+ echo $(date "+%Y:%m:%d[%H:%M:%s]") $* | tee $log_file
19
+ }
20
+
21
+ #-------------------
22
+ check_status() {
23
+ if [ "$1" != "0" ]; then
24
+ echo " -------------------------------------------" 1>&2
25
+ echo " $2 did not succeed, aborting" 1>&2
26
+ echo " -------------------------------------------" 1>&2
27
+ exit 1
28
+ fi
29
+ }
30
+
31
+ ##-------------------
32
+ protect_dir() {
33
+ dir=$1
34
+ conidential=$2
35
+ if [ -z $dir ]; then
36
+ if [ "$3" = "mkdir" ]; then
37
+ mkdir -p $dir
38
+ else
39
+ echo "No directory to protect. Skipped"
40
+ fi
41
+ else
42
+ mkdir -p $dir
43
+ chown -R $DRUMEE_SYSTEM_USER:$DRUMEE_SYSTEM_GROUP $dir
44
+ if [ "$confidential" = "yes" ]; then
45
+ chmod -R go-rwx $dir
46
+ fi
47
+ chmod -R u+rwx $dir
48
+ fi
49
+ }
@@ -15,7 +15,7 @@ function make_certs(){
15
15
  sleep 5
16
16
  fi
17
17
  if [ "$sum" -gt "10" ]; then
18
- echo Failed to create certifiicates. Please rune manually
18
+ echo Failed to create certifiicates. Please run manually
19
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
20
20
  fi
21
21
  sum=$(expr 1 + $sum)
@@ -1,13 +1,13 @@
1
1
  #!/bin/bash
2
- if [ "$DRUMEE_DOMAIN_NAME" = "" ]; then
2
+ if [ "$1" = "" ]; then
3
3
  echo "Domain name was not defined"
4
4
  exit 1
5
5
  fi
6
6
 
7
- echo "Configuring DKIM for domain $DRUMEE_DOMAIN_NAME"
7
+ echo "Configuring DKIM for domain $1"
8
8
  set -e
9
9
 
10
- dkim_dir=/etc/opendkim/keys/$DRUMEE_DOMAIN_NAME
10
+ dkim_dir=/etc/opendkim/keys/$1
11
11
  mkdir -p $dkim_dir
12
12
  cd $dkim_dir
13
13
  key_file=private.pem
@@ -4,21 +4,22 @@ set -e
4
4
  echo "Configuring Drumee Infrastructure"
5
5
  script_dir=$(dirname $(readlink -f $0))
6
6
 
7
- export infra_helper=$(dirname $script_dir)
7
+ export base=$(dirname $script_dir)
8
8
 
9
- $infra_helper/bin/init-mail
9
+ $base/bin/init-mail $DRUMEE_DOMAIN_NAME
10
10
 
11
- # Prepare config files
12
- node $infra_helper/index.js
11
+ # Write configs
12
+ node $base/index.js
13
13
  source /etc/drumee/drumee.sh
14
14
 
15
-
16
15
  if [ -d /etc/cron.d/drumee ]; then
17
16
  crontab /etc/cron.d/drumee
18
17
  fi
19
18
 
20
- source $infra_helper/bin/env
21
- source $infra_helper/bin/jitsi
19
+
20
+
21
+ source $base/bin/env
22
+ source $base/bin/jitsi
22
23
 
23
24
  install_jitsi
24
25
 
@@ -45,12 +46,13 @@ protect_dir $DRUMEE_SERVER_HOME
45
46
  protect_dir $DRUMEE_EXPORT_DIR
46
47
  protect_dir $DRUMEE_IMPORT_DIR
47
48
 
48
- $infra_helper/bin/init-named
49
- $infra_helper/bin/init-acme
49
+ $base/bin/init-named
50
+ $base/bin/init-acme
50
51
 
51
52
  clean_vendor_files
52
53
  setup_dirs
53
54
  setup_prosody
54
55
  write_version
55
56
 
57
+ crontab < /etc/cron.d/drumee
56
58
  echo "Drumee infrastructure done !"
@@ -1,6 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
+ source /etc/drumee/drumee.sh
4
+ source /etc/prosody/defaults/credentials.sh
3
5
 
6
+ set +e
4
7
  #-------------------
5
8
  function setup_dirs() {
6
9
  echo Configuring directories permissions
package/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // ======================================================
4
+ //
5
+ // ======================================================
3
6
  const Template = require("./templates");
4
7
  const { writeFileSync } = require(`jsonfile`);
5
8
  const { join, dirname } = require("path");
@@ -28,7 +31,7 @@ const {
28
31
  NSUPDATE_KEY,
29
32
  PUBLIC_IP4,
30
33
  PUBLIC_IP6,
31
- BACKUP_LOCATION,
34
+ STORAGE_BACKUP,
32
35
  } = process.env;
33
36
 
34
37
  /**
@@ -254,7 +257,7 @@ function getSysConfigs() {
254
257
  ["acme_email_account", ACME_EMAIL_ACCOUNT, ADMIN_EMAIL],
255
258
  ["public_ip4", PUBLIC_IP4, ''],
256
259
  ["public_ip6", PUBLIC_IP6, ''],
257
- ["backup_location", BACKUP_LOCATION, ''],
260
+ ["storage_backup", STORAGE_BACKUP, ''],
258
261
  ["db_backup", DB_BACKUP, ''],
259
262
  ["db_dir", DRUMEE_DB_DIR, '/srv/db'],
260
263
  ["max_body_size", MAX_BODY_SIZE, '10G'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drumee/setup-infra",
3
- "version": "1.0.0",
3
+ "version": "1.0.5",
4
4
  "description": "Drumee Infrastructure Setup Utilities",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,8 +15,9 @@
15
15
  "url": "https://github.com/drumee/setup-infra/issues"
16
16
  },
17
17
  "author": "Somanos Sar <somanos@drumee.com>",
18
- "license": "git",
18
+ "license": "AGPL V3",
19
19
  "dependencies": {
20
+ "@drumee/setup-infra": "^1.0.0",
20
21
  "@drumee/server-essentials": "^1.0.4",
21
22
  "crypto": "^1.0.1",
22
23
  "jsonfile": "^5.0.0",
@@ -1,5 +1,5 @@
1
1
  //
2
- // Configs setup by Drumee infra-setup utility
2
+ // Configs setup by Drumee setup-infra utility
3
3
  //
4
4
 
5
5
  include "/etc/bind/named.conf.log";
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # -------------------------------------------------------------
5
5
  export OVH_AK=<%= appKey %>
6
6
  export OVH_CK=<%= consumerKey %>
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -32,7 +32,7 @@ export DRUMEE_SYSTEM_GROUP=<%= system_group %>
32
32
  export DRUMEE_SYSTEM_USER=<%= system_user %>
33
33
  export DRUMEE_TMP_DIR=<%= runtime_dir %>/tmp
34
34
  export DRUMEE_UI_HOME=<%= runtime_dir %>/ui
35
- export DRUMEE_BACKUP_LOCATION=<%= BACKUP_LOCATION %>
35
+ export DRUMEE_STORAGE_BACKUP=<%= storage_backup %>
36
36
  export DRUMEE_DB_BACKUP=<%= db_backup %>
37
37
  export JITSI_DOMAIN=<%= jitsi_domain %>
38
38
  export OWN_CERTS_DIR=<%= own_certs_dir %>
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -0,0 +1,3 @@
1
+ org.jitsi.jicofo.BRIDGE_MUC=JvbBrewery@internal.auth.<%= jitsi_domain %>
2
+ org.jitsi.jicofo.auth.URL=XMPP:<%= jitsi_domain %>
3
+ org.jitsi.jicofo.ALWAYS_TRUST_MODE_ENABLED=true
@@ -1,11 +1,10 @@
1
- server_name <%= jitsi_domain %>;
1
+ server_name _;
2
2
 
3
3
  charset utf8;
4
4
 
5
5
  client_max_body_size 0;
6
6
 
7
- #root /usr/share/jitsi-meet;
8
- root /srv/drumee/static/images;
7
+ root /usr/share/jitsi-meet;
9
8
 
10
9
  # ssi on with javascript for multidomain variables in config.js
11
10
  ssi on;
@@ -24,30 +23,30 @@ set $prefix "";
24
23
  # Opt out of FLoC (deprecated)
25
24
  add_header Permissions-Policy "interest-cohort=()";
26
25
 
27
- # location = /config.js {
28
- # alias /etc/jitsi/web/config.js;
29
- # }
26
+ location = /config.js {
27
+ alias /etc/jitsi/web/config.js;
28
+ }
30
29
 
31
- # location = /interface_config.js {
32
- # alias /etc/jitsi/web/interface_config.js;
33
- # }
30
+ location = /interface_config.js {
31
+ alias /etc/jitsi/web/interface_config.js;
32
+ }
34
33
 
35
- # location = /external_api.js {
36
- # alias /usr/share/jitsi-meet/libs/external_api.min.js;
37
- # }
34
+ location = /external_api.js {
35
+ alias /usr/share/jitsi-meet/libs/external_api.min.js;
36
+ }
38
37
 
39
38
 
40
39
 
41
- # ensure all static content can always be found first
42
- # location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ {
43
- # add_header 'Access-Control-Allow-Origin' '*';
44
- # alias /usr/share/jitsi-meet/$1/$2;
40
+ ensure all static content can always be found first
41
+ location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ {
42
+ add_header 'Access-Control-Allow-Origin' '*';
43
+ alias /usr/share/jitsi-meet/$1/$2;
45
44
 
46
45
  # cache all versioned files
47
- # if ($arg_v) {
48
- # expires 1y;
49
- # }
50
- # }
46
+ if ($arg_v) {
47
+ expires 1y;
48
+ }
49
+ }
51
50
 
52
51
 
53
52
  # colibri (JVB) websockets
@@ -1,7 +1,7 @@
1
1
 
2
2
  # -------------------------------------------------------------
3
3
  # !!!!!!! DO NOT EDIT !!!!!!!!
4
- # Config file automatically generated by <infra-setup>
4
+ # Config file automatically generated by <setup-infra>
5
5
  # Purpose : Provide Nginx config to a specific server
6
6
  # Server name : <%= domain %>
7
7
  # Date : <%= date %>
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # !!!!!!! DO NOT EDIT !!!!!!!!
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Purpose : Provide Nginx config to a specific server
5
5
  # Server name : <%= domain %>
6
6
  # Date : <%= date %>
@@ -1,4 +1,4 @@
1
- # Configs generated by drumee-infra-setup
1
+ # Configs generated by drumee-setup-infra
2
2
  # See /usr/share/postfix/main.cf.dist for a commented, more complete version
3
3
 
4
4
 
@@ -53,8 +53,8 @@ VirtualHost "<%= jitsi_domain %>"
53
53
  VirtualHost "guest.<%= jitsi_domain %>"
54
54
  authentication = "anonymous"
55
55
  ssl = {
56
- key = "/usr/share/acme/certs/jit.drumee.io_ecc/jit.drumee.io.key";
57
- certificate = "/usr/share/acme/certs/jit.drumee.io_ecc/jit.drumee.io.cer";
56
+ key = "/usr/share/acme/certs/<%= jitsi_domain %>_ecc/<%= jitsi_domain %>.key";
57
+ certificate = "/usr/share/acme/certs/<%= jitsi_domain %>_ecc/<%= jitsi_domain %>.cer";
58
58
  }
59
59
  modules_enabled = {
60
60
  "bosh";
@@ -71,13 +71,13 @@ VirtualHost "guest.<%= jitsi_domain %>"
71
71
  "av_moderation";
72
72
  "turncredentials";
73
73
  }
74
- main_muc = "muc.jit.drumee.io"
75
- lobby_muc = "lobby.jit.drumee.io"
76
- breakout_rooms_muc = "breakout.jit.drumee.io"
77
- speakerstats_component = "speakerstats.jit.drumee.io"
78
- conference_duration_component = "conferenceduration.jit.drumee.io"
79
- end_conference_component = "endconference.jit.drumee.io"
80
- av_moderation_component = "avmoderation.jit.drumee.io"
74
+ main_muc = "muc.<%= jitsi_domain %>"
75
+ lobby_muc = "lobby.<%= jitsi_domain %>"
76
+ breakout_rooms_muc = "breakout.<%= jitsi_domain %>"
77
+ speakerstats_component = "speakerstats.<%= jitsi_domain %>"
78
+ conference_duration_component = "conferenceduration.<%= jitsi_domain %>"
79
+ end_conference_component = "endconference.<%= jitsi_domain %>"
80
+ av_moderation_component = "avmoderation.<%= jitsi_domain %>"
81
81
  turncredentials_secret = "<%= turn_sercret %>"
82
82
  c2s_require_encryption = false
83
83
 
@@ -1,6 +1,6 @@
1
1
  # -------------------------------------------------------------
2
2
  # ! DO NOT EDIT !
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Date : <%= date %>
5
5
  # -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  -- -------------------------------------------------------------
2
2
  -- ! DO NOT EDIT !
3
- -- Config file automatically generated by <infra-setup>
3
+ -- Config file automatically generated by <setup-infra>
4
4
  -- Date : <%= date %>
5
5
  -- -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  -- -------------------------------------------------------------
2
2
  -- ! DO NOT EDIT !
3
- -- Config file automatically generated by <infra-setup>
3
+ -- Config file automatically generated by <setup-infra>
4
4
  -- Date : <%= date %>
5
5
  -- -------------------------------------------------------------
6
6
 
@@ -1,6 +1,6 @@
1
1
  /* -------------------------------------------------------------
2
2
  # !!!!!!! DO NOT EDIT !!!!!!!!
3
- # Config file automatically generated by <infra-setup>
3
+ # Config file automatically generated by <setup-infra>
4
4
  # Purpose : Provide route (instance) to Nginx
5
5
  # Date : <%= date %>
6
6
  # ------------------------------------------------------------- */
@@ -1,144 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- # Source debconf library
5
- . /usr/share/debconf/confmodule
6
-
7
- echo "Installing Drumee from Debian Packages"
8
- script_dir=$(dirname $(readlink -f $0))
9
-
10
- . ${script_dir}/functions
11
-
12
- db_input high drumee/version || true
13
- db_input high drumee/description || true
14
- # DRUMEE_DOMAIN_NAME
15
- dom_pattern="^([a-zA-Z0-9_\-]+)(\.[a-zA-Z0-9_\-]+)*$"
16
- db_input high drumee/domain || true
17
- db_go
18
-
19
- db_get drumee/domain
20
- is_valid=$(echo $RET | grep -E "$dom_pattern")
21
- while [ "$is_valid" = "" ]
22
- do
23
- db_input high drumee/domain || true
24
- db_get drumee/domain
25
- is_valid=$(echo $RET | grep -E "$dom_pattern")
26
- done
27
-
28
- #prompt drumee/domain "^([a-zA-Z0-9_\-]+)(\.[a-zA-Z0-9_\-]+)*$"
29
- export DRUMEE_DOMAIN_NAME=$RET
30
-
31
- if [ "$DRUMEE_DOMAIN_NAME" = "local" ]; then
32
- db_input high drumee/local_mode || true
33
- db_get drumee/local_mode
34
- LOCAL_MODE=$RET
35
- else
36
- db_input high drumee/services || true
37
- db_get drumee/services
38
- SERVICES=$RET
39
- fi
40
-
41
- # PUBLIC_IP4
42
- #prompt drumee/public_ip4 "^([0-9]{1,3})(\.[0-9]{1,3}){3}$"
43
- # ip4_pattern="^([0-9]{1,3})(\.[0-9]{1,3}){3}$"
44
- # db_input high drumee/public_ip4 || true
45
- # db_go
46
- # db_get drumee/public_ip4
47
- # is_valid=$(echo $RET | grep -E "$ip4_pattern")
48
- # while [ "$is_valid" = "" ]
49
- # do
50
- # db_input high drumee/public_ip4 || true
51
- # db_go
52
- # db_get drumee/public_ip4
53
- # is_valid=$(echo $RET | grep -E "$ip4_pattern")
54
- # done
55
- export PUBLIC_IP4=$RET
56
-
57
- # PUBLIC_IP6
58
- #prompt drumee/public_ip6 "^([[:xdigit:]]{1,4})(:[[:xdigit:]]{0,4})*$"
59
- # ip6_pattern="^([[:xdigit:]]{1,4})(:[[:xdigit:]]{0,4})*$"
60
- # db_input high drumee/public_ip6 || true
61
- # db_go
62
- # db_get drumee/public_ip6
63
- # is_valid=$(echo $RET | grep -E "$ip6_pattern")
64
- # while [ "$is_valid" = "" ]
65
- # do
66
- # db_input high drumee/public_ip6 || true
67
- # db_go
68
- # db_get drumee/public_ip6
69
- # is_valid=$(echo $RET | grep -E "$ip6_pattern")
70
- # done
71
- export PUBLIC_IP6=$RET
72
-
73
- # ADMIN_EMAIL
74
- email_pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
75
- #prompt drumee/admin_email $email_pattern
76
- # db_input high drumee/admin_email || true
77
- # db_go
78
- # db_get drumee/admin_email
79
- # is_valid=$(echo $RET | grep -E "$email_pattern")
80
- # while [ "$is_valid" = "" ]
81
- # do
82
- # db_input high drumee/admin_email || true
83
- # db_go
84
- # db_get drumee/admin_email
85
- # is_valid=$(echo $RET | grep -E "$email_pattern")
86
- # done
87
- export ADMIN_EMAIL=$RET
88
-
89
- # ACME_EMAIL_ACCOUNT
90
- db_input high drumee/acme_email_account || true
91
- db_get drumee/acme_email_account
92
- if [ "$RET" = "" ]; then
93
- export ACME_EMAIL_ACCOUNT=$ADMIN_EMAIL
94
- else
95
- prompt drumee/acme_email_account $email_pattern
96
- # is_valid=$(echo $RET | grep -E "$email_pattern")
97
- # while [ "$is_valid" = "" ]
98
- # do
99
- # db_input high drumee/acme_email_account || true
100
- # db_go
101
- # db_get drumee/acme_email_account
102
- # is_valid=$(echo $RET | grep -E "$email_pattern")
103
- # done
104
- export ACME_EMAIL_ACCOUNT=$RET
105
- fi
106
-
107
- # DRUMEE_DB_DIR
108
- dir_pattern='^/+(usr|bin|sys|proc|tmp|etc|lib.*|boot|dev|sbin|opt|media|mnt|vmlinuz.*|lost.+|snap|root|run|initrd.*)'
109
- #prompt drumee/db_dir $dir_pattern
110
- # db_input high drumee/db_dir || true
111
- # db_go
112
- # db_get drumee/db_dir
113
- # is_valid=$(echo $RET | grep -E "$dir_pattern")
114
- # while [ "$is_valid" != "" ]
115
- # do
116
- # db_input high drumee/db_dir || true
117
- # db_go
118
- # db_get drumee/db_dir
119
- # is_valid=$(echo $RET | grep -E "$dir_pattern")
120
- # done
121
- export DRUMEE_DB_DIR=$RET
122
-
123
- # DRUMEE_DATA_DIR
124
- #prompt drumee/data_dir $dir_pattern
125
- # db_input high drumee/data_dir || true
126
- # db_go
127
- # db_get drumee/data_dir
128
- # is_valid=$(echo $RET | grep -E "$dir_pattern")
129
- # while [ "$is_valid" != "" ]
130
- # do
131
- # db_input high drumee/data_dir || true
132
- # db_go
133
- # db_get drumee/data_dir
134
- # is_valid=$(echo $RET | grep -E "$dir_pattern")
135
- # done
136
- export DRUMEE_DATA_DIR=$RET
137
-
138
- # BACKUP_LOCATION
139
- db_input high drumee/backup_location || true
140
- db_go
141
- db_get drumee/backup_location
142
-
143
- export BACKUP_LOCATION=$RET
144
-
@@ -1,147 +0,0 @@
1
- #!/bin/sh
2
- #set -e
3
-
4
- # Source debconf library
5
- . /usr/share/debconf/confmodule
6
-
7
- echo "Installing Drumee from Debian Packages"
8
- script_dir=$(dirname $(readlink -f $0))
9
-
10
- . ${script_dir}/functions
11
-
12
- db_input high drumee/reinstall || true
13
- db_go
14
- db_get drumee/reinstall
15
- if [ $RET = "quit" ]; then
16
- exit 0
17
- fi
18
-
19
- db_input high drumee/description || true
20
-
21
- # DRUMEE_DOMAIN_NAME
22
- dom_pattern="^([a-zA-Z0-9_\-]+)(\.[a-zA-Z0-9_\-]+)*$"
23
- db_input high drumee/domain || true
24
- db_go
25
- db_get drumee/domain
26
- is_valid=$(echo $RET | grep -E "$dom_pattern")
27
- while [ "$is_valid" = "" ]
28
- do
29
- db_input high drumee/domain || true
30
- db_go
31
- db_get drumee/domain
32
- is_valid=$(echo $RET | grep -E "$dom_pattern")
33
- done
34
- export DRUMEE_DOMAIN_NAME=$RET
35
-
36
- if [ "$DRUMEE_DOMAIN_NAME" = "local" ]; then
37
- db_input high drumee/local_mode || true
38
- db_go
39
- db_get drumee/local_mode
40
- LOCAL_MODE=$RET
41
- else
42
- db_input high drumee/services || true
43
- db_go
44
- db_get drumee/services
45
- SERVICES=$RET
46
- fi
47
-
48
- # PUBLIC_IP4
49
- ip4_pattern="^([0-9]{1,3})(\.[0-9]{1,3}){3}$"
50
- db_input high drumee/public_ip4 || true
51
- db_go
52
- db_get drumee/public_ip4
53
- is_valid=$(echo $RET | grep -E "$ip4_pattern")
54
- while [ "$is_valid" = "" ]
55
- do
56
- db_input high drumee/public_ip4 || true
57
- db_go
58
- db_get drumee/public_ip4
59
- is_valid=$(echo $RET | grep -E "$ip4_pattern")
60
- done
61
- export PUBLIC_IP4=$RET
62
-
63
- # PUBLIC_IP6
64
- ip6_pattern="^([[:xdigit:]]{1,4})(:[[:xdigit:]]{0,4})*$"
65
- db_input high drumee/public_ip6 || true
66
- db_go
67
- db_get drumee/public_ip6
68
- is_valid=$(echo $RET | grep -E "$ip6_pattern")
69
- while [ "$is_valid" = "" ]
70
- do
71
- db_input high drumee/public_ip6 || true
72
- db_go
73
- db_get drumee/public_ip6
74
- is_valid=$(echo $RET | grep -E "$ip6_pattern")
75
- done
76
- export PUBLIC_IP6=$RET
77
-
78
- # ADMIN_EMAIL
79
- email_pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
80
- db_input high drumee/admin_email || true
81
- db_go
82
- db_get drumee/admin_email
83
- is_valid=$(echo $RET | grep -E "$email_pattern")
84
- while [ "$is_valid" = "" ]
85
- do
86
- db_input high drumee/admin_email || true
87
- db_go
88
- db_get drumee/admin_email
89
- is_valid=$(echo $RET | grep -E "$email_pattern")
90
- done
91
- export ADMIN_EMAIL=$RET
92
-
93
- # ACME_EMAIL_ACCOUNT
94
- db_input high drumee/acme_email_account || true
95
- db_go
96
- db_get drumee/acme_email_account
97
- if [ "$RET" = "" ]; then
98
- export ACME_EMAIL_ACCOUNT=$ADMIN_EMAIL
99
- else
100
- is_valid=$(echo $RET | grep -E "$email_pattern")
101
- while [ "$is_valid" = "" ]
102
- do
103
- db_input high drumee/acme_email_account || true
104
- db_go
105
- db_get drumee/acme_email_account
106
- is_valid=$(echo $RET | grep -E "$email_pattern")
107
- done
108
- export ACME_EMAIL_ACCOUNT=$RET
109
- fi
110
-
111
- # DRUMEE_DB_DIR
112
- dir_pattern='^/+(usr|bin|sys|proc|tmp|etc|lib.*|boot|dev|sbin|opt|media|mnt|vmlinuz.*|lost.+|snap|root|run|initrd.*)'
113
- db_input high drumee/db_dir || true
114
- db_go
115
- db_get drumee/db_dir
116
- is_valid=$(echo $RET | grep -E "$dir_pattern")
117
- while [ "$is_valid" != "" ]
118
- do
119
- db_input high drumee/db_dir || true
120
- db_go
121
- db_get drumee/db_dir
122
- is_valid=$(echo $RET | grep -E "$dir_pattern")
123
- done
124
- export DRUMEE_DB_DIR=$RET
125
-
126
- # DRUMEE_DATA_DIR
127
- db_input high drumee/data_dir || true
128
- db_go
129
- db_get drumee/data_dir
130
- is_valid=$(echo $RET | grep -E "$dir_pattern")
131
- while [ "$is_valid" != "" ]
132
- do
133
- db_input high drumee/data_dir || true
134
- db_go
135
- db_get drumee/data_dir
136
- is_valid=$(echo $RET | grep -E "$dir_pattern")
137
- done
138
- export DRUMEE_DATA_DIR=$RET
139
-
140
- # BACKUP_LOCATION
141
- db_input high drumee/backup_location || true
142
- db_go
143
- db_get drumee/backup_location
144
-
145
- export BACKUP_LOCATION=$RET
146
-
147
- db_stop
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
- #set -e
3
-
4
- . /usr/share/debconf/confmodule
5
- script_dir=$(dirname $(readlink -f $0))
6
-
7
- . ${script_dir}/utils/prompt.sh
8
-
9
- db_input high drumee/reinstall || true
10
- db_go
11
- db_get drumee/reinstall
12
- echo QQQQ $RET
13
- export MENU_RET=$RET
14
-
15
- db_stop
package/congigure/prepare DELETED
@@ -1,10 +0,0 @@
1
- #!/bin/bash
2
- script_dir=$(dirname $(readlink -f $0))
3
- base_dir=$(dirname $script_dir)
4
- source $script_dir/utils/dependencies
5
-
6
- ensure_node_packages
7
- ensure_postfix
8
- ensure_jitsi $base_dir/preset/jitsi
9
- ensure_mariadb
10
-
@@ -1,58 +0,0 @@
1
- #!/bin/bash
2
-
3
-
4
- set -e
5
- echo "Configuring Drumee Infrastructure"
6
- script_dir=$(dirname $(readlink -f $0))
7
- node_dir=$(dirname $script_dir)
8
-
9
- $script_dir/init/mail
10
-
11
- node $node_dir/index.js
12
-
13
- if [ ! -f /etc/drumee/drumee.sh ]; then
14
- echo Could not run Drumee without proper settings
15
- exit 1
16
- fi
17
-
18
- source /etc/drumee/drumee.sh
19
- if [ -d /etc/cron.d/drumee ]; then
20
- crontab /etc/cron.d/drumee
21
- fi
22
-
23
-
24
- source $infra_helper/utils/misc
25
- source $infra_helper/utils/jitsi
26
-
27
- install_jitsi
28
-
29
- protect_dir $DRUMEE_RUNTIME_DIR "no" "mkdir"
30
- protect_dir $DRUMEE_DATA_DIR "yes" "mkdir"
31
- cd $DRUMEE_DATA_DIR
32
-
33
- for d in mfs tmp; do
34
- protect_dir "$DRUMEE_DATA_DIR/$d" "yes"
35
- done
36
-
37
-
38
- LOG_DIR=$DRUMEE_SERVER_HOME/.pm2/logs
39
-
40
- touch $DRUMEE_DATA_DIR/mfs/dont-remove-this-dir
41
- chmod a-w $DRUMEE_DATA_DIR/mfs/dont-remove-this-dir
42
-
43
- protect_dir $DRUMEE_STATIC_DIR
44
- protect_dir /etc/drumee
45
- protect_dir $LOG_DIR "yes"
46
- protect_dir $DRUMEE_CACHE_DIR
47
- protect_dir $DRUMEE_TMP_DIR "yes"
48
- protect_dir $DRUMEE_SERVER_HOME
49
- protect_dir $DRUMEE_EXPORT_DIR
50
- protect_dir $DRUMEE_IMPORT_DIR
51
-
52
- $infra_helper/init/named
53
- $infra_helper/init/acme
54
-
55
- clean_vendor_files
56
- setup_dirs
57
- setup_prosody
58
- write_version
@@ -1,57 +0,0 @@
1
- #!/bin/bash
2
-
3
-
4
- set -e
5
- echo "Configuring Drumee Infrastructure"
6
- script_dir=$(dirname $(readlink -f $0))
7
- node_dir=$(dirname $script_dir)
8
-
9
- $script_dir/init/mail
10
-
11
- node $node_dir/index.js
12
-
13
- if [ ! -f /etc/drumee/drumee.sh ]; then
14
- echo Could not run Drumee without proper settings
15
- exit 1
16
- fi
17
-
18
- source /etc/drumee/drumee.sh
19
- if [ -d /etc/cron.d/drumee ]; then
20
- crontab /etc/cron.d/drumee
21
- fi
22
-
23
-
24
- source $infra_helper/utils/misc
25
- source $infra_helper/utils/jitsi
26
-
27
- install_jitsi
28
-
29
- protect_dir $DRUMEE_RUNTIME_DIR "no" "mkdir"
30
- protect_dir $DRUMEE_DATA_DIR "yes" "mkdir"
31
- cd $DRUMEE_DATA_DIR
32
-
33
- for d in mfs tmp; do
34
- protect_dir "$DRUMEE_DATA_DIR/$d" "yes"
35
- done
36
-
37
- LOG_DIR=$DRUMEE_SERVER_HOME/.pm2/logs
38
-
39
- touch $DRUMEE_DATA_DIR/mfs/dont-remove-this-dir
40
- chmod a-w $DRUMEE_DATA_DIR/mfs/dont-remove-this-dir
41
-
42
- protect_dir $DRUMEE_STATIC_DIR
43
- protect_dir /etc/drumee
44
- protect_dir $LOG_DIR "yes"
45
- protect_dir $DRUMEE_CACHE_DIR
46
- protect_dir $DRUMEE_TMP_DIR "yes"
47
- protect_dir $DRUMEE_SERVER_HOME
48
- protect_dir $DRUMEE_EXPORT_DIR
49
- protect_dir $DRUMEE_IMPORT_DIR
50
-
51
- $infra_helper/init/named
52
- $infra_helper/init/acme
53
-
54
- clean_vendor_files
55
- setup_dirs
56
- setup_prosody
57
- write_version
package/congigure/start DELETED
@@ -1,29 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
- . /usr/share/debconf/confmodule
4
-
5
- echo "Installing Drumee Team Meta Package"
6
- script_dir=`dirname $(readlink -f $0)`
7
- . $script_dir/utils/functions
8
- . $script_dir/utils/prompt.sh
9
-
10
- check_installation
11
- if [ "$RET" = "maiden" ]; then
12
- select_installation_mode
13
- if [ "$RET" = "menu" ]; then
14
- $script_dir/menu-install
15
- fi
16
- $script_dir/prepare
17
- else
18
- should_reinstall
19
- if [ "$RET" = "remove" ]; then
20
- export FORCE_INSTALL=yes
21
- service mariadb stop
22
- echo rm -rf $DRUMEE_DB_DIR
23
- echo rm -rf $DRUMEE_DATA_DIR
24
- $script_dir/menu-install
25
- $script_dir/prepare
26
- else
27
- echo updating
28
- fi
29
- done
@@ -1,90 +0,0 @@
1
-
2
- # Install postfix
3
- ensure_postfix () {
4
- debconf-set-selections $1
5
- DEBIAN_FRONTEND="noninteractive" apt install -y libopendkim11 opendkim-tools libmail-dkim-perl opendkim postfix mailutils spamass-milter postfix-mysql
6
- }
7
-
8
- # Install Jitsi packages
9
- ensure_jitsi () {
10
- installed=$(dpkg -l | egrep "^ii +jitsi-meet")
11
- if [ "$installed" != "" ]; then
12
- echo Already have jitsi-meet.
13
- else
14
- debconf-set-selections $1
15
- curl -sS https://download.jitsi.org/jitsi-key.gpg.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/jitsi-key.gpg
16
- echo "deb https://download.jitsi.org stable/" | tee /etc/apt/sources.list.d/jitsi-stable.list
17
-
18
- apt update
19
- apt install -y prosody
20
- DEBIAN_FRONTEND="noninteractive" apt install -y jitsi-meet
21
- fi
22
- }
23
-
24
- ensure_mariadb () {
25
- v=$(which mariadb)
26
- if [ "$v" = "" ]; then
27
- v=0
28
- else
29
- v=$(mariadb --version | awk '{print $5}' | sed -E "s/\..+$//")
30
- fi
31
- if (($v > 9)); then
32
- echo "Already have MariaDb"
33
- else
34
- if [ ! -f /etc/apt/sources.list.d/mariadb.list ]; then
35
- curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash
36
- fi
37
- apt install -y --no-install-recommends mariadb-server mariadb-client mariadb-backup
38
- fi
39
- service mariadb stop
40
- }
41
-
42
-
43
- #
44
- node_version () {
45
- v=$(which node)
46
- if [ -z $v ]; then
47
- echo "0"
48
- else
49
- v=$(node -v | sed -E "s/^v//" | sed -E "s/\..+$//")
50
- echo $v
51
- fi
52
- }
53
-
54
- # Install Node packages dependencies
55
- ensure_node_packages () {
56
- echo Installing Node packages dependencies...
57
- version=$(node_version)
58
- if (($version < 20)); then
59
- curl -s https://deb.nodesource.com/setup_20.x | bash && apt-get update && apt-get install nodejs -y
60
- fi
61
-
62
- node -v
63
- npm -v
64
-
65
- npm install -g moment minimist shelljs jsonfile readline-sync pm2 pm2-logrotate lodash node-gyp node-pre-gyp coffeescript sass
66
- }
67
-
68
- check_installation () {
69
- if [ -f /etc/drumee/drumee.sh ]; then
70
- source /etc/drumee/drumee.sh
71
- yp=$(mysql yp -e "select main_domain() mydomain")
72
- if [ "$yp" = "" ]; then
73
- RET=maiden
74
- else
75
- RET=exists
76
- fi
77
- else
78
- RET=exists
79
- fi
80
- }
81
-
82
- select_installation_mode () {
83
- for i in DRUMEE_DOMAIN_NAME PUBLIC_IP4 PUBLIC_IP6 ADMIN_EMAIL DRUMEE_DB_DIR DRUMEE_DATA_DIR; do
84
- if [ "${!i}" = "" ]; then
85
- RET=menu
86
- break
87
- fi
88
- done
89
- RET=auto
90
- }
@@ -1,77 +0,0 @@
1
-
2
- export log_dir=/var/log/drumee
3
- export log_file="${log_dir}/info.log"
4
-
5
- if [ ! -d $log_dir ]; then
6
- mkdir -p $log_dir
7
- fi
8
-
9
- # log
10
- log () {
11
- echo $(date "+%Y:%m:%d[%H:%M:%s]") $* | tee $log_file
12
- }
13
-
14
- #answer
15
- answer () {
16
- stdin="${1:-/dev/stdin}"
17
- while read line; do
18
- break
19
- done <$stdin
20
- echo $line$()
21
- }
22
-
23
- # Ensure there won't be confilcting ports
24
- check_ports () {
25
- set +
26
- echo Scanning ports in use. This may take a while
27
- netstat -alpute | awk 'BEGIN { FS=" " } {print $4}' | egrep -E ".+:.+" >/tmp/netstat.log
28
- ports="53 10000 3478 5222 5269 5280 5281 5282 5283 5349 8888 9090 domain xmpp-client xmpp-server"
29
-
30
- for i in $ports; do
31
- port=$(grep -w $i /tmp/netstat.log)
32
- if [ ! -z "$port" ]; then
33
- echo port $i is already in used
34
- fi
35
- done
36
- }
37
-
38
-
39
- #-------------------
40
- log () {
41
- echo $(date "+%Y:%m:%d[%H:%M:%s]") $* | tee $log_file
42
- }
43
-
44
-
45
- ##-------------------
46
- protect_dir () {
47
- dir=$1
48
- conidential=$2
49
- if [ -z $dir ]; then
50
- if [ "$3" = "mkdir" ]; then
51
- mkdir -p $dir
52
- else
53
- echo "No directory to protect. Skipped"
54
- fi
55
- else
56
- mkdir -p $dir
57
- chown -R $DRUMEE_SYSTEM_USER:$DRUMEE_SYSTEM_GROUP $dir
58
- if [ "$confidential" = "yes" ]; then
59
- chmod -R go-rwx $dir
60
- fi
61
- chmod -R u+rwx $dir
62
- fi
63
- }
64
-
65
- check_installation() {
66
- if [ -f /etc/drumee/drumee.sh ]; then
67
- source /etc/drumee/drumee.sh
68
- yp=$(mysql yp -e "select main_domaissn() mydomain");
69
- if [ "$yp" = "" ]; then
70
- RET=maiden
71
- else
72
- RET=exists
73
- fi
74
- else
75
- RET=maiden
76
- fi
77
- }
@@ -1,35 +0,0 @@
1
-
2
-
3
- #
4
- prompt () {
5
- name=$1
6
- pattern=$2
7
- toggle=$3
8
- db_input high $name || true
9
- db_get $name
10
- is_valid=$(echo $RET | grep -E "$pattern")
11
- if ["$toggle" = "" ]; then
12
- while [ "$is_valid" = "" ]
13
- do
14
- db_input high $name || true
15
- db_get $name
16
- is_valid=$(echo $RET | grep -E "$pattern")
17
- done
18
- else
19
- while [ "$is_valid" != "" ]
20
- do
21
- db_input high $name || true
22
- db_get $name
23
- is_valid=$(echo $RET | grep -E "$pattern")
24
- done
25
- fi
26
- }
27
-
28
- should_reinstall () {
29
- db_input high drumee/reinstall || true
30
- db_go
31
- db_get drumee/reinstall
32
- if [ "$RET" = "quit" ]; then
33
- exit 0
34
- fi
35
- }
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- base="$(dirname "$(readlink -f "$0")")"
3
- mkdir -p /etc/jitsi
4
- dest=/etc/jitsi/versions.js
5
- echo "module.exports={" > $dest
6
- dpkg -l | egrep "ii +jitsi" | awk '{print "\"", $2, "\"", ":", "\"", $3, "\"", ","}' | sed -E "s/ +//g" >> $dest
7
- echo "}" >> $dest
File without changes
File without changes