]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/INSTALL
bweb: Update some GPL2 notice to AGPL
[bacula/bacula] / gui / bweb / INSTALL
index 9c5317e424a9e923c1d7b14caa15817be199a1cc..7c1ae65f13a98172c865ce3ff6f6af5b815e195b 100644 (file)
 #               INSTALL NOTES                                  #
 ################################################################
 
-Bweb works well with 1.39 release.
+Bweb works well with 3.0 release or later.
+
+1) install Perl lib
+2) using lighttpd (quick install)
+3) using apache 
+4) initialize your configuration file
+5) do some sql stuff (for postgresql or mysql 5 users)
+6) use the -n option on bconsole so that it works with Expect
+7) get bacula log more useful
+8) bweb limitation
+9) using sudo with autochanger
+10) using bfileview.pl
+11) accessing to bweb
+12) setting mysql read-only account
+13) get more statistics
+14) use users and groups with bweb
+15) setup restoration in bweb
 
-1) install perl lib
-2) copy your files
-3) intialise your configuration file
-4) do some sql stuff (for postgresql user)
-5) get a bconsole that work with Expect
-6) get bacula log more useful
-7) bweb limitation
-8) using sudo with autochanger
 
-################ FILE COPY #####################################
+################ INSTALL PERL LIBRARY ##########################
+
+ - perl modules
+    - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
+          (SQLite is not supported)
+    - GD::Graph
+    - GD
+    - HTML::Template
+    - CGI
+    - Expect
+    - Time::ParseDate
+    - Date::Calc
+
+ You can install perl modules with CPAN
+ perl -e shell -MCPAN
+  > install Expect
+
+ Or use your distribution
+ apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl \
+                 libdbd-mysql-perl libdbd-pg-perl libdbi-perl \
+                 libdate-calc-perl libtime-modules-perl
+
+ Note: the best way to test if you have all the dependencies
+ fullfilled for Perl is to:
+  
+    cd bweb/lib
+    ../cgi/bweb.pl 
+
+ you might also want to try:
+
+    ../cgi/bgraph.pl 
+
+ To make sure the graphing modules are loaded.  However, running it
+ will spray binary graphics data on your terminal.  Otherwise, you will
+ get an error.
+
+ That should show you if any of the pre-requisites are missing.
+ On SuSE 10.2, I was able to load all the appropriate modules via rpms,
+ with the exception of Expect and Time::ParseDate, which I loaded manually
+ using perl.
+
+ If you experience problems, always consult the Apache error_log
+ file.
+
+
+################# USE LIGHTTPD WITH BWEB #######################
+
+In this example, bweb files are in /home/bacula/bweb
+You should have installed lighttpd.
+
+bacula:~$ cd bweb
 
- # first, copy bweb perl librarie in your PERL5 INC path
+# configure the database
+bacula:~/bweb$ mysql bacula < script/bweb-mysql.sql
+# or
+bacula:~/bweb$ psql bacula < script/bweb-postgresql.sql
+
+# You can start the web server from the bweb directory
+bacula@localhost:~/bweb$ ./script/starthttp
+ Making configuration template in /home/bacula/bweb/bweb.conf
+ Adjusting bweb.conf path
+ Using bweb on /home/bacula/bweb,  use firefox http://localhost:9180
+ 2009-07-18 22:23:12: (log.c.75) server started
+
+
+By default, only the loopback interface is binded, you can change that
+in the bweb/script/httpd.conf file.
+
+You will have to configure bweb with your database and bconsole info, it
+can be done in the web interface.
+
+I [Kern] used the following in the Configuration panel. Note: I am 
+   using Ubuntu Hardy (8.04):
+DBI:     DBI:mysql:database=bacula;host=roxie 
+user:    bacula
+Password:   (nothing -- I have none)
+email_media:  my@email.com
+bconsole:  /opt/bacula/bin/bconsole -n
+
+Click: Save
+Click: Main -- you should see the charts
+
+
+################ FILE COPY (Full Apache methode) ###############
+ # you must get bweb svn files
+ svn checkout https://bacula.svn.sourceforge.net/svnroot/bacula/trunk/gui/bweb bweb
+
+ # or get them from the released tar files or from the apt or rpms.
+
+ #
+ # Once you have the gui directory loaded, follow the instructions below
+ #  or edit the environment variables in the file install_bweb
+ #  then execute it. install_web does everything to the next
+ #  set of #######'s.
+ #
+
+ # first, copy the bweb Perl library into your PERL5 INC path
+ perl Makefile.PL
+ make install
+ # or
  install -m 644 -o root -g root  bweb/lib/*.pm /usr/share/perl5
 
- # copy bweb perl program to you cgi location
+
+
+ # copy the bweb perl program to your cgi location
  mkdir -m 755 /usr/lib/cgi-bin/bweb
  install -m 755 -o root -g root  bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
 
- # get a config file
- mkdir -m 750 /etc/bweb
- chown root:www-data /etc/bweb
- echo "template_dir = /usr/share/bweb/tpl" > /etc/bweb/config
- chown www-data /etc/bweb/config
+ # get a config file, if you want to use an other place edit lib/Bweb.pm
+ mkdir -m 755 /etc/bacula
+ chown root:bacula /etc/bacula
+ echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bacula/bweb.conf
+ chown www-data /etc/bacula/bweb.conf
 
- # copy bweb template file
- mkdir -p /usr/share/bweb/tpl
- install -m 644 -o root -g root  bweb/tpl/*.tpl /usr/share/bweb/tpl
+ # copy the bweb template file
+ mkdir -p /usr/share/bweb/tpl/en
+ install -m 644 -o root -g root  bweb/lang/en/tpl/*.tpl /usr/share/bweb/tpl/en
 
- # copy bweb graphics elements (bweb elements must reside on /bweb)
+ # copy the bweb graphics elements (bweb elements must reside in /bweb)
  mkdir /var/www/bweb
- install -m 644 -o root -g root  bweb/html/*.{js,png,css,gif} /var/www/bweb
+ install -m 644 -o root -g root  bweb/html/*.{js,png,css,gif,ico,html} /var/www/bweb
 
  # done !
 
-################ INSTALL PERL LIBRARY ##########################
+ WARNING : Your www-data (or wwwrun on SuSE) user must be able to execute bconsole and able 
+           to read the bconsole.conf file!
+           You can create an bconsole group for that.
 
- - perl modules
-    - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
-    - Gd::Graph
-    - HTML::Template
-    - CGI
-    - Expect
+################ USE FRENCH/SPANISH VERSION ####################
 
- You can install perl modules with CPAN
- perl -e shell -MCPAN
-  > install Expect
+Simply copy lang/fr/tpl/*.tpl files to .../tpl/fr/*.tpl and choose
+your language in the configuration panel.
 
- Or use your distribution
- apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl
- apt-get install libdbd-mysql-perl libdbd-pg-perl libdbi-perl
 
 ################ APACHE CONFIGURATION ##########################
 
-It could be a good idea to protect your bweb installation.
+It could be a good idea to protect your bweb installation (optional).
+
+Put this in your httpd.conf, and add user with htpasswd
 
-Put this in you httpd.conf, and add user with htpasswd
+Alias /bweb /usr/share/bweb/html
+<Directory /usr/share/bweb/html>
+        Options FollowSymLinks MultiViews
+        AllowOverride None
+        Order allow,deny
+        allow from all
+</Directory>
 
+ScriptAlias /cgi-bin/bweb /usr/lib/cgi-bin/bweb
 <Directory /usr/lib/cgi-bin/bweb>
         Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
         AuthType Basic
@@ -70,89 +179,121 @@ Put this in you httpd.conf, and add user with htpasswd
         Require valid-user
 </Directory>
 
+On SuSE 10.2, the following in /etc/apache2/default-server.conf works. 
+However, it is not secure:
+
+Directory "/srv/www/cgi-bin/bweb">
+ AllowOverride None
+ Options +ExecCGI -Includes
+ Order allow,deny
+ Allow from all
+</Directory>
+
 
 ################ CONFIGURATION #################################
 
-/etc/bweb/config look like : (you can edit it inside bweb)
+Note, this is automatically installed by the install_bweb script.
+
+/etc/bacula/bweb.conf looks like : (you can edit it inside bweb)
+$VAR1 = bless( {
+  'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
+  'name' => undef,
+  'config_file' => '/etc/bacula/bweb.conf',
+  'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
+  'ach_list' => {
+     'S1_L80' => bless( {
+         'info' => {
+                     'drive' => 0,
+                     'io' => 0,
+                     'slot' => 0
+                   },
+         'name' => 'S1_L80',
+         'bweb' => undef,
+         'device' => '/dev/changer',
+         'drive' => [],
+         'debug' => 0,
+         'label' => {},
+         'precmd' => 'sudo',
+         'io' => [],
+         'mtxcmd' => '/usr/sbin/mtx',
+         'drive_name' => [
+                           'S1_L80_SDLT0',
+                           'S1_L80_SDLT1'
+                         ],
+         'slot' => []
+       }, 'Bweb::Autochanger' )
+   },
+  'password' => 'xxx',
+  'template_dir' => '/usr/share/bweb/tpl',
+  'lang' => 'en',
+  'dbi' => 'DBI:mysql:database=bacula',
+  'error' => '',
+  'debug' => 0,
+  'user' => 'bacula',
+  'email_media' => 'eric@localhost'
+}, 'Bweb::Config' );
 
-dbi = DBI:Pg:database=bacula;host=192.168.1.2
-user = bacula
-password = test
-template_dir = /usr/share/bweb/tpl
-graph_font = /usr/share/fonts/truetype/msttcorefonts/Arial.ttf
-email_media = eric@localhost
-bconsole = /usr/local/bacula/sbin/bconsole -c /usr/local/bacula/etc/bconsole.conf
 
 ################ BRESTORE ######################################
 
-If you want to use brestore with bweb, you must associate mime type
-text/brestore with your brestore.pl.
+If you want to use brestore with bweb, you must associate a mime type
+text/brestore with your brestore.pl, and you must install brestore.
+See gui/brestore/README for instructions on installing brestore.pl.
 
-################ POSTGRESQL NOTES ##############################
+################ POSTGRESQL AND MYSQL5 NOTES ####################
 
-If you think that Mysql is not a great database (or just a toy), you must add
-function to the Postgresql bacula database to get Bweb works.
+If you want to use PostgreSQL instead of MySQL, you must add
+a function to the PostgreSQL Bacula database to get Bweb to work.
 
-psql -u bacula bacula < script/bweb-postgresql.sql
+psql -U bacula bacula < script/bweb-postgresql.sql
 
-################ BCONSOLE NOTES ################################
+Tips: PL must be enabled in your cluster, you can do this with postgres user
+postgres:~$ echo 'CREATE PROCEDURAL LANGUAGE plpgsql;' | psql bacula 
+
+
+To get database size with mysql5, edit Bweb.pm and change the DB_SIZE macro
+
+ # with mysql < 5, you have to play with the ugly SHOW command
+ DB_SIZE => " SELECT 0 ",
+ # works only with mysql 5
+ DB_SIZE => " SELECT sum(DATA_LENGTH) FROM INFORMATION_SCHEMA.TABLES ",
 
-You must use bconsole without conio/readline support ! You can have 2 bconsole
-binary at the same time.
+################ BCONSOLE NOTES ################################
 
-./configure <your-other-options> --disable-conio
-cd src/lib
-make
-cd ..
-cd console
-make
-cp bconsole <your_destination>
+You must use bconsole without conio/readline support. For that, use
+the bconsole -n option. This is done automatically with the standard
+configuration file.  In addition, please ensure that the binary
+bconsole file can be executed by your web server. It is normally
+located in /usr/bin/bconsole (or some such file), and must have
+modes 755 or it will not be executable by your web server.  The
+normal Bacula installation usually sets mode 750.
 
 ################ BACULA LOG ####################################
 
-To use Bweb log engine, you must apply this little patch and have the
-new Log table in your database.
-
-After, you can fill your database with :
-tail -f /tmp/log.sql | bacula -u bacula bacula
-
-cd bacula-src
-patch < message.patch
---- cvs/src/lib/message.c       2006-07-27 21:06:20.000000000 +0200
-+++ cvs/src/lib/message.c.director      2006-07-28 13:46:49.171083494 +0200
-@@ -716,6 +716,18 @@
-                 }
-                 fputs(dt, d->fd);
-                 fputs(msg, d->fd);
-+               void db_escape_string(char *snew, char *old, int len);
-+               if (jcr) {
-+                       char ed1[50];
-+                       POOL_MEM cmd(PM_MESSAGE);
-+                       int len = strlen(msg);
-+                       char *p = (char *)malloc(len * 2 + 1);
-+                       db_escape_string(p, msg, len);
-+                       FILE *fp = fopen("/tmp/log.sql", "a");
-+                       fprintf(fp, "INSERT INTO Log (Time, JobId, LogText) VALUES (NOW(),%s, '%s');\n", edit_int64(jcr->JobId, ed1), p);
-+                       fclose(fp);
-+               }
-+
-                 break;
-              case MD_DIRECTOR:
-                 Dmsg1(850, "DIRECTOR for following msg: %s", msg);
+If you want Bweb to be able to show listings of the Job output,
+you must add a "catalog = all, !skipped, !saved" to your
+messages resource in bacula-dir.conf and restart your Bacula 
+server.  This is shown below:
+
+Messages {
+  Name = Standard
 
+  operator = root@localhost = mount
+  console = all, !skipped, !saved
+  append = "/tmp/bacula/var/bacula/working/log" = all, !skipped
 
+  catalog = all, !skipped, !saved
+}
 
 
 ################ BWEB LIMITATION ###############################
 
 To get bweb working, you must follow these rules
  - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
- - AutoChanger name must be same as Storage name device in bacula
+ - AutoChanger name must be same as Device and Location name in bacula
 
 ################ SUDO CONFIGURATION ############################
 
-*** At this time, autochanger module works only at home :)
-
 If you use sudo, put this on you /etc/sudoers
 
 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
@@ -160,5 +301,105 @@ www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
 
+################ BFILEVIEW AND BTIME SETUP ###############################
+
+Alias /bweb/fv /var/spool/bweb
+<Directory "/var/spool/bweb">
+    Options None
+    AllowOverride AuthConfig
+    Order allow,deny
+    Allow from all
+</Directory>
+
+mkdir /var/spool/bweb
+chmod 700 /var/spool/bweb
+chown www-data /var/spool/bweb
+
+Add (or configure) a writable location to the parameters in bweb.conf 
+   'fv_write_path' => '/var/spool/bweb',
+
+###### BFILEVIEW only part
+
+You MUST use brestore.pl -b or bresto.pl action=batch to initialize the
+database, and you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute
+tree size.
+
+At this time, it's a good idea to schedule brestore.pl -b after your 
+BackupCatalog job.
+
+Job {
+  Name = "BackupCatalog"
+  ...
+  # This creates an ASCII copy of the catalog
+  RunBeforeJob = "/opt/bacula/etc/make_catalog_backup.pl MyCatalog"
+  # This deletes the copy of the catalog
+  RunAfterJob  = "/opt/bacula/etc/delete_catalog_backup"
+  RunAfterJob  = "/usr/lib/cgi-bin/bweb/bresto.pl action=batch"
+}
+
+To upgrade from an old installation, you can use :
+ALTER TABLE brestore_pathvisibility ADD Size int8;
+ALTER TABLE brestore_pathvisibility ADD Files int4;
+
+################ ACCESSING TO BWEB ############################
+
+Now, you are able to launch firefox/mozilla and go on
+http://your-server/bweb
+
+################ SETTING MYSQL ACCOUNT ########################
+
+At this time, Bweb needs a write access to :
+- Location 
+- LocationLog
+- Media::LocationId
+- Media::Comment
+- Media::RecyclePoolId (it will change soon)
+
+If your doesn't use Location feature, you can use ReadOnly access
+for all tables, or setup something like :
+
+GRANT SELECT ON bacula.* TO 'bweb'@'%'  IDENTIFIED BY 'password';
+GRANT INSERT,UPDATE,DELETE ON bacula.Location 
+  TO 'bweb'@'%' IDENTIFIED BY 'password';
+GRANT INSERT,UPDATE,DELETE ON bacula.LocationLog 
+  TO 'bweb'@'%' IDENTIFIED BY 'password';
+
+################ GET MORE STATISTICS ###########################
+
+You keep Jobs informations across retention into a JobHisto table.
+You have to setup stat_job_table = JobHisto in bweb configuration.
+
+And use Statistics module from Bacula (see documentation and update stats
+command).
+
+################ USE USERS AND GROUPS WITH BWEB ##########################
+
+It works with postgresql and mysql5 (4 not tested).
+With mysql, load bweb/script/bweb-mysql.sql into your catalog
+For postgresql, it will be done with bweb/script/bweb-postgresql.sql (already done)
+
+################ MADE RESTORATION WITH BWEB ####################
+
+It will do some basics things on a working bweb/brestore setup.
+
+1) Go to http://extjs.com and download their toolkit (use the 2.2 release)
+
+2) Install files in /bweb/ext web root 
+ example on debian : 
+  root@localhost:~# mv ext-2.2 /usr/share/bweb/html/ext
+
+3) Make sure that brestore cache tables are in your catalog (bweb-xxx.sql files)
+
+4) Enable bresto.pl cgi. 
+  edit the bweb/cgi/bresto.pl script and change $bresto_enable=0; to $bresto_enable=1;
+  on the top of the file.
+
+5) Use the last Bweb.pm
+  If you are trying bresto in a working bweb/brestore setup, you must make sure that you use 
+  the last Bweb.pm git version.
+
+6) Go on http://you-director/bweb/bresto.html
+
+################################################################
 
 Enjoy !