linx-simulator2/README.md

148 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2020-04-09 14:21:57 +00:00
## Has been <u>tested</u> and <u>developed</u> using:
> ubuntu 16.04.6<br/>
> openssl: 1.0.2g<br/>
2020-04-09 14:19:31 +00:00
> node: 8.16.0
2019-09-18 08:11:16 +00:00
2020-04-09 14:21:57 +00:00
## Requirements:
2020-08-03 11:12:14 +00:00
```sh
curl -sL [https://deb.nodesource.com/setup_8.x](https://deb.nodesource.com/setup_8.x) | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
install python 2.7
rm package-lock.json && rm -rf node_modules && rm -rf ~/.node-gyp only **(if package-lock.json/node_modules or node was installed)**
sudo apt-get install libasound2-dev
sudo npm i -g node-gyp
sudo npm install --unsafe-perm
```
## How to guide how to configure units and the simulator
2020-08-03 11:23:31 +00:00
2020-08-03 11:12:14 +00:00
<br/>
**1. Insert Groups** <br/>
Groups will be inserted using the following script directly on the database:
```sql
set search_path to public;
do $$
2020-04-09 14:21:57 +00:00
2020-08-03 11:12:14 +00:00
declare i INTEGER := 1;
declare sipid integer;
declare ressql varchar;
declare acc_id integer = 1;
2020-08-05 09:50:50 +00:00
declare number_of_groups INTEGER := 50; -- How many groups we create
2020-08-03 11:12:14 +00:00
declare dispatcher_name varchar := 'Dispatcher Sergiu';
2020-08-05 09:50:50 +00:00
declare groups_name varchar := 'sergiu-sim-';
2020-08-03 11:12:14 +00:00
BEGIN
-- Create groups
WHILE i <= number_of_groups LOOP
SELECT get_new_sipid(acc_id) INTO sipid;
SELECT insert_update_groups(acc_id, Null, groups_name || i, '1', '1', '0', '0', '0', sipid, 0,'','') INTO ressql;
i = i + 1;
2020-08-05 09:50:50 +00:00
raise notice '%', sipid; --
raise notice '%', i; --
raise notice '%', ressql; --
2020-08-03 11:12:14 +00:00
end loop;
-- Assign dispatcher on the groups
insert into public.asset_group (asset_id, group_id)
select (select id from public.asset where name = dispatcher_name), id from public."group" g where name like groups_name || '%';
end; $$;
```
2020-08-03 11:23:31 +00:00
2020-08-03 11:12:14 +00:00
<br/>
**2. Insert units** <br/>
The units will be inserted from the provisioning(**Units -> Import from file**) and the **file_name.xlsx** file will have the following format:
2020-08-03 11:28:26 +00:00
![FILE.XLSX Format](./doc/units-xlsx.png)
2020-08-03 11:23:31 +00:00
2020-08-03 11:12:14 +00:00
<br/>
2020-08-03 11:29:55 +00:00
**3. Simulator configuration:** <br/>
For the simulation to simulate **in a period**, we must put the **testing_period setting in settings** (the value is in milliseconds).<br/>
2020-08-03 11:12:14 +00:00
Example in **config**:<br/>
```toml
2020-08-05 09:50:50 +00:00
[mumble]
port = '5668'
host = '10.120.1.169'
[hub]
address = 'https://10.120.1.169/'
[elogs]
name = '169'
[api]
port = ''
host = '10.120.1.169/api'
use_secure = true
accept_untrusted_certs = true
2020-08-03 11:12:14 +00:00
[settings]
2020-08-05 09:50:50 +00:00
max_fails = 20
2020-08-03 11:12:14 +00:00
send_voice = true
send_gps = true
2020-08-05 09:50:50 +00:00
gps_report_interval = 10000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802
2020-08-03 11:12:14 +00:00
gps_lng_start_point = 24.776126
2020-08-05 09:50:50 +00:00
testing_period = 1500
[assets]
# linx-simulator-1 - linx-simulator-10
# ids = [15,16,17,18,19,20,21,22,23,24]
# linx-simulator-1 - linx-simulator-25
# ids = [
# 15,16,17,18,19,20,21,22,23,24,
# 25,26,27,28,29,30,31,32,33,34,
# 35,36,37,38,39
# ]
# linx-simulator-1 - linx-simulator-50
ids = [
15,16,17,18,19,20,21,22,23,24,
25,26,27,28,29,30,31,32,33,34,
35,36,37,38,39,40,41,42,43,44,
45,46,47,48,49,50,51,52,53,54,
55,56,57,58,59,60,61,62,63,64
]
[sounds]
sound = 'sound.mp3'
#sound = 'file_example_MP3_700KB.mp3'
sounds_total_number = 1
2020-08-03 11:12:14 +00:00
```
<br/>
**4. To start the simulator** <br/>
To start the simulator we must specify which config file we want to use.
```
NODE_TLS_REJECT_UNAUTHORIZED='0' node ./index.js --path="./config/169/"
2020-08-03 11:12:14 +00:00
```
2020-08-05 09:50:50 +00:00
## Problems you may encounter
<br/>
**1.** If you want to create groups, make sure you have enough free space on that account. If you do not have enough space you can use the following script (you must change the id to match your account)
```sql
set search_path to public;
DO $BODY$
BEGIN
UPDATE license SET max_assets = 1000, max_dispatch = 1000, max_talk_groups = 1000
WHERE id = 1;
UPDATE license SET crc = md5(coalesce(max_assets, 0)::text ||
coalesce(max_talk_groups, 0)::text ||
coalesce(max_dispatch, 0)::text ||
coalesce(to_char(expires_on at time zone 'utc','YYYY-MM-DD"T"HH24:MI:SS'), '1970-01-01T00:00:00')::text ||
coalesce(to_char(maintenance_end at time zone 'utc','YYYY-MM-DD"T"HH24:MI:SS') , '1970-01-01T00:00:00')::text
)::varchar
WHERE id = 1;
END;
$BODY$;
```
**2.** To start the server on a private system the setting is required:
```sh
NODE_TLS_REJECT_UNAUTHORIZED='0'
```
otherwise you will receive the error: **Error: self signed certificate**