]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/INSTALL
ebl fix delete jobid
[bacula/bacula] / gui / bweb / INSTALL
1 ################################################################
2 #               INSTALL NOTES                                  #
3 ################################################################
4
5 Bweb works well with 1.39 release.
6
7 1) install perl lib
8 2) copy your files
9 3) intialise your configuration file
10 4) do some sql stuff (for postgresql user)
11 5) get a bconsole that work with Expect
12 6) get bacula log more useful
13 7) bweb limitation
14 8) using sudo with autochanger
15
16 ################ FILE COPY #####################################
17
18  # first, copy bweb perl librarie in your PERL5 INC path
19  install -m 644 -o root -g root  bweb/lib/*.pm /usr/share/perl5
20
21  # copy bweb perl program to you cgi location
22  mkdir -m 755 /usr/lib/cgi-bin/bweb
23  install -m 755 -o root -g root  bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
24
25  # get a config file
26  mkdir -m 750 /etc/bweb
27  chown root:www-data /etc/bweb
28  echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bweb/config
29  chown www-data /etc/bweb/config
30
31  # copy bweb template file
32  mkdir -p /usr/share/bweb/tpl
33  install -m 644 -o root -g root  bweb/tpl/*.tpl /usr/share/bweb/tpl
34
35  # copy bweb graphics elements (bweb elements must reside on /bweb)
36  mkdir /var/www/bweb
37  install -m 644 -o root -g root  bweb/html/*.{js,png,css,gif,ico} /var/www/bweb
38
39  # done !
40
41 ################ INSTALL PERL LIBRARY ##########################
42
43  - perl modules
44     - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
45     - Gd::Graph
46     - HTML::Template
47     - CGI
48     - Expect
49
50  You can install perl modules with CPAN
51  perl -e shell -MCPAN
52   > install Expect
53
54  Or use your distribution
55  apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl
56  apt-get install libdbd-mysql-perl libdbd-pg-perl libdbi-perl
57
58 ################ APACHE CONFIGURATION ##########################
59
60 It could be a good idea to protect your bweb installation.
61
62 Put this in you httpd.conf, and add user with htpasswd
63
64 <Directory /usr/lib/cgi-bin/bweb>
65         Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
66         AuthType Basic
67         AuthName MyPrivateFile
68         AuthUserFile /etc/apache/htpasswd
69         AllowOverride None
70         Require valid-user
71 </Directory>
72
73
74 ################ CONFIGURATION #################################
75
76 /etc/bweb/config looks like : (you can edit it inside bweb)
77 $VAR1 = bless( {
78   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
79   'name' => undef,
80   'config_file' => '/etc/bweb/config',
81   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
82   'ach_list' => {
83      'S1_L80' => bless( {
84          'info' => {
85                      'drive' => 0,
86                      'io' => 0,
87                      'slot' => 0
88                    },
89          'name' => 'S1_L80',
90          'bweb' => undef,
91          'device' => '/dev/changer',
92          'drive' => [],
93          'debug' => 0,
94          'label' => {},
95          'precmd' => 'sudo',
96          'io' => [],
97          'mtxcmd' => '/usr/sbin/mtx',
98          'drive_name' => [
99                            'S1_L80_SDLT0',
100                            'S1_L80_SDLT1'
101                          ],
102          'slot' => []
103        }, 'Bweb::Autochanger' )
104    },
105   'password' => 'xxx',
106   'template_dir' => '/usr/share/bweb/tpl',
107   'dbi' => 'DBI:mysql:database=bacula',
108   'error' => '',
109   'debug' => 0,
110   'user' => 'bacula',
111   'email_media' => 'eric@localhost'
112 }, 'Bweb::Config' );
113
114
115 ################ BRESTORE ######################################
116
117 If you want to use brestore with bweb, you must associate mime type
118 text/brestore with your brestore.pl.
119
120 ################ POSTGRESQL NOTES ##############################
121
122 If you think that Mysql is not a great database (or just a toy), you must add
123 function to the Postgresql bacula database to get Bweb works.
124
125 psql -u bacula bacula < script/bweb-postgresql.sql
126
127 ################ BCONSOLE NOTES ################################
128
129 You must use bconsole without conio/readline support. For that, use
130 bconsole -n option.
131
132 ################ BACULA LOG ####################################
133
134 To use Bweb log engine, you must apply this little patch and have the
135 new Log table in your database.
136
137 After, you can fill your database with :
138 while true; do
139         tail -f /tmp/log.sql | bacula -u bacula bacula
140 done
141
142 cd bacula-src
143 patch -p1 < message.patch
144 --- cvs/src/lib/message.c       2006-07-27 21:06:20.000000000 +0200
145 +++ cvs/src/lib/message.c.director      2006-07-28 13:46:49.171083494 +0200
146 @@ -716,6 +716,18 @@
147                  }
148                  fputs(dt, d->fd);
149                  fputs(msg, d->fd);
150 +               void db_escape_string(char *snew, char *old, int len);
151 +               if (jcr) {
152 +                       char ed1[50];
153 +                       POOL_MEM cmd(PM_MESSAGE);
154 +                       int len = strlen(msg);
155 +                       char *p = (char *)malloc(len * 2 + 1);
156 +                       db_escape_string(p, msg, len);
157 +                       FILE *fp = fopen("/tmp/log.sql", "a");
158 +                       fprintf(fp, "INSERT INTO Log (Time, JobId, LogText) VALUES (NOW(),%s, '%s');\n", edit_int64(jcr->JobId, ed1), p);
159 +                       fclose(fp);
160 +               }
161 +
162                  break;
163               case MD_DIRECTOR:
164                  Dmsg1(850, "DIRECTOR for following msg: %s", msg);
165
166
167 This patch is only for director, this will breaks the rest.
168 you can revert it with patch -p1 -R < message.patch
169
170 ################ BWEB LIMITATION ###############################
171
172 To get bweb working, you must follow these rules
173  - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
174  - AutoChanger name must be same as Device and Location name in bacula
175
176 ################ SUDO CONFIGURATION ############################
177
178 If you use sudo, put this on you /etc/sudoers
179
180 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
181 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
182 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
183 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
184
185
186 Enjoy !