Subversion Repositories DevTools

Rev

Rev 4456 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1038 dpurdie 1
Notes on the blat package transfer system
2
-----------------------------------------
3
 
4
Reason for its creation
5
-----------------------
6
Need to transfer packages from dpkg_archive to remote sites in a timely manner.
7
Rsync was considered but it has several problems:
8
 
9
1) Does not handle symlinks in a suitable manner
10
2) Works with all the files in the repository. Experience has
11
   shown that this can be very slow
12
3) Still requires significant scripting in order to be useful
13
 
14
Blat can make several assumptions about the package system.
15
Blat will:
16
    Support multiple transfer target destinations
17
    Allow for rapid detection of new packages that need to be transferred
18
    Allow for multiple Releases to be synchronized
19
    Allow for all (not-closed) releases in a Project to be synchronized
20
    Easily configured - and can be configured on the fly
21
    Atomically transfer packages
22
    Transfer a PackageList for future cleanup operations
23
    Logging and debug facilities
24
 
25
Overview of Blat
26
---------------
1042 dpurdie 27
There are three main components in Blat
1038 dpurdie 28
    Daemon supervisor
29
        Responsible for start and restarting configured daemons
30
    Transfer Daemons
31
        Responsible for the package sync operations for one target
32
        Multiple Daemons ( targets ) are supported
1042 dpurdie 33
    On Target utilities
34
        A set of scripts that support Blat
35
        These are transferred to the target machine.
1038 dpurdie 36
 
37
Each Blat Daemon performs three main operations
38
    1) Fast package transfer
39
    2) Repository synchronization
40
    3) PackageList creation
1042 dpurdie 41
    4) Package aging (Optional)
1038 dpurdie 42
 
1042 dpurdie 43
Each Blat target can perform the following:
44
    1) Package aging
45
    2) dpkg_archive content indexing
46
 
1038 dpurdie 47
Fast package transfer
48
===============================
49
This is mechanism whereby Blat will detect the need to transfer a newly built
50
package to the target system.
51
 
52
It works by monitoring a directory of tags. It is the responsibility of Release
53
Manager to populate the directory.
54
 
55
The responsiveness of the detection can be configured, but a period of 5
56
seconds is suggested.
57
 
58
Repository synchronization
59
===============================
60
The daemon will request a list of packages that are present on the target and
61
determine the list of packages that should be on the target. Discrepancies will
62
be transferred to the target. Excess packages are left on the target.
63
 
64
Blat will request the target to create and transfer a list of packages.
65
This is done by invoking a small program on the target to perform the work.
66
 
67
Blat will interrogate the Release Manager database for Releases to be processed
68
and packages in those Releases.
69
 
70
A package will be transferred to the target if:
71
    * The package is required, but not present on the target
72
    * The time-stamps of the descpkg files differ
73
 
74
Package transfer may be delayed if the source package is writable, unless it
75
has been writable for longer than a configured time period.
76
 
77
The frequency of the Repository synchronization can be configured. A time of
78
several hours is suggested.
79
 
80
 
81
PackageList creation
82
===============================
83
Blat will create and send to the target a list of package-version that are
84
in the current set. This list may be used to clean out the package archive,
85
but this functionality has not yet been implemented.
86
 
1042 dpurdie 87
Package aging
88
=============
89
Blat can be configured to delete packages that are no longer a part of the
90
current package-version set. There are 4 methods:
1038 dpurdie 91
 
1042 dpurdie 92
1) None
93
   Packages will never be deleted by Blat on the target.
94
   The target file system will need to be managed to prevent it filling up.
95
 
96
2) Immediate
97
   Packages will be deleted as soon as they are not a part of the current
98
   package-version set.
99
 
100
3) Aged by blat master
101
   Packages will be marked for deletion and the blat master will delete
102
   the packages after a configured number of days.
103
 
104
4) Aged by blat target
105
   Packages will be marked for deletion and the blat target will delete
106
   the packages after a configured number of days. This operation requires
107
   that a cron job be configured on the target machine.
108
 
109
dpkg_archive content indexing
110
=============================
111
Blat provides a utility that can be run by the transfer target, as a cron job,
112
that will maintain a list of files and folders in the package archive.
113
 
114
This list greatly simplifies the process of locating a file in the archive.
115
The user simply greps the package list, rather than search the directory tree.
116
 
117
The file list is in a file .../dpkg_archive/.dpkg_archive/dpkg_archive_list.txt
118
 
119
 
1038 dpurdie 120
Host System Requirements
121
========================
122
1) Unix
123
   It has been designed for a Unix environment - not Windows
124
2) Perl
125
   Blat is written in Perl
126
3) Java
127
   Required for the Database interface
128
4) Shell
129
   Start and stop scripts are in shell
130
5) Utilities
131
    ssh
132
    gtar
133
    gzip
134
 
135
Target System Requirements
136
========================
137
1) Unix
138
   It has been designed for a Unix environment - not Windows
139
2) Perl
140
3) Shell
6320 dpurdie 141
   Blat will execute a number of scripts on the target in order
142
   to control the process. These are in Shell and Perl
1038 dpurdie 143
4) Utilities
144
    ssh
145
    gtar
146
    gunzip
6320 dpurdie 147
5) User with write access to the dpkg_archive - (pkgadmin)
1038 dpurdie 148
6) Link for the users home directory to the package archive
149
   This link is called 'dpkg_archive'
150
 
151
Shared requirements
152
===================
153
Blat uses ssh for the transfer process. It uses an 'identity' file to allow
154
passwordless authentication with the target. The public part of the identify
155
file must be appended to the target users .ssh/authorized_keys file.
156
 
157
The private part of the identity file is held by the Blat Daemon.
158
 
159
Design assumptions
160
================================================================================
161
Blat is designed to transfer dpkg_archive packages in one direction.
162
 
163
Blat makes assumptions on the structure of a package
164
    - They contain a descpkg file
165
    - They are read-only when fully released
166
    - The contents of packages does not change
167
    - It is not necessary to check every file in the package
168
 
169
The Blat master is designed to run in a single directory tree.
170
The config file should be in a 'config' directory under the location
171
of the blat master program.
172
 
173
Installation :: Target System
174
=============================
1042 dpurdie 175
1) Create or acquire a user that has write access to the package archive
1038 dpurdie 176
 
1042 dpurdie 177
2) Create or acquire a passwordless identity file and associated public key
1038 dpurdie 178
   of the identity file. One set is available in the 'ssh' subdirectory.
179
 
1042 dpurdie 180
   Append the public part of the identity file (id_rsa_pkg_admin.pub) to
1038 dpurdie 181
   ~/.ssh/authorized_keys
182
 
1048 dpurdie 183
   I suggest using 'ssh-copy-id'.
184
 
1038 dpurdie 185
3) Create a link from the users home directory to dpkg_archive
186
   The must be called dpkg_archive
187
 
1042 dpurdie 188
4) Transfer the blat receiver scripts to a directory accessible to the
1038 dpurdie 189
   transfer user. ie: ~/bin
1042 dpurdie 190
   The required receiver files are:
1038 dpurdie 191
        get_plist.pl
192
        receive_file
193
        receive_package
194
        delete_package
1042 dpurdie 195
        pkg_mon.pl
196
        pkg_purge.pl
197
   Ensure the programs are executable by the transfer user.
6320 dpurdie 198
   Only get_plist.pl is really needed. The others will be transferred
199
   when detected missing. 
1038 dpurdie 200
 
1042 dpurdie 201
5) Set up cron jobs (optional)
202
   Will be used to maintain package information
203
   Suggest crontab entry - may vary for each installation
204
 
1464 dpurdie 205
 
206
 
1042 dpurdie 207
 
1038 dpurdie 208
Installation :: Host System
209
=============================
210
This section really deals with the configuration of a new target.
211
 
212
1) Create a new config file in Blat's config directory - with a .conf
213
   suffix. This is best done by cloning an existing entry.
214
 
215
   Note: The blat master will automatically spawn a daemon as soon
216
   as a new config file is seen. Its best to create the file elsewhere
217
   and copy it to the directory when ready.
218
 
219
   Note: The Blat daemon will detect changes to its own config file and
220
   re-read it on the fly.
221
 
222
Useful Tricks
223
=============
224
 
225
kill -usr1 pid-of-daemon
226
    Will force the daemon to perform a repository sync check.
227
 
228
kill -hup pid-of-daemon
229
    Will force the daemon to roll its own log files
230
 
3847 dpurdie 231
kill pid-of-daemon
232
    Will force the daemon to exit. It will be restarted.
233
 
234
Remove the daemons pid file
235
    Will force the daemon to exit. It will be restarted.
236
    Useful for debugging on a live system
237
 
238
kill -usr1 pid_of_master
239
    Will signal -usr1 to all daemons
240
    Will force all daemons to perform a repository sync check.
241
 
242
kill -hup pid_of_master
243
    Will signal -hup to all daemons
244
    Will force all daemon to roll their own log files
245
 
246
kill pid_of_master
247
    Will shut down system gracefully by sending kill to all
248
    children.
249
 
1038 dpurdie 250
Debug verbosity is controlled via the 'verbose' config item
251
 
252
The pkg.xxxx config items are very special.
1042 dpurdie 253
If the named package-version is a symlink, then both the
254
link and the package addresses will be transferred.
1038 dpurdie 255
The link MUST address another version of the same package.
256
This is intended to support the 'jats2_current' link.
257
When a new version of JATS is released, then the new package
4456 dpurdie 258
will be transferred, as well the new link.
1038 dpurdie 259
 
260
Config items that control a time period allow the following sufixes:
261
    s - Seconds. Same as no suffix
262
    m - Minutes
263
    h - Hours
264
    d - Days
265
Multiple are allowed. ie: 1h10h
266
 
267
Config items that control a file size in blocks allow the following suffixes:
268
    k - Kilobytes (Same as no suffix)
269
    b - Blocks    (Same as no suffix)
270
    m - Megabytes
271
    g - Gigabytes
272
 
273
 
274
ToDo
275
======================
1042 dpurdie 276
1) Better handling of soft-links for core_devl
1038 dpurdie 277
   Works, but its prone to error
278
   There is no test to ensure the link exists. If the link
279
   is deleted, then it won't be recreated.