File: INSTALL.html

package info (click to toggle)
simba 0.8.4-4.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 540 kB
  • sloc: perl: 2,645; sh: 188; makefile: 53
file content (220 lines) | stat: -rw-r--r-- 7,833 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<html><body>
<h1>Simba install procedure</h1>
 To install Simba you need:
<ul>
 <li>perl 5.008 (or above)</li>
 <li>perl modules</li>
 <li>a database server</li>
</ul>

<h2>Perl modules </h2>
and some perl modules (some available from [http://www.cpan.org CPAN], other available from
[http://perl.packages.ro/ "RoPkg Perl resources"]):
<ul>
 <li>RoPkg</li>
 <li>RoPkg::DB</li>
 <li>RoPkg::Rsync</li>
 <li>RoPkg::Simba</li>
</ul>

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:
<pre>
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
</pre>
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:
<pre>
perl -MRoPkg::Utils -MRoPkg::DB -MRoPkg::Simba -e '1;'
</pre>
The next step is to install the database.

<h2>Database </h2>
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:
<pre>
 mysqladmin create mirrors_db
 mysql
 grant all on mirrors_db.* to simba@localhost identified by 'simbapassword'
</pre>
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 . 
<pre>
 mysql mirrors_db < addons/simba.mysql
</pre>
At this point we have the database, the user and the tables created. Also, the required perl modules are installed. 

<h2>Simba executable </h2>
The program simba (the one you will use to sync your mirrors) is in simba-&lt;version&gt;.tar.gz archive. You need to copy <strong>simba</strong> somewhere in your filesystem (/usr/bin for example).


<h2>Configuration file </h2>

Simba configuration file is no more, and no less than a perl file. I used this approach because perl is a <strong>very</strong> flexible language and the complexity of the configuration file is not that trivial. Still this approach has some drawbacks. You must be <strong>very careful</strong> when modifying the file. Any mistakes, and you'll get some weird error messages. The configuration file looks like this:
<pre>
$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',
     },
   },
  },
};
</pre>
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.

<h2>Web Interface </h2>
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.
</body></html>