================================
ISPManCCP - Install Instructions
================================

The one thing ISPManCCP can't do for you is install
`python-ldap <http://python-ldap.sourceforge.net/>`_ and
`pyDNS <http://pydns.sourceforge.net/>`_, but most
distributions can provide that for you.

**NOTE**: If you choose not to install `pyDNS
<http://pydns.sourceforge.net/>`_, the only that will happen is that email
forwarding addresses will not be checked for a valid DNS MX record.
`python-ldap <http://python-ldap.sourceforge.net/>`_ on the other hand is
**required** and will make setup fail if not present on your system.

One way to see if your system already has those packages installed do::

    user@host $ python
    >>> import DNS
    >>> import ldap

If you have no errors on the above, you're fine.

After `python-ldap <http://python-ldap.sourceforge.net/>`_ and
`pyDNS <http://pydns.sourceforge.net/>`_ is installed, ISPManCCP
can then be installed with `Easy Install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_ by typing::

    user@host $ easy_install ISPManCCP

If you do not have the ``easy_install`` binary it probably means you also
don't have setuptools install. You should download the bootstrap script to
install setuptools if your distribution does not provide it, ie::

    user@host $ wget http://peak.telecommunity.com/dist/ez_setup.py
    user@host $ python ez_setup.py

You now have setuptools installed, however in some cases, for example debian
systems, ISPManCCP will still fail to compile.

If you're on debian, please do::

    user@host $ apt-get install libperl-dev
    user@host $ apt-get install python-dev

Then try to install ISPManCCP again.

Now make a config file as follows::

    user@host $ mkdir /etc/ispmanccp
    user@host $ cd /etc/ispmanccp
    user@host $ paster make-config ISPManCCP config.ini

I created a directory in ``/etc`` because ISPManCCP creates a ``data``
sub-directory where the ``config.ini`` resides if you don't change
``cache_data_dir`` and ``session_data_dir`` to point to an absolute path,
ie, without that ``%(here)s``.


You should now edit ``config.ini`` and change it to your needs.


Serve the application
---------------------

You can serve the application with `paster <http://pythonpaste.org/>`_ by typing::

    user@host $ paster serve /etc/ispmanccp/config.ini

Since most `ISPMan <http://ispman.net>`_ installations will already have
apache  installed, you can opt by having apache proxy requests to/from `paster
<http://pythonpaste.org/>`_. I find this the ideal setup because I can just run
`paster <http://pythonpaste.org/>`_ with a specific user and group(one with
permissions to read from the `ISPMan <http://ispman.net>`_ installation and
still use port 80.

Of course, running paster like shown on the above command means you have to do
it by hand. `Paster <http://pythonpaste.org/>`_ can be daemon'ized, so you
could create an init script.

Bellow I'll show you some examples on how you could use `paster
<http://pythonpaste.org/>`_ running as a daemon with user *ccp*, group
*ispman* and logging to */etc/ispman/ispmanccp.log*

Starting `paster <http://pythonpaste.org/>`_::

    user@host $ /usr/bin/paster serve --daemon --user=ccp --group=ispman \
      --log-file=/etc/ispmanccp/ispmanccp.log /etc/ispmanccp/config.ini start


Stopping `paster <http://pythonpaste.org/>`_::

    user@host $ /usr/bin/paster serve --daemon --user=ccp --group=ispman \
      --log-file=/etc/ispmanccp/ispmanccp.log /etc/ispmanccp/config.ini stop


Re-starting `paster <http://pythonpaste.org/>`_::

    user@host $ /usr/bin/paster serve --daemon --user=ccp --group=ispman \
      --log-file=/etc/ispmanccp/ispmanccp.log /etc/ispmanccp/config.ini restart


Now, here's a minimal apache *vhost* configuration example::

    <VirtualHost *:80>
        ServerName ccp.domain.tld
        ProxyPreserveHost On
        <Location />
            SetHandler None
            ProxyPass http://localhost:5000
            ProxyPassReverse http://localhost:5000
            AllowOverride None
            Order allow,deny
            Allow from all
        </Location>
    </VirtualHost>



And that's about it.

You can find more info on the
`ISPManCCP <http://ccp.ufsoft.org/>`_ site where bugs and new feature requests
should go to.
