More documentation.
[monikop.git] / doc / monikop.muse
blobee5341f144eb2b490a5afa87ac87ad35ffa10fd5
1 * Purpose
3 Suppose we have an isolated network of data producing computers
4 (Sources), e.g. in a surveying vehicle (Rover). The collected data (a
5 few Terabytes per day) need to be transferred to a processing server
6 (Destination) in office.
8 This data transfer, which happens my means of removable disks, is our
9 job.
11 On Rover, the disks are put into a dedicated computer where they are
12 filled automatically by Monikop with data pulled from Sources.
14 The disks are then carried to the office and put into another
15 dedicated computer. Here, Monikop's counterpart called Pokinom pushes
16 their content to Destination and makes the disks re-usable by
17 Monikop. 
19 The heavy lifting is done by rsync. Sources as well as Destinnation
20 need to have rsync servers installed.
22  - Transfer rates ca. ...
25 * Installation
27  1. Debian packages to use
29    - to install from a git repository: git-core
31    - to run Monikop and Pokinom: 
32      rsync, mingetty, sudo, libcurses-perl, libfile-rsync-perl,
33      mingetty
35    - to run the tests: bc, time
37  1. Create a user on both Monikop's and Pokinom's machine. For
38     descriptions sake, we assume they're called m-operator.
40  1. Get Monikop (and Pokinom); from m-operator's home directory say:
42    =git-clone (FIXME: repo here)=
44  1. Copy =monikop.config.example= to =monikop.config= and
45     =pokinom.config.example= to =pokinom.config=, respectively, and
46     adapt them according to your needs. Both have helpful comments,
47     and both are perl code, so be careful and keep the interpunction
48     in place. 
50     Things you want to change are
52     - for Monikop in =monikop.config=
54        <src lang="perl">
55        # Possible data sources, and by what directory name to represent them in
56        # destination.
57        # When the latter is not unique, care must be taken that all pathnames in the 
58        # respective sources are unique.
59        %sources = (
60            'data_producer1::data' => 'p1',
61            'data_producer2::data' => 'p2',
62            'data_producer3::data' => '',
63            'data_producer4::data' => '',
64            );
65        
66        # Possible mount points of data destinations. Must be unique.
67        @usable_mount_points = (
68            '/media/disk_1',
69            '/media/disk_2',
70            '/media/disk_3',
71            );
72        </src>
74     - for Pokinom
76      <src lang="perl">
77      # Possible mount points. Must be unique in their tails after rightmost /.
78      @possible_mount_points = (
79          '/media/disk_1',
80          '/media/disk_2',
81          '/media/disk_3',
82          );
83      </src>
85 ** Automatic login (Monikop and Pokinom):
87 =/etc/inittab=: change line which says
89 <src lang="conf">
90 1:2345:respawn:/sbin/getty 38400 tty1
91 </src>
93 into
95 <src lang="conf">
96 1:2345:respawn:/sbin/mingetty --autologin m-operator --noclear tty1
97 </src>
99 ** Autostart (Monikop and Pokinom):
100    Append to =~/.profile= (create if necessary):
101    <src lang="bash">
102    /home/m-operator/monikop/monikop
103    </src>
104    or
105    <src lang="bash">
106    /home/m-operator/monikop/pokinom,
107    respectively.
108    </src>
110    If necessary, specify path to config file, e.g.  
111    <src lang="bash">
112    /home/m-operator/monikop/monikop /home/m-operator/monikop/monikop.config
113    </src>
115 ** Removable disks
116    - Create Filesystems. Example (suppose disk tagged disk_10 is attached to /dev/sdg1):
118      =mke2fs -j -L disk_10 /dev/sdg1=
120    - =/etc/fstab=:
121      <src lang="conf">
122      ## System partitions ###
123      LABEL=root     /               ext3  defaults,errors=remount-ro 0  1
124      LABEL=swap     none            swap  sw                         0  0
125      ## Removable disks                   
126      LABEL=disk_01  /media/disk_01  ext3  rw,user,auto               0  0
127      LABEL=disk_02  /media/disk_02  ext3  rw,user,auto               0  0
128      # etc
129      </src>
131    - Make sure system boots actually from the system disk rather than from some removable one:
133      Change =/boot/grub/menu.lst= where is says
134      <code># kopt=root=...</code>:
135      <src lang="conf">
136      ### BEGIN AUTOMAGIC KERNELS LIST
137      ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
138      ## by the debian update-grub script except for the default options below
139      
140      ## DO NOT UNCOMMENT THEM, Just edit them to your needs
141      
142      ## ## Start Default Options ##
143      ## default kernel options
144      ## default kernel options for automagic boot options
145      ## If you want special options for specific kernels use kopt_x_y_z
146      ## where x.y.z is kernel version. Minor versions can be omitted.
147      ## e.g. kopt=root=/dev/hda1 ro
148      ##      kopt_2_6_8=root=/dev/hdc1 ro
149      ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
150      # kopt=root=/dev/disk/by-label/root noresume ro
151      </src>
153      and call:
155      =update-grub=
157 ** Authorize m-operator to shut down computer
159 Use =visudo= to change =/etc/sudoers=; add:
161    <src lang="conf">
162    messung ALL=(ALL) NOPASSWD: /sbin/halt -p
163    messung ALL=(ALL) NOPASSWD: /sbin/reboot
164    </src>
166 ** Network setup
168 *** Monikop
170     - =/etc/hosts=
171       <src lang="conf">
172       127.0.0.1      localhost
173       192.168.200.10 central
174       192.168.178.20 nav
175       192.168.200.30 front
176       192.168.178.40 data
177       192.168.200.50 rear-left
178       192.168.200.60 rear-right
179       192.168.200.70 scanner
180       </src>
182     - =/etc/network/interfaces=
183       <src lang="conf">
184       # The loopback network interface
185       auto lo
186       iface lo inet loopback
187       
188       # central
189       allow-hotplug eth1
190       iface eth1 inet static
191          address 192.168.200.9
192          netmask 255.255.255.248
193       
194       # switch
195       allow-hotplug eth2
196       iface eth2 inet static
197          address 192.168.178.40
198          netmask 255.255.240.0
199          gateway 192.168.180.169
200       
201       # front
202       allow-hotplug eth3
203       iface eth3 inet static
204          address 192.168.200.29
205          netmask 255.255.255.248
206       
207       # rear-left
208       allow-hotplug eth4
209       iface eth4 inet static
210          address 192.168.200.49
211          netmask 255.255.255.248
212       
213       # rear-right
214       allow-hotplug eth5
215       iface eth5 inet static
216          address 192.168.200.59
217          netmask 255.255.255.248
218       
219       # scanner
220       allow-hotplug eth6
221       iface eth6 inet static
222          address 192.168.200.69
223          netmask 255.255.255.248
224       </src>
226     - Provide for non-overlapping subnets. (http://jodies.de/ipcalc may be helpful.)
228 *** Data sources
230     - Windows: Location of =/etc/hosts/=: =%SystemRoot%\system32\drivers\etc\hosts=
232     - IP address 192.168.200.60
233     - Subnet mask 255.255.255.248
235     - =/etc/hosts=:
237     <src lang="conf">
238       127.0.0.1      localhost
239       192.168.178.10 central
240       192.168.178.20 nav
241       192.168.178.30 front
242       192.168.178.40 data
243       192.168.178.50 rear-left
244       192.168.178.60 rear-right
245       192.168.178.70 scanner
246     </src>
248     - =rsyncd.conf=:
250     (click Start, Programs, csRsyncServer, rsyncd.conf)
251     <src lang="conf">
252     use chroot = false
253     strict modes = false
254     hosts allow = *
255     logfile = rsyncd.log
256     [log]
257     #   /cygdrive/e/log stands for E:\log
258         path = /cygdrive/e/log
259         read only = false
260         transfer logging = false
261     </src>
262         <src lang="conf">
263        pid file=/var/run/rsyncd.pid
264        [log]
265            path = /media/platte_03
266            use chroot = yes
267            lock file = /var/lock/rsyncd
268            read only = yes
269            list = yes
270            uid = nobody
271            gid = nogroup
272            strict modes = yes
273            ignore errors = no
274            ignore nonreadable = yes
275            transfer logging = no
276         </src>
278 *** Pokinom
281 *** Data destination
283 ** Rsync server installation
285     - Linux
287     =/etc/default/rsync=:
288     Change line from
289     <src lang="conf">
290     RSYNC_ENABLE = false
291     </src>
292     to
293     <src lang="conf">
294     RSYNC_ENABLE = true
295     </src>
296     =/etc/rsyncd.conf:=
298     <src lang="conf">
299      gid = str_db1_media
300      use chroot = yes
301      max connections = 0
302      pid file = /var/run/rsyncd.pid
303      
304      [media]
305              path = /mnt/./data0
306              list = no
307              comment = Pokinom only (requires authentication)
308              read only = no
309              incoming chmod = g+r,g+w
310              write only = yes
311              # Pokinom's IP:
312              hosts allow = 192.168.180.120
313              auth users = m-operator
314              secrets file = /etc/rsyncd.secrets
315     </src>
317     =/etc/rsyncd.secrets=:
319     <src lang="conf">
320     m-operator:seCreT
321     </src>
323     Data source (rover)
324     Data destination (office)
326     - Windows
328     install cwrsync:
329     http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download
330     rsyncd.conf
331     Service rsync: autostart
333 * Usage
335    - You have to be able to tell from your data if it's complete.
336    - Monikop shows which disks have data and therefore should be
337      transferred to Pokinom.
338    - Monikop keeps starting over until shutdown or until disappearance
339      or data source(s)
340    - Pokinom needs sufficient amount of free space on sink; must be
341      rebooted once this is not the case.
342    - fsck-monikop: to be run by root
343    - Backup functionality: data remains on disks until re-inserted in
344      Monikop.
346 * Bugs
348   - Data must not contain any directories called $rsync_partial_dir_name
349   - Doesn't reflect disappearance of files on sources
350   - May ignore empty dirs (really?)
351