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