install.stx 7.79 KB
Newer Older
Sebastien Robin's avatar
Sebastien Robin committed
1 2 3 4 5 6 7 8 9 10
Setting up Synchronization

  Installing packages

    First install zope and all products you might need (CPS...)
    Then install products ERP5Type, CMFActivity, ERP5SyncML.
    available with the nexedi cvs.
    And also CMFWiki, psyco, available from zope and python. You will
    also need xml for python.

Sebastien Robin's avatar
Sebastien Robin committed
11 12 13 14 15 16 17 18 19
    We use for the synchronization a tool wich is able to generate
    xupdate xml. Xupdate xml is described on this website ::
  
      http://www.xmldb.org/xupdate/

    We have made on own tool to generate xupdate xml, so you need
    to install the erp5diff software.
    

Sebastien Robin's avatar
Sebastien Robin committed
20 21 22
    If you want the synchronization working with CPS, you will need
    need the ERP5CPS products, available on the nexedi cvs.

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
  Install Site instances

    If you want to do synchronization, you should have at least two Site
    instances (it can actually be either ERP5 Site or CPS Site). One of them
    has to be a master and all other have to be clients.

    Any modification made on any Site will be sent to the master, and the master
    send back each modification to each client. Like this, all Sites (master and 
    clients) are informed about modifications.

    Let's say we have one zope running on our local box. We will create for
    example two CPS Sites, the fist one wich will be the master with the id 
    'cps', and the second one wich will be the client with the id 'cps_client'.

    If you want to make sure that your box is installed correctly, you should
    go on one object of your site and then addto the url the method 'asXML' like
    this ::

      http://localhost:9673/cps/workspaces/members/seb/gggggggggggggg/asXML

    If everything is fine, you should have no errors and you should see the
    xml corresponding to your object.

46 47
  Installing the synchronization tool

48 49
    Go to the zope management interface and then add to all your sites (master
    and clients) an ERP5SyncML Tool.
50 51 52 53 54 55 56 57 58

  Configuration for synchronization by http

    The particular thing with the synchronization by http is that we need
    to use active objects. Active Object allows to differ a method call.
    We need it in order to differ html request, active object allows to
    send all html request to a queue.

    Don't worry, it is really simple to use. First, you have to add inside
59 60 61 62 63 64
    all your sites (master and clients) a 'CMFActivity Tool'. There is nothing 
    to configure. Then, only thing needed is to modify the script 
    'zope_tic_loop' located inside your CMFActivity product. Since it requires
    many changes you can take my following example and then you have to modify 
    the user name, the user password, the ip where your zope is running and 
    the id of your sites. 
65 66 67 68 69

    For example, my script looks like this ::

      #!/bin/bash
      while true; do
70
      # Site 1 (the master one)
71 72
      wget -O /tmp/zope_distribute.out http://seb:password@localhost:9673/cps/portal_activities/distribute?node_count:int=1
      wget -O /tmp/zope_tic.out http://seb:password@localhost:9673/cps/portal_activities/tic?processing_node:int=1
73
      # Site 2 (the client one)
74 75 76 77 78 79 80 81 82 83
      wget -O /tmp/zope_distribute.out http://seb:password@localhost:9673/cps_client/portal_activities/distribute?node_count:int=1
      wget -O /tmp/zope_tic.out http://seb:password@localhost:9673/cps_client/portal_activities/tic?processing_node:int=1
      sleep 5
      done

    This allows to run all html requests each time there is a new one. It is
    a nice idea to run the script like this ::
    
      nohup ./zope_tic_loop &

84 85 86 87 88 89 90 91 92 93 94
    The last thing to do is to configure you synchronization tool inside
    the zope management interface. You have in this tool many tabs. The 
    'publication' tab is used on the server and the 'subscription' tab 
    is used on all clients. A publication is a setting for something we
    want to share with others. So on the master we have to specify as
    many publication as the number of folders we want to share. A subscription
    is a setting for something we want to synchronize from a master, so on each
    client we have to specify as many subscriptions as the number of folders
    we want to synchronize with the master.

    I do have on my server side the following publication ::
95 96 97 98 99 100

      id : Repository
      Publication Url : http://localhost:9673/cps
      Destination Path : /cps/portal_repository
      Query : objectValues (it will be completed automatically)
      XML Mapping : asXML
Sebastien Robin's avatar
Sebastien Robin committed
101
      GPG key name :    (it can stay empty)
102

103
    I do have on my client side the following subscription ::
104 105

      id : Repository
106
      Publication Url : http://localhost:9673/cps
Sebastien Robin's avatar
Sebastien Robin committed
107
      Subscription Url : http://localhost:9673/cps_client/Repository 
108
      Destination Path : /cps_client/portal_repository
109 110
      Query : objectValues (it will be completed automatically)
      XML Mapping : asXML
Sebastien Robin's avatar
Sebastien Robin committed
111
      GPG key name :    (it can stay empty)
112

113 114 115 116 117 118 119 120 121 122
  CPS Synchronization

    This is just a note for people who wants to synchronize some CPS Sites, you have to
    synchronize theses directories ::

      /cps_site/portal_repository
      /cps_site/workspaces
      /cps_site/sections

  Starting synchronization
123

124 125 126
    The synchronization starts only from a client, so you should go on one of the client
    instance. Then you have to go on the portal_synchronizations and select one of the
    subscriptions and hit 'Sync'.
127 128 129

  Configuration for synchronization by email

130
    Actually you need to add a 'CMFMailin Tool', there is nothing to configure.
131 132 133 134
    Then you have to make sure you get the right mail_received.py. The
    mail_received script has to be modified in order to use SubSync or PubSync.
    SubSync is used if we are on the client side, PubSync is used if we are on
    the master side.
Sebastien Robin's avatar
Sebastien Robin committed
135

136
    You can find the mail_received inside the ERP5SyncML/skins/ folder. You can
Sebastien Robin's avatar
Sebastien Robin committed
137 138 139 140
    just make a copy inside your ZODB. For that, you should go to your cps site,
    inside portal_skins and then select the "custom" folder. Then add a script
    python called "mail_received". Then set the parameter list to "theMail", and
    then paste the content of ERP5CPS/skins/mail_received.py .
Sebastien Robin's avatar
Sebastien Robin committed
141 142


Sebastien Robin's avatar
Sebastien Robin committed
143 144
    Inside the synchronization tool (cps_site/portal_synchrozations), 
    the publication should looks like this ::
Sebastien Robin's avatar
Sebastien Robin committed
145 146

      id : Repository
147
      Publication Url : mailto:cps_server@localhost
Sebastien Robin's avatar
Sebastien Robin committed
148 149 150 151 152 153 154
      Destination Path : /cps/portal_repository
      Query : objectValues (it will be completed automatically)
      XML Mapping : asXML

    Inside the synchronization tool, the subscription should looks like this ::

      id : Repository
155 156
      Publication Url : mailto:cps_server@localhost
      Subscription Url : mailto:cps_client@localhost
Sebastien Robin's avatar
Sebastien Robin committed
157 158 159 160
      Destination Path : /cps_client/portal_repository
      Query : objectValues (it will be completed automatically)
      XML Mapping : asXML

Sebastien Robin's avatar
Sebastien Robin committed
161 162 163 164
    If you want to synchronize, you should have at least 2 instances of cmf sites. One of
    them should act as a server, and all over as client. On the server you have to setup
    publications and on client you have to setup subscriptions.

165
  Configure your mail server (email synchronization)
Sebastien Robin's avatar
Sebastien Robin committed
166 167 168 169 170

    You should set some aliases so that your mail server will directly sends
    mail to zope, for example in /etc/aliases :

    seb_syncml: "|/home/seb/erp5/CMFMailIn/sendMailToZope.py http://seb:password@localhost:9673/nexedi.org/portal_mailin/"
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

    This is really important that the master and all clients can send mails each others.
    On each box I set a local postfix server and I also use fetchmail every 20 secondes in
    order to do a synchronization not too long. A nice way to do is to create a specific
    user, for example I do have on my box an user 'seb_syncml'. This user have on his 
    home directory an file .fetchmailrc like this ::

      set daemon 20
      set syslog
      defaults user "seb_syncml"
              pass "password"
              smtpname "seb_syncml@localhost"
        fetchall
      poll localhost proto imap port 11143