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