Buildout configuration for {{{project}}}
========================================

.. contents:

This buildout contains by itself, all the configuration needed
to run {{{project}}} website: zope, Plone and webserver configuration
will be handled from here.

Usage
------

To run this buildout, you will need to install python 2.7. Check the
package manager of your operating system or download and install it
manually, either using the sources_ or using the python_buildout_.

You will also need to install virtualenv_ a tool to properly isolate
this buildout from external libraries. If you install Python using
for OS' package manager search for python-virtualenv and install that
package too. If you install it using the python_buildout_ you won't need
any extra step. If you have installed python from sources_, check
the `virtualenv installation guidelines`_.

From this point on, all these steps must be executed with a user
*without root permission*.

Create a virtualenv in this directory::

  $ virtualenv -p python2.7 .

Install buildout::

  $ ./bin/pip install -r requirements.txt

Run the buildout::

  $ ./bin/buildout -vv

Run the buildout with deployment configuration::

  $ ./bin/buildout -c deployment.cfg -vv

This will create a Zope instance, with all the products stated in the
buildout configuration. This Zope instance will be created as a ZEO client
so a ZEO server will also be created. You can manualy run this server and
client as follows::

  $ ./bin/zeo start
  $ ./bin/instance start
  or
  $ ./bin/instance fg

For production systems a supervisor job is created to run this site without
much effort::

  $ ./bin/supervisord

To stop everything::

  $ ./bin/supervisorctl stop all

To restart just one process::

  $ ./bin/supervisorctl
  MailMe                           RUNNING    pid 17576, uptime 45 days, 23:09:24
  Memmon                           RUNNING    pid 17575, uptime 45 days, 23:09:24
  zeoprojectname                   RUNNING    pid 17577, uptime 45 days, 23:09:24
  zopeprojectname8080              RUNNING    pid 25846, uptime 4 days, 20:29:37
  supervisor> restart zopeprojectname

Or shutdown all processes::

  $ ./bin/supervisorctl shutdown


For production environment, you will need to install Apache or Nginx using your
OS' package manager or either manually. Please check with your System Administrator
the steps needed to achieve that.

After installing Apache or Nginx, ask your System Administrator to symlink
the configuration file for either Apache or Nginx generated by this buildout
that live on ./etc/apache-vh.conf or ./etc/nginx-vh.conf

You shouldn't need to change the configuration on those files, they will be
rewritten each time buildout is run.

If you change any configuration that lives on those files (port numbers,
server names, ...) you will need to restart your Apache/Nginx.

This buildout also configures a cronjob to start the supervisor when
the server reboots. Check the services.cfg file for details.

This buildout configures a cronjob to pack the ZEO database once a wheek. Check
the services.cfg file for details.

This buildout provides a configuration file for instance log rotation. The file
is created inside the `etc` folder: logrotate.conf You will need to symlink it
to your /etc/logrotate.d/ directory to have it running.


We also provide a basic Varnish configuration on the file varnish.cfg and also HAProxy
configuration, if you want to use a caching server and/or a load balancer. Check
the files varnish.cfg and haproxy.cfg



.. _sources: https://www.python.org/downloads/
.. _python_buildout: https://github.com/collective/buildout.python
.. _virtualenv: https://pypi.python.org/pypi/virtualenv
.. _`virtualenv installation guidelines`: http://www.virtualenv.org/en/latest/virtualenv.html#installation
