By Ingeniweb. A Django site.
Septembre 17, 2008
» How to install zope.testrecorder with buildout


Hi,

zope.testrecorder is a tool to record navigation browser for doctest. In this post I explain how install it with buildout.

In your buildout.cfg :

[buildout]

parts =
  zope2
  fakezope2eggs
  ...

eggs =
  ...
  zope.testrecorder

[fakezope2eggs]
recipe = z3c.recipe.fakezope2eggs
additional-fake-eggs = ZODB3

[instance]
...

eggs =
  ...
  zope.testrecorder

zcml =
  ...
  zope.testrecorder

Relaunch buildout and restart instance and now go to
http://<zope host>:<zope port>/++resource++recorder/index.html
You are ready to record you’re doctest.

Juillet 8, 2008
» iw.recipe.pound is dead, viva plone.recipe.pound


Please notice that iw.recipe.pound was renamed to plone.recipe.pound. So if you have some buildouts with iw.recipe.pound please their configuration so they use plone.recipe.pound. iw.recipe.pound is not longer maintained.

New option in 0.5 release : socket path (thanks Mathieu) , fixed some doctests (Cheettah requirement), added a run script (as runzope) in bin directory (thanks to Rocky)

Regards Youenn.

Juin 13, 2008
» Mock For ldap


Hi !

I work at the present time to an project with a lot data provided by an ldap server. The schema of this ldap is really elaborate . To reproduce it in a real ldap server is very difficult. How can I test my terrific code witch consist on an specific vocabularies and a set of PAS plugins ?

The response : a mock ldap object that give to my eggs a real API for ldap.

You can found it here : http://products.ingeniweb.com/catalog/iw.mock.ldap

The goal of this egg : testing component witch use ldap server without ldap. But also provide some good data in order to have some good test. So iw.mock.ldap read an real ldif file and you can search via ldap api (search_s).

It’s not perfect but for me I found very easy to test ldap component.

So how use it ?

In your buildout

[buildout]
eggs =

iw.mock.ldap

[zinstance]

eggs =

iw.mock.ldap

zcml =

iw.mock.ldap

After in you’re project where you want have some test you create a structure like that::

path-to-your-egg/mock
path-to-your-egg/mock/__init__.py
path-to-your-egg/mock/data.ldif

In __init__.py you put this boiler code::

import sys

from zope.interface import implements
from zope.component import adapts
from zope.component import provideAdapter

from iw.mock.ldap.interfaces import ILdifFile
from iw.mock.ldap.interfaces import ILdifReader
import iw.mock

class LdifFile(object):

implements(ILdifFile)
adapts(ILdifReader)

def __init__(self, context):
self.context = context

def open(self):
return file(os.path.join(os.path.dirname(__file__),’data.ldif’))

provideAdapter(LdifFile)

sys.path.insert(0, os.path.dirname(iw.mock.__file__))
from iw.mock import ldap
reload(ldap)


You can also register your adapter in an zcml (example test.zcml)

<configure xmlns=”http://namespaces.zope.org/zope”>
<adapter factory=”.mock.LdifFile”/>
</configure>

And now in you’re test you import path-to-your-egg/mock and all connections and request ldap pass
by iw.mock.ldap and use your data in data.ldif

» iw.recipe.pound


Hi !

I’m pleased to announce a new version of iw.recipe.pound.
The recipe is divided now in two part:

  1. A build part (iw.recipe.pound:build)
  2. A config part (iw.recipe.pound:config)

The build part accept new options as localisation of libssl.
If you have again need of compilation option (to disable some module perhaps) the extra-options keyword is for you .

The config part accept now all general configuration of pound server (see man pound). You can define TimeOut globally ( a big mistake I know ! ). The recipe give choice also to define Priority and TimeOut by backend server. The bind ip adresss of http server is required now ( before it’s always 127.0.0.1 !! so if apache or squid is located in another server the recipe serves to nothing ).

Now the backends configuration looks like that :

one  127.0.0.1:80 127.0.0.1:8080 127.0.0.1:8081,1

where :
one is the name of cluster
127.0.0.1 is the bind ip adress
80 the port of pound http server

After there is a list of backend of this pound server. Each backend have this form :

<ip backend>:<port backend>[,<priority backend>,[TimeOut backend]]

Notice that if you want define timeout you must define also priority

I hope that this recipe give you satisfaction. Don’t hesitate to submit an issue at http://trac.ingeniweb.com/ if you have problem.

Regards Youenn

Mai 13, 2008
» plone.recipe.apache


In this post we describe how to install and configure an apache server in front of zope with buildout.
It’s very simple. Ok let’s go

1 - Create an zope instance with buildout

If you have a paster in your system we create an buildout skeleton with it:

$ paster create -t plone3_buildout

This create an buildout.cfg witch create an zope server (listen in 8080)

$ python2.4 bootstrap.py
$ bin/buildout

Create an instance named plone

$ bin/instance start

Ok now with your favourite browser you can see in http://localhost:8080/plone
the plone instance..
We can declare a localdns (for test purpose) that says that www.testit.com go to localhost..
So http://www.testit.com:8080/plone works also.

2 - Apache serve your plone instance

It’s possible now with buildout
We add an apache server to serve our zope in http port
Edit buildout.cfg and put this config in buildout::

[buildout]
parts =
...
apachebuild
apacheconf
...
[apachebuild]
recipe = plone.recipe.apache:build
url = http://mir2.ovh.net/ftp.apache.org/dist/httpd/httpd-2.2.8.tar.gz

[apacheconf]
recipe = plone.recipe.apache:config
bind = 80
backends =
 www.testit.com:127.0.0.1:8080
zope2_vhm_map =
 www.testit.com:/plone

You have already an httpd installed in your system . No problem
delete apachebuild conf and add in apacheconf a new directive mainconfig as this

[apacheconf]
mainconfig = /etc/apache2/apache2.conf
recipe = plone.recipe.apache:config
bind = 80
backends =
 www.testit.com:127.0.0.1:10080
zope2_vhm_map =
 www.testit.com:/plone

BE CAREFUL : the user that launch buildout must write in mainconfig so give to him the good right !! Also in order to work the current apache server must have rewrite and proxy module allowed.

So now relaunch buildout::

# bin/buildout
Getting distribution for 'plone.recipe.apache'.
Got plone.recipe.apache 0.1.0.
...
apachebuild: Downloading apache tarball.
apachebuild: Compiling Apache
...
apachebuild: Unpacking and configuring
checking for chosen layout... Apache
...
Installing apacheconf.

And after, start (or restart) apache server

# sudo bin/apachectl start

and now::
http://www.testit.com/ go to your plone instance.. Viva buildout !

Février 22, 2008
» About iw.recipe.squid


I’m pleased to announce a new release of iw.recipe.squid. It’s aimed to configure easily an squid proxy server with zope. It’s does the same things of squid generator in cache fu product which generate some config for squid in order to work with zope. I was really inspired of this. But it work’s with buildout with some difference. So what’s else ? How configure squid with zope and apache ? Really simple (I hope)

1- install a squid and an apache server

2- you create an buildout.cfg with some config

[buildout]
parts = squid

[squid]
recipe=iw.recipe.squid
squid_accelerated_hosts =
www.mysite.com localhost:8080/myplone

www.mysite.com is the dns host name of your plone site
myplone is the plone instance name of your plone
localhost is the host name of zope server location
8080 is the port of your zope server

3- you launch buildout

> buildout -c buildout.cfg

this create several directory with some config in their.
in parts/squid/etc you have all config to work with squid
in parts/squid/apache you have all config to work with apache server
in parts/squid/log you have all log file for apache virtual host and squid acces log
in bin you have a squid controler script witch work with parts/squid/etc/squid.conf specific config

5 - finally

You must create a cache for squid

> bin/squidctl createswap

And launch your squid

> bin/squidctl start

After make symbolic link in your apache configuration location ie:

ln -s <absolute path to parts/squid/apache/*> <absolute path to apache virtual host>

And now restart apache and you have an apache/squid/zope architecture working (I hope).

The future

I’m planed to give more flexibility to the recipe.

Imagine you have 10 plone site in your zope server and you want to configure their with iw.recipe.squid . You must declare an dns name for all your plone site. Not always easy !!
So the next step is the capibility to iw.recipe.squid to deal with this use case.

The config MUST change to this way :

www.mysite.com/ localhost:8080/myplone
www.mysite.com/site2 localhost:8080/myplone2
www.mysite.com/site/myplone localhost:8080/myplone3

so when I take a browser and I type http://www.mysite.com/site2 I go to myplone2 instance without declare a specific dns name for it.

Décembre 7, 2007
» Bienvenue le blog de youenn

    Bonjour à toutes et tous,

    Ce blog à pour vocation de partager mes expériences à propos de developpement sous zope/plone. Et je vais en avoir à dire car je découvre tout les jours de nouvelle chose. C'est ca que je trouve bien au niveau de ce serveur d'application c'est que c'est riche en découverte. Donc êtes-vous prêt à prendre la lampe frontal pour la grande exploration de zope et de plone ? MOI OUI, et c'est le but de ce blog.