Simba install procedure
To install Simba you need:
- perl 5.008 (or above)
- perl modules
- a database server
Perl modules
and some perl modules (some available from [http://www.cpan.org CPAN], other available from
[http://perl.packages.ro/ "RoPkg Perl resources"]):
- RoPkg
- RoPkg::DB
- RoPkg::Rsync
- RoPkg::Simba
First, you must install the perl modules. Download the perl modules and copy them to a temporary directory (eg: ~/tmp). Install them in the order specified before:
cd ~/tmp/
tar xvfz RoPkg-0.4.6tar.gz
cd RoPkg-0.4.6
perl Makefile.PL
make
sudo make install
cd ..
tar xvfz RoPkg-DB-0.1.6.tar.gz
cd RoPkg-DB-0.1.6
perl Makefile.PL
make
sudo make install
cd ..
tar xvfz RoPkg-Rsync-0.2+alpha4.tar.gz
cd RoPkg-Rsync-0.2+alpha4
perl Makefile.PL
make
sudo make install
cd ..
tar xvfz RoPkg-Simba-0.6+alpha9.tar.gz
cd RoPkg-Simba-0.6+alpha9
perl Makefile.PL
make
sudo make install
At this time you should have all three modules installed. If you want to make sure that all the modules are installed you can use the following command:
perl -MRoPkg::Utils -MRoPkg::DB -MRoPkg::Simba -e '1;'
The next step is to install the database.
Database
Simba uses DBI as database interface and SQL::Abstract for query generation. So, Simba can use any DBMS that DBI knows about. For a list of the supported database servers, please see the DBI manual page. For this example will suppose that you have a MySQL server. First let's create a database for simba, a user and give that user full rights on the database:
mysqladmin create mirrors_db
mysql
grant all on mirrors_db.* to simba@localhost identified by 'simbapassword'
Now, when we have a database and the user with access to the database, let's import the tables layout. Look into addons directory for a file called simba.mysql .
mysql mirrors_db < addons/simba.mysql
At this point we have the database, the user and the tables created. Also, the required perl modules are installed.
Simba executable
The program simba (the one you will use to sync your mirrors) is in simba-<version>.tar.gz archive. You need to copy simba somewhere in your filesystem (/usr/bin for example).
Configuration file
Simba configuration file is no more, and no less than a perl file. I used this approach because perl is a very flexible language and the complexity of the configuration file is not that trivial. Still this approach has some drawbacks. You must be very careful when modifying the file. Any mistakes, and you'll get some weird error messages. The configuration file looks like this:
$cfg = {
log => q(
#Fatal errors goes to screen
log4perl.logger=FATAL, Screen
#INFO messages goes into Log file (see the definition of Log below)
log4perl.logger.RoPkg.Simba=INFO, Log
#Definition for Screen
log4perl.appender.Screen=Log::Dispatch::Screen
log4perl.appender.Screen.stderr=0
log4perl.appender.Screen.Threshold=FATAL
log4perl.appender.Screen.layout=Log::Log4perl::Layout::SimpleLayout
#definition for DebugLog
log4perl.appender.DebugLog=Log::Dispatch::File
log4perl.appender.DebugLog.filename=/var/log/simba.debug
log4perl.appender.DebugLog.mode=append
log4perl.appender.DebugLog.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.DebugLog.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n
#definition for Log
log4perl.appender.Log=Log::Dispatch::File
log4perl.appender.Log.filename=/var/log/simba.log
log4perl.appender.Log.mode=append
log4perl.appender.Log.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.Log.layout.ConversionPattern=%d %p> %m%n
),
db => {
dsn => 'dbi:mysql:database=mirrors_db;host=localhost;port=3306',
user => 'simba',
pass => 'mirrors',
},
general => {
lockfile => 'inProgress',
tmpdir => '/tmp/',
verbose => 'yes',
showListAfterSync => 'yes',
},
mProbes => [
'mirror.Probe',
'timestamp',
'probe.txt',
'status.html',
'./',
],
plugins => {
html => {
shortName => 'genHTML',
packageName => 'RoPkg::Simba::Plugin::GenHTML',
templatesDir => '/etc/simba/templates/',
callbacks => {
c_01 => {
trigger => 'afterSync',
method => 'genMirrorPage',
},
c_10 => {
trigger => 'userRequest',
method => 'genMirrorsIndex',
},
},
h_02 => {
type => 'index',
template => 'mirrors-list.tmpl',
outfile => '/var/www/vhosts/ftp/index.html',
},
h_03 => {
type => 'page',
template => 'mirror.tmpl',
outfile => '/var/www/vhosts/ftp/__name__.html',
},
h_04 => {
type => 'page',
template => 'mirror-updates.tmpl',
outfile => '/var/www/vhosts/ftp/__name__-updates.html',
},
h_05 => {
type => 'page',
template => 'mirror-log.tmpl',
outfile => '/var/www/vhosts/ftp/__name__-log.html',
},
},
rss => {
shortName => 'genRSS',
packageName => 'RoPkg::Simba::Plugin::GenRSS',
gmt_offset => '+02:00',
callbacks => {
c_01 => {
trigger => 'userRequest',
method => 'genFeed',
},
},
file => '/var/www/vhosts/ftp/mirrors.rss',
title => 'Mirror updates',
site_url => 'http://mirrors.mydomain.net',
item_url => 'http://mirrors.mydomain.net/mirrors-status/__name__.html',
item_msg => 'On __last_update__, __name__ was updated. __files_no__ files ' .
'were transferred on __last_update_duration__ at ' .
'__last_update_speed__B/sec . ',
description => 'RoPkgmirror updates',
creator => 'Simba',
publisher => 'Simba',
rights => 'me',
language => 'en_US',
max_items => 10,
},
sitemap => {
shortName => 'sitemap',
packageName => 'RoPkg::Simba::Plugin::GenSitemap',
templatesDir => '/etc/simba/templates/',
#we do not want to have rss feeds (for now)
enabled => 'no',
callbacks => {
c_01 => {
trigger => 'userRequest',
method => 'genSitemap',
},
},
s_01 => {
template => 'sitemap-google.tmpl',
outfile => '/var/www/vhosts/ftp/sitemap-google.xml',
},
s_02 => {
template => 'sitemap-mirrors.tmpl',
outfile => '/var/www/vhosts/ftp/sitemap-mirrors.xml',
},
},
},
};
Rather than creating a configuration file from scratch, modify the one provided with RoPkg::Simba to reflect your custom settings. After customizing the configuration file, you are ready to run Simba. To take advantage of Simba's features you should take a look at the default templates and customize them to reflect your policy and custom reports. More information about the templates can be found in templates section. Please be carefull, because simba expects that the configuration file is simba.cfg and is located into /etc/simba/ directory. This behaviour will be changed in the future, but for now, use it as it is.
Web Interface
At this time, the web interface CGI based and is pretty dumb. But is doying his job. The cgi script, expects to find the configuration file in /etc/simba/simba.cfg and the templates he needs in /etc/simba/templates/cgi/ . If those files are not there, you have to modify the script by hand to read the right files.