
	System Requirements
	~~~~~~~~~~~~~~~~~~~

- Bacula 3.0 or later.
- Full supported MySQL, PostgreSQL and Sqlite databases.
- Zend Framework version 1.8.3 or later.
- Zend Framework is built with object-oriented PHP 5 and requires
  PHP 5.2.4 or later with PDO extension active. Please see the system requirements appendix for
  more detailed information:
  http://framework.zend.com/manual/en/requirements.html
- Apache and mod_rewrite or equivalent web-server. For example, nginx and ngx_http_rewrite_module.
- Installed php-gd package. GD is an open source code library for the dynamic creation of images by programmers.
- Create separate database "webacula" for use Restore Files and Logbook features.
- http://php.net/dom for RSS feed

Run docs/check_system_requirements.php to verify.


	Install & Setup
	~~~~~~~~~~~~~~~

- login as root
- mkdir /var/www/webacula
- Copy this distribution to directory /var/www/webacula

- Download Zend Framework from http://framework.zend.com/ and extract the contents from library/ directory.

- The tree which should turn out as a result :

/var/www/webacula/
|-- application
|   |-- controllers
|   |-- models
|   `-- views
|-- docs
|-- install
|-- html
|-- languages
`-- library
    |-- Other
    |-- MyClass
    |
    `-- Zend (this is Zend Framework package)
        |-- Acl
        |-- Auth
        |-- Cache
        |-- Config
       ...




- Specify the parameters to connect to the Catalog and webacula databases in /var/www/webacula/application/config.ini
	
- Setup parameter
   tmpdir = "/tmp"
  Directory "tmpdir" which will be saved the file, which contains a list of files to restore.
IMPORTANT! This directory and files in it should be available to read the Director service.	


- Creates system group account (if not yet created) :
	groupadd bacula

- Add apache to group:
	usermod -aG bacula apache

- Next, bconsole file can be executed by Apache web server :
  NOTE. /usr/sbin/bconsole -- binary ELF file (not a shell script!)

  variant 1:
	chown root:bacula /usr/sbin/bconsole
	chmod u=rwx,g=rx,o=  /usr/sbin/bconsole

	chown root:bacula /etc/bacula/bconsole.conf
	chmod u=rw,g=r,o= /etc/bacula/bconsole.conf

   edit application/config.ini
       bacula.sudo = ""
       bacula.bconsole = "/usr/sbin/bconsole"


  variant 2:
    edit application/config.ini
       bacula.sudo = "/usr/bin/sudo"
       bacula.bconsole = "/usr/sbin/bconsole"

    visudo
        # (!!! comment here !!!) Defaults requiretty
        apache ALL=NOPASSWD: /usr/sbin/bconsole

  Check :
# su -l apache -s /bin/sh -c "/usr/bin/sudo /usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf"

- Create configuration for Apache /etc/httpd/conf.d/webacula.conf
  NOTE. Specific directories on your system may be different.

LoadModule rewrite_module modules/mod_rewrite.so
AccessFileName .htaccess
# for DEBUG # RewriteLog "/var/log/httpd/rewrite.log"
# for DEBUG # RewriteLogLevel 3

Alias "/webacula"  "/var/www/webacula/html"
<Directory "/var/www/webacula/html">
   RewriteEngine on
	Options FollowSymLinks
	AllowOverride All
	Order deny,allow
	Allow from 127.0.0.1
	# your network
	Allow from 192.161.150.0/255.255.255.0

	AuthType Basic
	AuthName "Webacula"
	AuthUserFile       /etc/httpd/conf/webacula.users
	Require valid-user
</Directory>


- setup mod_rewrite :
  NOTE. Specific directories on your system may be different.


----------- /var/www/webacula/html/.htaccess

php_flag magic_quotes_gpc off
php_flag register_globals off
RewriteEngine On

# edit RewriteBase if necessary
RewriteBase   /webacula
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

For testing mod_rewrite change 'RewriteBase' (if necessary) in webacula/html/test_mod_rewrite/.htaccess
And use URL like
   http://localhost/webacula/test_mod_rewrite/
for test mod_rewrite



- increase values in /etc/php.ini :
  memory_limit = 32M
  max_execution_time = 300

  If you will restore ("Restore Job" -> "Select Files for Restore") about 100,000 unique files set following values:
  memory_limit = 128M
  max_execution_time = 600

- Next (NOTE. Specific commands on your system may be different) :
/sbin/service httpd restart

- Check mod_rewrite :
apachectl -t -D DUMP_MODULES 2>&1 | grep rewrite
rewrite_module (shared)



- To show messages of the Job output, you must add a line :

  catalog = all, !skipped, !saved

  in bacula-dir.conf and restart Bacula Director :

Messages {
  Name = Standard
...
  catalog = all, !skipped, !saved
}

See also manual of Bacula "Chapter 15. Messages Resource".

- Next :
cd /etc/bacula
./bacula stop
./bacula start


Delete old tmp files: wb_clean_tmp.sh script to be run by the cron.

If necessary change a name and the password of the user in a files in install/ directory:
	webacula_mysql_create_database.sh
	webacula_postgresql_create_database.sh
	webacula_postgresql_make_tables.sh


Create database, tables and user :
   cd install

for MySQL:
	./webacula_mysql_create_database.sh
	./webacula_mysql_make_tables.sh

for PostgreSQL:
	./webacula_postgresql_create_database.sh
	./webacula_postgresql_make_tables.sh

for Sqlite:
	sudo mkdir /var/lib/sqlite/
	sudo chown root.apache /var/lib/sqlite
	sudo chmod g+rw /var/lib/sqlite
	sudo ./webacula_sqlite_create_database.sh
	sudo chgrp apache /var/lib/sqlite/webacula.db
	sudo chmod g+rw /var/lib/sqlite/webacula.db


NOTE. Database "webacula" also required for restore the jobs and files.



	LogBook
	~~~~~~~
	Logbook - is simple electronic journal of backups. Records in logbook are insert, modify, delete manually by the operator.
Records can contain links (usual web-links on which it is possible to click) to Bacula Jobs or links to other records of this logbook.
In logbook insert  records, for example, about Jobs, failures of the equipment, supernumerary situations, etc.
See screenshots http://webacula.sourceforge.net/ Webacula Web site for details.
Logbook stored in a separate database "webacula", now it is supported  MySQL and PostgreSQL.



	Update
	~~~~~~

   Download latest tarball.
   Save in safe place your "config.ini", remove directory "webacula", extract Webacula source code and replace "config.ini" back.

	If necessary (full text search not worked) run mysqldump, drop DB webacula and create with :

CREATE DATABASE webacula
	DEFAULT CHARACTER SET utf8
   DEFAULT COLLATE utf8_general_ci;

	and load data from dump again.



    Restore Job (technical details)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Command like "restore all" immediately sent to the service Director.

    To select individual files for restoration uses the following scheme.
    Of DB bacula in DB webacula into temporary tables copied data for a particular JobId.

Note. This process may take a long time.
    It may be increased values in /etc/php.ini : memory_limit and max_execution_time.

    Then, the files and directories are marked for restore.
    Then, a list of files and a command to restore sent to the service Director.
    Temporary tables in the database webacula removed.

IMPORTANT. Need to file containing a list of files to restore, has been available for reading for Director service.


