@drumee/setup-infra 1.0.13 → 1.0.15
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 +13 -5
- package/bin/init-private +40 -0
- package/bin/prosody +1 -1
- package/index.js +330 -163
- package/package.json +3 -4
- package/templates/etc/bind/named.conf.options +1 -1
- package/templates/etc/bind/named.conf.private +21 -0
- package/templates/etc/bind/{named.conf.local → named.conf.public} +2 -2
- package/templates/etc/dkimkeys/dkim.key +1 -1
- package/templates/etc/drumee/conf.d/myDrumee.json.tpl +2 -2
- package/templates/etc/drumee/dnsapi.sh.tpl +1 -1
- package/templates/etc/drumee/drumee.sh.tpl +24 -17
- package/templates/etc/drumee/env.json +1 -1
- package/templates/etc/drumee/infrastructure/routes/main.conf.tpl +23 -13
- package/templates/etc/drumee/ssl/{main.conf.tpl → private.conf.tpl} +2 -4
- package/templates/etc/drumee/ssl/public.conf.tpl +10 -0
- package/templates/etc/mysql/mariadb.conf.d/50-client.cnf +21 -0
- package/templates/etc/mysql/mariadb.conf.d/50-server.cnf +2 -1
- package/templates/etc/nginx/nginx.conf +2 -2
- package/templates/etc/nginx/sites-enabled/jitsi.conf.tpl +4 -4
- package/templates/etc/nginx/sites-enabled/{loopback.tpl → localhost.conf} +9 -10
- package/templates/etc/nginx/sites-enabled/pivate.jitsi.conf.tpl +28 -0
- package/templates/etc/nginx/sites-enabled/private.conf.tpl +40 -0
- package/templates/etc/nginx/sites-enabled/{drumee.conf.tpl → public.conf.tpl} +8 -8
- package/templates/etc/nginx/sites-enabled/public.jitsi.conf.tpl +28 -0
- package/templates/etc/postfix/main.cf +1 -1
- package/templates/etc/prosody/conf.d/private.cfg.lua.tpl +162 -0
- package/templates/etc/prosody/conf.d/public.cfg.lua.tpl +162 -0
- package/templates/index.js +19 -13
- package/templates/utils.js +240 -0
- package/templates/var/lib/bind/private-reverse.tpl +17 -0
- package/templates/var/lib/bind/prvate.tpl +70 -0
- package/thidima.sh +0 -44
- /package/templates/var/lib/bind/{reverse.tpl → public-reverse.tpl} +0 -0
- /package/templates/var/lib/bind/{domain.tpl → public.tpl} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
admins = {
|
|
2
|
+
"jigasi@auth.<%= prvate_jitsi %>",
|
|
3
|
+
"jibri@auth.<%= prvate_jitsi %>",
|
|
4
|
+
"focus@auth.<%= prvate_jitsi %>",
|
|
5
|
+
"jvb@auth.<%= prvate_jitsi %>"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
unlimited_jids = {
|
|
9
|
+
"focus@auth.<%= prvate_jitsi %>",
|
|
10
|
+
"jvb@auth.<%= prvate_jitsi %>"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
plugin_paths = { "/usr/share/jitsi-meet/prosody-plugins/", "/prosody-plugins-custom" }
|
|
14
|
+
|
|
15
|
+
muc_mapper_domain_base = "<%= prvate_jitsi %>";
|
|
16
|
+
muc_mapper_domain_prefix = "muc";
|
|
17
|
+
http_default_host = "<%= prvate_jitsi %>"
|
|
18
|
+
consider_bosh_secure = true;
|
|
19
|
+
consider_websocket_secure = true;
|
|
20
|
+
|
|
21
|
+
VirtualHost "<%= prvate_jitsi %>"
|
|
22
|
+
authentication = "internal_hashed"
|
|
23
|
+
ssl = {
|
|
24
|
+
key = "<%= certs_dir %>/<%= prvate_jitsi %>_ecc/<%= prvate_jitsi %>.key";
|
|
25
|
+
certificate = "<%= certs_dir %>/<%= prvate_jitsi %>_ecc/<%= prvate_jitsi %>.cer";
|
|
26
|
+
}
|
|
27
|
+
modules_enabled = {
|
|
28
|
+
"bosh";
|
|
29
|
+
"websocket";
|
|
30
|
+
"smacks"; -- XEP-0198: Stream Management
|
|
31
|
+
"pubsub";
|
|
32
|
+
"ping";
|
|
33
|
+
"speakerstats";
|
|
34
|
+
"conference_duration";
|
|
35
|
+
"room_metadata";
|
|
36
|
+
"end_conference";
|
|
37
|
+
"muc_lobby_rooms";
|
|
38
|
+
"muc_breakout_rooms";
|
|
39
|
+
"av_moderation";
|
|
40
|
+
"turncredentials";
|
|
41
|
+
}
|
|
42
|
+
main_muc = "muc.<%= prvate_jitsi %>"
|
|
43
|
+
lobby_muc = "lobby.<%= prvate_jitsi %>"
|
|
44
|
+
breakout_rooms_muc = "breakout.<%= prvate_jitsi %>"
|
|
45
|
+
speakerstats_component = "speakerstats.<%= prvate_jitsi %>"
|
|
46
|
+
conference_duration_component = "conferenceduration.<%= prvate_jitsi %>"
|
|
47
|
+
end_conference_component = "endconference.<%= prvate_jitsi %>"
|
|
48
|
+
av_moderation_component = "avmoderation.<%= prvate_jitsi %>"
|
|
49
|
+
turncredentials_secret = "<%= turn_sercret %>"
|
|
50
|
+
c2s_require_encryption = false
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
VirtualHost "guest.<%= prvate_jitsi %>"
|
|
54
|
+
authentication = "anonymous"
|
|
55
|
+
ssl = {
|
|
56
|
+
key = "/usr/share/acme/certs/<%= prvate_jitsi %>_ecc/<%= prvate_jitsi %>.key";
|
|
57
|
+
certificate = "/usr/share/acme/certs/<%= prvate_jitsi %>_ecc/<%= prvate_jitsi %>.cer";
|
|
58
|
+
}
|
|
59
|
+
modules_enabled = {
|
|
60
|
+
"bosh";
|
|
61
|
+
"websocket";
|
|
62
|
+
"smacks"; -- XEP-0198: Stream Management
|
|
63
|
+
"pubsub";
|
|
64
|
+
"ping";
|
|
65
|
+
"speakerstats";
|
|
66
|
+
"conference_duration";
|
|
67
|
+
"room_metadata";
|
|
68
|
+
"end_conference";
|
|
69
|
+
"muc_lobby_rooms";
|
|
70
|
+
"muc_breakout_rooms";
|
|
71
|
+
"av_moderation";
|
|
72
|
+
"turncredentials";
|
|
73
|
+
}
|
|
74
|
+
main_muc = "muc.<%= prvate_jitsi %>"
|
|
75
|
+
lobby_muc = "lobby.<%= prvate_jitsi %>"
|
|
76
|
+
breakout_rooms_muc = "breakout.<%= prvate_jitsi %>"
|
|
77
|
+
speakerstats_component = "speakerstats.<%= prvate_jitsi %>"
|
|
78
|
+
conference_duration_component = "conferenceduration.<%= prvate_jitsi %>"
|
|
79
|
+
end_conference_component = "endconference.<%= prvate_jitsi %>"
|
|
80
|
+
av_moderation_component = "avmoderation.<%= prvate_jitsi %>"
|
|
81
|
+
turncredentials_secret = "<%= turn_sercret %>"
|
|
82
|
+
c2s_require_encryption = false
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
VirtualHost "auth.<%= prvate_jitsi %>"
|
|
86
|
+
ssl = {
|
|
87
|
+
key = "<%= certs_dir %>/<%= prvate_jitsi %>_ecc/<%= prvate_jitsi %>.key";
|
|
88
|
+
certificate = "<%= certs_dir %>/<%= prvate_jitsi %>_ecc/fullchain.cer";
|
|
89
|
+
}
|
|
90
|
+
modules_enabled = {
|
|
91
|
+
"limits_exception";
|
|
92
|
+
}
|
|
93
|
+
authentication = "internal_hashed"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
Component "internal-muc.<%= prvate_jitsi %>" "muc"
|
|
98
|
+
storage = "memory"
|
|
99
|
+
modules_enabled = {
|
|
100
|
+
"ping";
|
|
101
|
+
}
|
|
102
|
+
restrict_room_creation = true
|
|
103
|
+
muc_room_locking = false
|
|
104
|
+
muc_room_default_public_jids = true
|
|
105
|
+
|
|
106
|
+
Component "muc.<%= prvate_jitsi %>" "muc"
|
|
107
|
+
restrict_room_creation = true
|
|
108
|
+
storage = "memory"
|
|
109
|
+
modules_enabled = {
|
|
110
|
+
"muc_meeting_id";
|
|
111
|
+
"polls";
|
|
112
|
+
"muc_domain_mapper";
|
|
113
|
+
"muc_password_whitelist";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
-- The size of the cache that saves state for IP addresses
|
|
117
|
+
rate_limit_cache_size = 10000;
|
|
118
|
+
muc_room_cache_size = 1000
|
|
119
|
+
muc_room_locking = false
|
|
120
|
+
muc_room_default_public_jids = true
|
|
121
|
+
muc_password_whitelist = {
|
|
122
|
+
"focus@<no value>"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
Component "focus.<%= prvate_jitsi %>" "client_proxy"
|
|
126
|
+
target_address = "focus@auth.<%= prvate_jitsi %>"
|
|
127
|
+
|
|
128
|
+
Component "speakerstats.<%= prvate_jitsi %>" "speakerstats_component"
|
|
129
|
+
muc_component = "muc.<%= prvate_jitsi %>"
|
|
130
|
+
|
|
131
|
+
Component "conferenceduration.<%= prvate_jitsi %>" "conference_duration_component"
|
|
132
|
+
muc_component = "muc.<%= prvate_jitsi %>"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Component "endconference.<%= prvate_jitsi %>" "end_conference"
|
|
136
|
+
muc_component = "muc.<%= prvate_jitsi %>"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Component "lobby.<%= prvate_jitsi %>" "muc"
|
|
140
|
+
storage = "memory"
|
|
141
|
+
restrict_room_creation = true
|
|
142
|
+
muc_room_locking = false
|
|
143
|
+
muc_room_default_public_jids = true
|
|
144
|
+
modules_enabled = {
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
Component "breakout.<%= prvate_jitsi %>" "muc"
|
|
149
|
+
storage = "memory"
|
|
150
|
+
restrict_room_creation = true
|
|
151
|
+
muc_room_locking = false
|
|
152
|
+
muc_room_default_public_jids = true
|
|
153
|
+
modules_enabled = {
|
|
154
|
+
"muc_meeting_id";
|
|
155
|
+
"muc_domain_mapper";
|
|
156
|
+
"polls";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Component "metadata.<%= prvate_jitsi %>" "room_metadata_component"
|
|
161
|
+
muc_component = "muc.<%= prvate_jitsi %>"
|
|
162
|
+
breakout_rooms_component = "breakout.<%= prvate_jitsi %>"
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
admins = {
|
|
2
|
+
"jigasi@auth.<%= public_jitsi %>",
|
|
3
|
+
"jibri@auth.<%= public_jitsi %>",
|
|
4
|
+
"focus@auth.<%= public_jitsi %>",
|
|
5
|
+
"jvb@auth.<%= public_jitsi %>"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
unlimited_jids = {
|
|
9
|
+
"focus@auth.<%= public_jitsi %>",
|
|
10
|
+
"jvb@auth.<%= public_jitsi %>"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
plugin_paths = { "/usr/share/jitsi-meet/prosody-plugins/", "/prosody-plugins-custom" }
|
|
14
|
+
|
|
15
|
+
muc_mapper_domain_base = "<%= public_jitsi %>";
|
|
16
|
+
muc_mapper_domain_prefix = "muc";
|
|
17
|
+
http_default_host = "<%= public_jitsi %>"
|
|
18
|
+
consider_bosh_secure = true;
|
|
19
|
+
consider_websocket_secure = true;
|
|
20
|
+
|
|
21
|
+
VirtualHost "<%= public_jitsi %>"
|
|
22
|
+
authentication = "internal_hashed"
|
|
23
|
+
ssl = {
|
|
24
|
+
key = "<%= certs_dir %>/<%= public_jitsi %>_ecc/<%= public_jitsi %>.key";
|
|
25
|
+
certificate = "<%= certs_dir %>/<%= public_jitsi %>_ecc/<%= public_jitsi %>.cer";
|
|
26
|
+
}
|
|
27
|
+
modules_enabled = {
|
|
28
|
+
"bosh";
|
|
29
|
+
"websocket";
|
|
30
|
+
"smacks"; -- XEP-0198: Stream Management
|
|
31
|
+
"pubsub";
|
|
32
|
+
"ping";
|
|
33
|
+
"speakerstats";
|
|
34
|
+
"conference_duration";
|
|
35
|
+
"room_metadata";
|
|
36
|
+
"end_conference";
|
|
37
|
+
"muc_lobby_rooms";
|
|
38
|
+
"muc_breakout_rooms";
|
|
39
|
+
"av_moderation";
|
|
40
|
+
"turncredentials";
|
|
41
|
+
}
|
|
42
|
+
main_muc = "muc.<%= public_jitsi %>"
|
|
43
|
+
lobby_muc = "lobby.<%= public_jitsi %>"
|
|
44
|
+
breakout_rooms_muc = "breakout.<%= public_jitsi %>"
|
|
45
|
+
speakerstats_component = "speakerstats.<%= public_jitsi %>"
|
|
46
|
+
conference_duration_component = "conferenceduration.<%= public_jitsi %>"
|
|
47
|
+
end_conference_component = "endconference.<%= public_jitsi %>"
|
|
48
|
+
av_moderation_component = "avmoderation.<%= public_jitsi %>"
|
|
49
|
+
turncredentials_secret = "<%= turn_sercret %>"
|
|
50
|
+
c2s_require_encryption = false
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
VirtualHost "guest.<%= public_jitsi %>"
|
|
54
|
+
authentication = "anonymous"
|
|
55
|
+
ssl = {
|
|
56
|
+
key = "/usr/share/acme/certs/<%= public_jitsi %>_ecc/<%= public_jitsi %>.key";
|
|
57
|
+
certificate = "/usr/share/acme/certs/<%= public_jitsi %>_ecc/<%= public_jitsi %>.cer";
|
|
58
|
+
}
|
|
59
|
+
modules_enabled = {
|
|
60
|
+
"bosh";
|
|
61
|
+
"websocket";
|
|
62
|
+
"smacks"; -- XEP-0198: Stream Management
|
|
63
|
+
"pubsub";
|
|
64
|
+
"ping";
|
|
65
|
+
"speakerstats";
|
|
66
|
+
"conference_duration";
|
|
67
|
+
"room_metadata";
|
|
68
|
+
"end_conference";
|
|
69
|
+
"muc_lobby_rooms";
|
|
70
|
+
"muc_breakout_rooms";
|
|
71
|
+
"av_moderation";
|
|
72
|
+
"turncredentials";
|
|
73
|
+
}
|
|
74
|
+
main_muc = "muc.<%= public_jitsi %>"
|
|
75
|
+
lobby_muc = "lobby.<%= public_jitsi %>"
|
|
76
|
+
breakout_rooms_muc = "breakout.<%= public_jitsi %>"
|
|
77
|
+
speakerstats_component = "speakerstats.<%= public_jitsi %>"
|
|
78
|
+
conference_duration_component = "conferenceduration.<%= public_jitsi %>"
|
|
79
|
+
end_conference_component = "endconference.<%= public_jitsi %>"
|
|
80
|
+
av_moderation_component = "avmoderation.<%= public_jitsi %>"
|
|
81
|
+
turncredentials_secret = "<%= turn_sercret %>"
|
|
82
|
+
c2s_require_encryption = false
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
VirtualHost "auth.<%= public_jitsi %>"
|
|
86
|
+
ssl = {
|
|
87
|
+
key = "<%= certs_dir %>/<%= public_jitsi %>_ecc/<%= public_jitsi %>.key";
|
|
88
|
+
certificate = "<%= certs_dir %>/<%= public_jitsi %>_ecc/fullchain.cer";
|
|
89
|
+
}
|
|
90
|
+
modules_enabled = {
|
|
91
|
+
"limits_exception";
|
|
92
|
+
}
|
|
93
|
+
authentication = "internal_hashed"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
Component "internal-muc.<%= public_jitsi %>" "muc"
|
|
98
|
+
storage = "memory"
|
|
99
|
+
modules_enabled = {
|
|
100
|
+
"ping";
|
|
101
|
+
}
|
|
102
|
+
restrict_room_creation = true
|
|
103
|
+
muc_room_locking = false
|
|
104
|
+
muc_room_default_public_jids = true
|
|
105
|
+
|
|
106
|
+
Component "muc.<%= public_jitsi %>" "muc"
|
|
107
|
+
restrict_room_creation = true
|
|
108
|
+
storage = "memory"
|
|
109
|
+
modules_enabled = {
|
|
110
|
+
"muc_meeting_id";
|
|
111
|
+
"polls";
|
|
112
|
+
"muc_domain_mapper";
|
|
113
|
+
"muc_password_whitelist";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
-- The size of the cache that saves state for IP addresses
|
|
117
|
+
rate_limit_cache_size = 10000;
|
|
118
|
+
muc_room_cache_size = 1000
|
|
119
|
+
muc_room_locking = false
|
|
120
|
+
muc_room_default_public_jids = true
|
|
121
|
+
muc_password_whitelist = {
|
|
122
|
+
"focus@<no value>"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
Component "focus.<%= public_jitsi %>" "client_proxy"
|
|
126
|
+
target_address = "focus@auth.<%= public_jitsi %>"
|
|
127
|
+
|
|
128
|
+
Component "speakerstats.<%= public_jitsi %>" "speakerstats_component"
|
|
129
|
+
muc_component = "muc.<%= public_jitsi %>"
|
|
130
|
+
|
|
131
|
+
Component "conferenceduration.<%= public_jitsi %>" "conference_duration_component"
|
|
132
|
+
muc_component = "muc.<%= public_jitsi %>"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Component "endconference.<%= public_jitsi %>" "end_conference"
|
|
136
|
+
muc_component = "muc.<%= public_jitsi %>"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Component "lobby.<%= public_jitsi %>" "muc"
|
|
140
|
+
storage = "memory"
|
|
141
|
+
restrict_room_creation = true
|
|
142
|
+
muc_room_locking = false
|
|
143
|
+
muc_room_default_public_jids = true
|
|
144
|
+
modules_enabled = {
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
Component "breakout.<%= public_jitsi %>" "muc"
|
|
149
|
+
storage = "memory"
|
|
150
|
+
restrict_room_creation = true
|
|
151
|
+
muc_room_locking = false
|
|
152
|
+
muc_room_default_public_jids = true
|
|
153
|
+
modules_enabled = {
|
|
154
|
+
"muc_meeting_id";
|
|
155
|
+
"muc_domain_mapper";
|
|
156
|
+
"polls";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Component "metadata.<%= public_jitsi %>" "room_metadata_component"
|
|
161
|
+
muc_component = "muc.<%= public_jitsi %>"
|
|
162
|
+
breakout_rooms_component = "breakout.<%= public_jitsi %>"
|
package/templates/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const {
|
|
2
|
+
mkdirSync, existsSync, writeSync, openSync, close, readFileSync
|
|
3
|
+
} = require("fs");
|
|
4
4
|
const { env } = process;
|
|
5
|
-
const {
|
|
6
|
-
const ARGV = require('minimist')(process.argv.slice(2));
|
|
5
|
+
const { template, isEmpty } = require("lodash");
|
|
7
6
|
|
|
7
|
+
const { resolve, join, dirname } = require("path");
|
|
8
|
+
const { args} = require('./utils')
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
10
11
|
* @param {*} p
|
|
11
12
|
* @returns
|
|
12
13
|
*/
|
|
13
14
|
function chroot(p) {
|
|
14
|
-
let root =
|
|
15
|
+
let root = args.outdir || args.chroot || env.DRUMEE_CONF_BASE;
|
|
15
16
|
if (root) {
|
|
16
17
|
if (p) return join(root, p);
|
|
17
18
|
return join(root);
|
|
@@ -25,7 +26,6 @@ function chroot(p) {
|
|
|
25
26
|
*/
|
|
26
27
|
function makedir(dname) {
|
|
27
28
|
if (!existsSync(dname)) {
|
|
28
|
-
//console.log(`Should make dir ${dname}`);
|
|
29
29
|
mkdirSync(dname, { recursive: true });
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -53,8 +53,9 @@ function render(data, name, parse) {
|
|
|
53
53
|
}
|
|
54
54
|
//console.log("RENDERING", __dirname, name, tpl);
|
|
55
55
|
let str = readFileSync(tpl);
|
|
56
|
+
|
|
56
57
|
try {
|
|
57
|
-
let res =
|
|
58
|
+
let res = template(String(str).toString())(data);
|
|
58
59
|
if (parse && typeof res === "string") {
|
|
59
60
|
return JSON.parse(res);
|
|
60
61
|
}
|
|
@@ -79,14 +80,18 @@ function write(data, fn, tpl_name, chr) {
|
|
|
79
80
|
let d = new Date();
|
|
80
81
|
data.date = d.toISOString().split('T')[0];
|
|
81
82
|
|
|
82
|
-
console.log("Writing config into " + filename);
|
|
83
83
|
let fd = openSync(filename, "w+");
|
|
84
|
-
if (
|
|
85
|
-
console.log(
|
|
84
|
+
if (args.readonly) {
|
|
85
|
+
console.log(`READ ONLY using template ${tpl_name}, fn=${fn}`);
|
|
86
|
+
if (args.readonly > 1) {
|
|
87
|
+
console.log(data);
|
|
88
|
+
console.log("END OF FILE", filename);
|
|
89
|
+
}
|
|
86
90
|
return
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
|
|
93
|
+
console.log("Writing config into " + filename);
|
|
94
|
+
if (isEmpty(tpl_name)) {
|
|
90
95
|
writeSync(fd, data);
|
|
91
96
|
} else {
|
|
92
97
|
writeSync(fd, render(data, tpl_name));
|
|
@@ -98,5 +103,6 @@ function write(data, fn, tpl_name, chr) {
|
|
|
98
103
|
module.exports = {
|
|
99
104
|
write,
|
|
100
105
|
chroot,
|
|
101
|
-
render
|
|
106
|
+
render,
|
|
107
|
+
makedir,
|
|
102
108
|
};
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
const argparse = require("argparse");
|
|
2
|
+
const { existsSync } = require("fs");
|
|
3
|
+
const { readFileSync } = require(`jsonfile`);
|
|
4
|
+
const {
|
|
5
|
+
BACKUP_STORAGE,
|
|
6
|
+
DRUMEE_DATA_DIR,
|
|
7
|
+
DRUMEE_DB_DIR,
|
|
8
|
+
MAX_BODY_SIZE,
|
|
9
|
+
PRIVATE_DOMAIN,
|
|
10
|
+
PRIVATE_IP4,
|
|
11
|
+
PUBLIC_DOMAIN,
|
|
12
|
+
PUBLIC_IP4,
|
|
13
|
+
PUBLIC_IP6,
|
|
14
|
+
DRUMEE_ROOT,
|
|
15
|
+
HTTP_PORT,
|
|
16
|
+
HTTPS_PORT,
|
|
17
|
+
FORCE_INSTALL,
|
|
18
|
+
ADMIN_EMAIL,
|
|
19
|
+
DRUMEE_DESCRIPTION
|
|
20
|
+
} = process.env;
|
|
21
|
+
|
|
22
|
+
const parser = new argparse.ArgumentParser({
|
|
23
|
+
description: "Drumee Infrastructure Helper",
|
|
24
|
+
add_help: true,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
parser.add_argument("--admin_email", {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ADMIN_EMAIL || "admin@localhost",
|
|
30
|
+
help: "Drumee Instance Admin User Email",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
parser.add_argument("--description", {
|
|
34
|
+
type: String,
|
|
35
|
+
default: DRUMEE_DESCRIPTION || "My Drumee Team Server",
|
|
36
|
+
help: "Drumee Instance Description",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
parser.add_argument("--readonly", {
|
|
40
|
+
type: "int",
|
|
41
|
+
default: 0,
|
|
42
|
+
help: "Print content instead of actually writing to files",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
parser.add_argument("--chroot", {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '/',
|
|
48
|
+
help: "Output root. Defaulted to /",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
parser.add_argument("--reconfigure", {
|
|
52
|
+
type: "int",
|
|
53
|
+
default: FORCE_INSTALL || 0,
|
|
54
|
+
help: "Override existing configs",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
parser.add_argument("--outdir", {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '/',
|
|
60
|
+
help: "If set, takes precedent on chroot. Output root. Defaulted to /",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
parser.add_argument("--log-dir", {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '/var/log/drumee',
|
|
66
|
+
help: "Drumee server log location",
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
parser.add_argument("--verbosity", {
|
|
70
|
+
type: "int",
|
|
71
|
+
default: 2,
|
|
72
|
+
help: "Server log level",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
parser.add_argument("--public-domain", {
|
|
76
|
+
type: String,
|
|
77
|
+
default: PUBLIC_DOMAIN,
|
|
78
|
+
help: "Public domain name",
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
parser.add_argument("--private-domain", {
|
|
82
|
+
type: String,
|
|
83
|
+
default: PRIVATE_DOMAIN,
|
|
84
|
+
help: "Private domain name",
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
parser.add_argument("--local-domain", {
|
|
88
|
+
type: String,
|
|
89
|
+
default: PRIVATE_DOMAIN,
|
|
90
|
+
help: "",
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
parser.add_argument("--public-ip4", {
|
|
94
|
+
type: String,
|
|
95
|
+
default: PUBLIC_IP4,
|
|
96
|
+
help: "Public IPV4",
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
parser.add_argument("--public-ip6", {
|
|
100
|
+
type: String,
|
|
101
|
+
default: PUBLIC_IP6,
|
|
102
|
+
help: "Public IPV6",
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
parser.add_argument("--private-ip4", {
|
|
106
|
+
type: String,
|
|
107
|
+
default: PRIVATE_IP4,
|
|
108
|
+
help: "Private IPV4",
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
parser.add_argument("--envfile", {
|
|
112
|
+
type: String,
|
|
113
|
+
help: "Dataset required to install Drumee",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
parser.add_argument("--only-infra", {
|
|
117
|
+
type: "int",
|
|
118
|
+
default: 0,
|
|
119
|
+
help: "If set, write only configs related to infra. Same as no-jitsi",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
parser.add_argument("--localhost", {
|
|
123
|
+
type: "int",
|
|
124
|
+
default: 0,
|
|
125
|
+
help: "If set, write minimal configs, no jitsi, no bind",
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
parser.add_argument("--http-port", {
|
|
129
|
+
type: "int",
|
|
130
|
+
default: HTTP_PORT || 80,
|
|
131
|
+
help: "If set, write minimal configs, no jitsi, no bind",
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
parser.add_argument("--https-port", {
|
|
135
|
+
type: "int",
|
|
136
|
+
default: HTTPS_PORT || 443,
|
|
137
|
+
help: "If set, write minimal configs, no jitsi, no bind",
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
parser.add_argument("--data-dir", {
|
|
141
|
+
type: String,
|
|
142
|
+
default: DRUMEE_DATA_DIR || "/var/lib/drumee/data",
|
|
143
|
+
help: "Partition or directory dedicated to store drumee data",
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
parser.add_argument("--db-dir", {
|
|
147
|
+
type: String,
|
|
148
|
+
default: DRUMEE_DB_DIR || "/var/lib/mysql",
|
|
149
|
+
help: "Partition or directory dedicated to store drumee database",
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
parser.add_argument("--system-user", {
|
|
153
|
+
type: String,
|
|
154
|
+
default: "www-data",
|
|
155
|
+
help: "System user used to run Drumee",
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
parser.add_argument("--system-group", {
|
|
159
|
+
type: String,
|
|
160
|
+
default: "www-data",
|
|
161
|
+
help: "System group used to run Drumee",
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
parser.add_argument("--watch-dirs", {
|
|
165
|
+
type: String,
|
|
166
|
+
default: null,
|
|
167
|
+
help: "pm2 watch directories",
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
parser.add_argument("--watch-delay", {
|
|
171
|
+
type: 'int',
|
|
172
|
+
default: 1000,
|
|
173
|
+
help: "pm2 watch delay",
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
parser.add_argument("--watch-symlinks", {
|
|
177
|
+
type: 'int',
|
|
178
|
+
default: 0,
|
|
179
|
+
help: "pm2 watch delay",
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
parser.add_argument("--watch-ignore", {
|
|
183
|
+
type: String,
|
|
184
|
+
default: null,
|
|
185
|
+
help: "pm2 ignore directories",
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
parser.add_argument("--drumee-root", {
|
|
189
|
+
type: String,
|
|
190
|
+
default: DRUMEE_ROOT || "/var/lib/drumee",
|
|
191
|
+
help: "Drumee main base",
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
parser.add_argument("--no-jitsi", {
|
|
196
|
+
type: "int",
|
|
197
|
+
default: 0,
|
|
198
|
+
help: "If set, won't write configs related to jisit. Same as only-infra",
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
parser.add_argument("--max-body-size", {
|
|
202
|
+
type: String,
|
|
203
|
+
default: MAX_BODY_SIZE || '10G',
|
|
204
|
+
help: "If set, won't write configs related to jisit. Same as only-infra",
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
parser.add_argument("--backup-storage", {
|
|
208
|
+
type: String,
|
|
209
|
+
default: BACKUP_STORAGE || '10G',
|
|
210
|
+
help: "If set, the partition or directiry will used to backup Drumee data",
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const args = parser.parse_args();
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
218
|
+
function hasExistingSettings(envfile = '/etc/drumee/drumee.json') {
|
|
219
|
+
if (!existsSync(envfile)) return false;
|
|
220
|
+
const { domain_name } = readFileSync(envfile);
|
|
221
|
+
if (!domain_name) return false;
|
|
222
|
+
if (args.reconfigure == 1) {
|
|
223
|
+
console.log(
|
|
224
|
+
`There is already a Drumee instance installed on this server but you selected reconfigure\n`,
|
|
225
|
+
`ALL EXISTING DATA related to ${domain_name} WILL BE LOST\n`,
|
|
226
|
+
);
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
console.log(
|
|
230
|
+
`There is already a Drumee instance installed on this server\n`,
|
|
231
|
+
`domain name = ${domain_name}\n`,
|
|
232
|
+
`Use --reconfigure=1 \n`,
|
|
233
|
+
`********************************************\n`,
|
|
234
|
+
`* WARNING : ALL EXISTING DATA WILL BE LOST *\n`,
|
|
235
|
+
`********************************************\n`,
|
|
236
|
+
);
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
module.exports = { args, parser, hasExistingSettings };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$TTL 3D
|
|
2
|
+
$ORIGIN <%= private_reverse_ip4 %>.
|
|
3
|
+
;
|
|
4
|
+
@ IN SOA ns1.<%= private_domain %>. master.<%= private_domain %>. (
|
|
5
|
+
<%= serial %> ; serial, today date + today serial
|
|
6
|
+
1H ; refresh, seconds
|
|
7
|
+
2H ; retry, seconds
|
|
8
|
+
4W ; expire, seconds
|
|
9
|
+
1D ) ; minimum, seconds
|
|
10
|
+
;
|
|
11
|
+
;
|
|
12
|
+
@ IN NS ns1.<%= private_domain %>.
|
|
13
|
+
@ IN NS ns2.<%= private_domain %>.
|
|
14
|
+
|
|
15
|
+
2 IN PTR ns1.<%= private_domain %>.
|
|
16
|
+
3 IN PTR ns2.<%= private_domain %>.
|
|
17
|
+
3 IN PTR smtp.<%= private_domain %>.
|