Revision 4e3e3d24

b/docs/quick-install-admin-guide.rst
559 559

  
560 560
   ASTAKOS_DEFAULT_ADMIN_EMAIL = None
561 561

  
562
   ASTAKOS_IM_MODULES = ['local']
563

  
564 562
   ASTAKOS_COOKIE_DOMAIN = '.example.com'
565 563

  
566 564
   ASTAKOS_BASEURL = 'https://node1.example.com'
567 565

  
568
   ASTAKOS_SITENAME = '~okeanos demo example'
569

  
570
   ASTAKOS_RECAPTCHA_ENABLED = False
571

  
572
``ASTAKOS_IM_MODULES`` refers to the astakos login methods. For now only local
573
is supported. The ``ASTAKOS_COOKIE_DOMAIN`` should be the base url of our
574
domain (for all services). ``ASTAKOS_BASEURL`` is the astakos home page.
566
The ``ASTAKOS_COOKIE_DOMAIN`` should be the base url of our domain (for all
567
services). ``ASTAKOS_BASEURL`` is the astakos home page.
575 568

  
576 569
``ASTAKOS_DEFAULT_ADMIN_EMAIL`` refers to the administrator's email.
577 570
Every time a new account is created a notification is sent to this email.
......
579 572
it for now by setting its value to None. For more informations on this,
580 573
read the relative :ref:`section <mail-server>`.
581 574

  
582
.. note:: For the purpose of this guide, we have disabled recaptcha authentication.
583
    If you would like to enable it you have to edit the following options:
575
.. note:: For the purpose of this guide, we don't enable recaptcha authentication.
576
    If you would like to enable it, you have to edit the following options:
584 577

  
585 578
    .. code-block:: console
586 579

  
......
619 612
        MIDDLEWARE_CLASSES.remove('django.middleware.csrf.CsrfViewMiddleware')
620 613
        TEMPLATE_CONTEXT_PROCESSORS.remove('django.core.context_processors.csrf')
621 614

  
615
Enable Pooling
616
--------------
617

  
618
This section can be bypassed, but we strongly recommend you apply the following,
619
since they result in a significant performance boost.
620

  
621
Synnefo includes a pooling DBAPI driver for PostgreSQL, as a thin wrapper
622
around Psycopg2. This allows independent Django requests to reuse pooled DB
623
connections, with significant performance gains.
624

  
625
To use, first monkey-patch psycopg2. For Django, run this before the
626
``DATABASES`` setting in ``/etc/synnefo/10-snf-webproject-database.conf``:
627

  
628
.. code-block:: console
629

  
630
   from synnefo.lib.db.pooled_psycopg2 import monkey_patch_psycopg2
631
   monkey_patch_psycopg2()
632

  
633
If running with greenlets, it is also recommended to modify psycopg2 behavior
634
so it works properly in a greenlet context:
635

  
636
.. code-block:: console
637

  
638
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
639
   make_psycopg_green()
640

  
641
Use the Psycopg2 driver as usual. For Django, this means using
642
``django.db.backends.postgresql_psycopg2`` without any modifications. To enable
643
connection pooling, pass a nonzero ``synnefo_poolsize`` option to the DBAPI
644
driver, through ``DATABASES.OPTIONS`` in django.
645

  
646
All the above will result in an ``/etc/synnefo/10-snf-webproject-database.conf``
647
file that looks like this:
648

  
649
.. code-block:: console
650

  
651
   # Monkey-patch psycopg2
652
   from synnefo.lib.db.pooled_psycopg2 import monkey_patch_psycopg2
653
   monkey_patch_psycopg2()
654

  
655
   # If running with greenlets
656
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
657
   make_psycopg_green()
658

  
659
   DATABASES = {
660
    'default': {
661
        # 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle'
662
        'ENGINE': 'postgresql_psycopg2',
663
        'OPTIONS': {'synnefo_poolsize': 8},
664

  
665
         # ATTENTION: This *must* be the absolute path if using sqlite3.
666
         # See: http://docs.djangoproject.com/en/dev/ref/settings/#name
667
        'NAME': 'snf_apps',
668
        'USER': 'synnefo',                      # Not used with sqlite3.
669
        'PASSWORD': 'example_passw0rd',         # Not used with sqlite3.
670
        # Set to empty string for localhost. Not used with sqlite3.
671
        'HOST': '4.3.2.1',
672
        # Set to empty string for default. Not used with sqlite3.
673
        'PORT': '5432',
674
    }
675
   }
622 676

  
623 677
Database Initialization
624 678
-----------------------
......
835 889
pithos+ web client to get from astakos all the information needed to fill its
836 890
own cloudbar. So we put our astakos deployment urls there.
837 891

  
892
Pooling and Greenlets
893
---------------------
894

  
895
Pithos is pooling-ready without the need of further configuration, because it
896
doesn't use a Django DB. It pools HTTP connections to Astakos and pithos
897
backend objects for access to the Pithos DB.
898

  
899
However, as in Astakos, if running with Greenlets, it is also recommended to
900
modify psycopg2 behavior so it works properly in a greenlet context. This means
901
adding the following lines at the top of your
902
``/etc/synnefo/10-snf-webproject-database.conf`` file:
903

  
904
.. code-block:: console
905

  
906
   from synnefo.lib.db.psyco_gevent import make_psycopg_green
907
   make_psycopg_green()
908

  
909
Furthermore, add the ``--worker-class=gevent`` argument on your
910
``/etc/gunicorn.d/synnefo`` configuration file. The file should look something like
911
this:
912

  
913
.. code-block:: console
914

  
915
   CONFIG = {
916
    'mode': 'django',
917
    'environment': {
918
      'DJANGO_SETTINGS_MODULE': 'synnefo.settings',
919
    },
920
    'working_dir': '/etc/synnefo',
921
    'user': 'www-data',
922
    'group': 'www-data',
923
    'args': (
924
      '--bind=127.0.0.1:8080',
925
      '--workers=4',
926
      '--worker-class=gevent',
927
      '--log-level=debug',
928
      '--timeout=43200'
929
    ),
930
   }
931

  
838 932
Servers Initialization
839 933
----------------------
840 934

  

Also available in: Unified diff