Online demo Privacy policy GoBD notes Blog

Post install tasks

Edit the configuration file

If you use any antispam application, set the spam_header_line parameter, then piler can recognise when it receives a spam. If you use SpamAssassin, then you may use the following:

spam_header_line=X-Spam-Level: ********

Create a key for encryption

make key
cp piler.key /usr/local/etc/piler
chgrp piler /usr/local/etc/piler/piler.key
chmod 640 /usr/local/etc/piler/piler.key

This command will read 56 bytes from /dev/urandom and write to ./piler.key. Piler uses the key to encrypt archived files, and decrypt retrieved messages from the archive.

IMPORTANT! Make sure you never lose/overwrite the key otherwise you won't access your archive ever again. So whenever you upgrade be sure to keep your existing key file.

Create a database for piler

#mysql -u root -p
mysql>create database piler character set 'utf8mb4';
mysql>grant all privileges on piler.* to piler@localhost identified by 'verystrongpassword';
mysql>flush privileges;
mysql>quit;

mysql -u piler -p piler < util/db-mysql.sql

Install and configure sphinx search

Before installing sphinx (version prior to 2.0.6), I highly recommend to apply the fix to sphinxsearch-2.0.x/src/searchd.cpp mentioned in the FAQ at Q2.

After installing sphinx search, issue the following commands (be sure to check the sql_pass parameters) to overwrite the default sphinx config (be sure to use the correct path to sphinx.conf), set the mysql parameters (database, login, password), and initialize its database:

# cp etc/sphinx.conf.in /usr/local/etc/piler/sphinx.conf
# chmod +x /usr/local/etc/piler/sphinx.conf
# su - piler
$ indexer --all --config /usr/local/etc/piler/sphinx.conf

Configure mail relay for piler

Your users may want to forward some of their archived email to themselves. In order to do that piler needs a mail relay server. It's your choice where you put it, eg. on the piler host (to localhost, 127.0.0.1) or on another box.

Let's say you use postfix on 127.0.0.1:25/tcp, then edit /etc/postfix/master.cf

127.0.0.1:smtp      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       -       smtpd

Then you may define SMARTHOST as '127.0.0.1' and SMARTHOST_PORT '25' in config.php, see below. You may use a high port (>1024) instead the usual 25/tcp port, see the following example:

127.0.0.1:10026      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       -       smtpd

Set up cron jobs for piler user

5,35 * * * * /usr/local/libexec/piler/indexer.delta.sh
30   2 * * * /usr/local/libexec/piler/indexer.main.sh
40 3 * * * /usr/local/libexec/piler/purge.sh
*/15 * * * * /usr/bin/indexer --config /usr/local/etc/piler/sphinx.conf --quiet tag1 --rotate
*/15 * * * * /usr/bin/indexer --config /usr/local/etc/piler/sphinx.conf --quiet note1 --rotate
*/5 * * * *  /usr/bin/find /var/piler/www/tmp -type f -name i.\* -exec rm -f {} \;
*/5 * * * * /usr/bin/find /var/piler/error -type f|wc -l > /var/piler/stat/error
3 * * * * /usr/local/libexec/piler/watch_sphinx_main_index.sh
2 0 * * * /usr/local/libexec/piler/pilerpurge.py

Create a dedicated virtual host for piler

Please make sure you turned on rewrite support

mv webui /var/piler/www

Give permission to the webserver to write the tmp/ directory (Do not confuse it with the system /tmp directory!)

chown www-data:www-data /var/piler/www/tmp

Create /usr/local/etc/piler/config-site.php, and add every site specific variables to config-site.php. Any variable that presents in config-site.php overrides the config.php default values. This way your local settings may survive a gui upgrade when the contents of config.php is changed.

On the demo site we use the following config-site.php file:

<?php

$config['SITE_NAME'] = 'demo.mailpiler.org';
$config['SITE_URL'] = 'http://demo.mailpiler.org/';
$config['DIR_BASE'] = '/var/piler/www/';

$config['PILER_HOST'] = '1.2.3.4';
$config['SMTP_DOMAIN'] = 'demo.mailpiler.org';
$config['SMTP_FROMADDR'] = 'no-reply@demo.mailpiler.org';
$config['ADMIN_EMAIL'] = 'admin@demo.mailpiler.org';

Check out the contrib/webserver directory on how to setup a virtual host for apache and nginx.

Google Analytics Alternative