add warning about filters and set/skimmer
[spider.git] / UPGRADE.mojo
1 8th July 2020
2 -------------
3
4 There are the notes for upgrading to the mojo branch. PLEASE NOTE THERE HAVE BEEN CHANGES 
5 FOR all MOJO BRANCH USERS. See APPENDIX(i) at the end of this document.
6
7 There is NO POINT in doing this at the moment unless you are running a node with many (>50)
8 users. It is the future, but at the moment I am testing larger and larger installations to
9 check that it a) still works as people imagine it should and b) it provides the improvement
10 in scaling that I am anticipating. There are no significant new features - yet. 
11
12 The BIG TICKET ITEM in this branch is that (potentially) "long lived" commands such as sh/dx
13 and commands that poll external internet resources now don't halt the flow of data through
14 the node. I am also using a modern, event driven, web socket "manager" called Mojolicious
15 which is considerably more efficient than what went before (but is not necessary for small
16 nodes). There are some 200-400 user nodes out there that will definitely see the difference
17 in terms of both CPU usage and general responsiveness. Using Mojolicious also brings the
18 tantalising possibility of grafting on a web frontend, as it were, to the "side" of a
19 DXSpider node. But serious work on this won't start until we have a stable base to work
20 on. Apart from anything else there will, almost certainly, need to be some internal data
21 structure reorganisation before a decent web frontend could be constructed.
22
23 *IMPORTANT* There is an action needed to go from mojo build 228 and below. See items marked
24 *IMPORTANT* below. 
25
26 Upgrading is not for the faint of heart. There is no installation script (but there
27 will be) so, for the time being, you need to do some manual editing. Also, while there is
28 a backward path, it will involve moving various files from their new home (/spider/local_data),
29 back to where they came from (/spider/data).
30
31 Prerequisites:
32
33         A supply of good, strong tea - preferably in pint mugs. A tin hat, stout boots, a
34         rucksack with survival rations and a decent miners' lamp might also prove comforting. I
35         enclose this link: http://www.noswearing.com/dictionary in case you run out of swear words.
36
37         An installed and known working git based installation. Mojo is not supported under CVS or
38         installation from a tarball. 
39
40         perl 5.10.1, preferably 5.14.1 or greater. This basically means running ubuntu 12.04 or
41         later (or one of the other linux distros of similar age or later). The install instructions are
42         for debian based systems. IT WILL NOT WORK WITHOUT A "MODERN" PERL. Yes, you can use
43         bleadperl if you know how to use it and can get it to run the node under it as a daemon
44         without resorting the handy URL supplied above. Personally, I wouldn't bother. It's
45         easier and quicker just to upgrade your linux distro. Apart from anything else things like ssh
46         ntpd are broken on ALL older systems and will allow the ungodly in more easily than something
47         modern.
48
49 Install cpamminus:
50
51         sudo apt-get install cpanminus
52 or
53     wget -O - https://cpanmin.us | perl - --sudo App::cpanminus
54 or
55         sudo apt-get install curl
56         curl -L https://cpanmin.us | perl - --sudo App::cpanminus
57
58 You will need the following CPAN packages:
59
60         If you are on a Debian based system (Devuan, Ubuntu, Mint etc) that is reasonably new (I use Ubuntu
61         18.04 and Debian 10) then you can simply do:
62
63         sudo apt-get install libev-perl libmojolicious-perl libjson-perl libjson-xs-perl libdata-structure-util-perl libmath-round-perl
64
65     or on Redhat based systems you can install the very similarly (but not the same) named
66         packages. I don't know the exact names but using anything less than Centos 7 is likely to cause
67         a world of pain. Also I doubt that EV and Mojolicious are packaged for Centos at all.
68
69         If in doubt or it is taking too long to find the packages you should build from CPAN. Note: you may
70         need to install the essential packages to build some of these. At the very least you will need
71         to install 'make' (sudo apt-get install make) or just get everything you are likely to need with:
72         
73         sudo apt-get install build-essential.
74
75         sudo cpanm EV Mojolicious JSON JSON::XS Data::Structure::Util Math::Round
76         
77         # just in case it's missing (top, that is)
78         sudo apt-get install procps
79
80 Please make sure that, if you insist on using operating system packages, that your Mojolicious is
81 at least version 7.26. Mojo::IOLoop::ForkCall is NOT LONGER IN USE! The current version at time
82 of writing is 8.36.
83
84 Login as the sysop user.
85
86 Edit your /spider/local/DXVars.pm so that the bottom of the file is changed from something like:
87
88 ---- old ----
89
90          # the port number of the cluster (just leave this, unless it REALLY matters to you)
91          $clusterport = 27754;
92
93          # your favorite way to say 'Yes'
94          $yes = 'Yes';
95
96          # your favorite way to say 'No'
97          $no = 'No';
98
99          # the interval between unsolicited prompts if not traffic
100          $user_interval = 11*60;
101
102          # data files live in 
103          $data = "$root/data";
104
105          # system files live in
106          $system = "$root/sys";
107
108          # command files live in
109          $cmd = "$root/cmd";
110
111          # local command files live in (and overide $cmd)
112          $localcmd = "$root/local_cmd";
113
114          # where the user data lives
115          $userfn = "$data/users";
116
117          # the "message of the day" file
118          $motd = "$data/motd";
119
120          # are we debugging ?
121          @debug = qw(chan state msg cron );
122
123 ---- to this: ----
124
125          # the port number of the cluster (just leave this, unless it REALLY matters to you)
126          $clusterport = 27754;
127
128          # your favorite way to say 'Yes'
129          $yes = 'Yes';
130
131          # your favorite way to say 'No'
132          $no = 'No';
133
134          # this is where the paths used to be which you have just removed
135          
136          # are we debugging ?
137          @debug = qw(chan state msg cron );
138
139 ---- new  ------
140
141 There may be other stuff after this in DXVars.pm, that doesn't matter. The point is to remove
142 all the path definitions in DXVars.pm. If this isn't clear to you then it would be better if
143 you asked on dxspider-support for help before attempting to go any further.
144
145 One of the things that will happen is that several files currently in /spider/data will be
146 placed in /spider/local_data. These include the user, qsl and usdb data files, the band and
147 prefix files, and various "bad" data files. I.e. everything that is modified from the base
148 git distribution. 
149
150 Now run the console program or telnet localhost and login as the sysop user.
151
152         export_users
153         bye
154
155 as the sysop user:
156
157    sudo service dxspider stop
158    or
159    sudo systemctl stop dxspider
160
161 having stopped the node:
162
163    mkdir /spider/local_data
164    git reset --hard
165    git pull
166    git checkout --track -b mojo origin/mojo
167
168 if you have not already done this:
169
170    sudo ln -s /spider/perl/console.pl /usr/local/bin/dx
171    sudo ln -s /spider/perl/*dbg /usr/local/bin
172
173 Now in another window run:
174
175         watchdbg
176
177 and finally:
178
179    sudo service dxspider start
180    or
181    sudo service systemctl start dxspider
182
183 You should be aware that this code base is now under active development and, if you do a 'git pull',
184 what you get may be broken. But, if this does happen, the likelihood is that I am actively working
185 on the codebase and any brokenness may be fixed (maybe in minutes) with another 'git pull'.
186
187 I try very hard not to leave it in a broken state...
188
189 Dirk G1TLH
190
191 APPENDIX(i)
192
193 With this revrsion of the code, the users.v3 file will be replaced with users.v3j. This is a reversable 
194 change. Simply revert to the previous revision, and email me, should anything go wrong. On restarting 
195 the node, the users.v3j file will be generated from the users.v3 file. The users.v3 file is not changed. 
196 The process of generation will take up to 30 seconds depending on the number of users in your file,
197 the speed of your disk(s) and the CPU speed (probably in that order. On my machine, it takes about 5
198 seconds, on an RPi??? 
199
200 Part of this process may clear out some old records or suggest that there might errors. DO NOT BE 
201 ALARM. This is completely normal. 
202
203 This change not only should make the rebuilding of the users file (much) less likely, but tests suggest
204 that access to the users file is about 2.5 times quicker. How much difference this makes in practise 
205 remains to be seen. 
206
207 When you done this, in another shell, run /spider/perl/create_dxsql.pl. This will convert the DXQSL 
208 system to dxqsl.v1j (for the sh/dxqsl <call> command). When this is finished, run 'load/dxqsl' in 
209 a console (or restart the node, but it isn't necessary).
210
211
212