Changes between Initial Version and Version 1 of quintagroup.transmogrifier/plone3-4


Ignore:
Timestamp:
Nov 23, 2010 10:11:44 AM (13 years ago)
Author:
olha
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • quintagroup.transmogrifier/plone3-4

    v1 v1  
     1= Content migration from Plone 3 to Plone 4 = 
     2 
     3[[PageOutline]] 
     4 
     5The following example describes content migration from Plone 3.2.3 instance to Plone 4.0 buildout. 
     6 
     7------------------------------------------------------------------------------- 
     8 
     9Before initiating migration you have to create buildouts for old Plone 2.1 site and new Plone 3.2 site. These buildouts should include some extra packages, since we will use a special tool - transmogrifier for content migration. See the following explanations. 
     10 
     11== 1. Create buildout for Plone 2.1 site == 
     12 
     13Plone 2.1-based websites were not managed by buildout. Zope instances were created manually and Plone 2.1 archive with all required products was simply extracted into the Products subdirectory. That's why old Zope instance should be transformed to buildout. To accomplish this - do the following steps: 
     14 
     151. Our buildouts require '''Python 2.4''' with several additional packages. If you don't have this version of Python, you will have to install it. Find more about this at http://plone.org/documentation/tutorial/buildout/prerequisites page. 
     16 
     172. Download '''libxml2-python''' package from ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.21.tar.gz, unpack and install it: 
     18{{{ 
     19tar -xzf libxml2-python-2.6.21.tar.gz 
     20cd libxml2-python-2.6.21 
     21python setup.py install 
     22}}} 
     23 
     243. Create a blank buildout: 
     25{{{ 
     26paster create -t plone2.5_buildout 
     27}}} 
     28where '''paster''' - is a special python script (it goes with !ZopeSkel bundle), used for creating different Python projects and in our case it creates Plone buildout.  
     29 
     30Note the project template given in '''-t plone2.5_buildout''' option. We use Plone 2.5 template because there is no template for Plone 2.1 buildout. We can use the existing Plone 2.5 template with minor modifications. After typing the command and pushing ''Enter'' button you will need to answer some questions: 
     31 
     32 * project name - directory, where buildout will be created (for example plone21) 
     33 * path to Zope 2 installation - if you use Zope 2.8 for your Zope instance set this to Zope 2.8 directory, for example ~/zope-2.8.5. If Zope 2.7 is used - leave it blank. 
     34 * path to the directory, containing Plone products - set this to Products subdirectory of your Zope instance, for example ~/instance/Products 
     35 
     364. Go to '''src''' subdirectory of the created buildout: 
     37{{{ 
     38cd plone21/src 
     39}}} 
     40and check out required '''transmogrifier packages''' from svn repository: 
     41{{{ 
     42svn co http://svn.quintagroup.com/products/quintagroup.transmogrifier/branches/plone-2.1/collective.transmogrifier collective.transmogrifier 
     43svn co http://svn.quintagroup.com/products/quintagroup.transmogrifier/branches/plone-2.1/plone.app.transmogrifier plone.app.transmogrifier 
     44svn co http://svn.quintagroup.com/products/quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier quintagroup.transmogrifier 
     45}}} 
     46Then go to '''Products''' sudirectory of the buildout and check out '''Marshall''' product: 
     47{{{ 
     48cd ../products 
     49svn co http://svn.plone.org/svn/archetypes/Marshall/tags/1.0.0 Marshall 
     50}}} 
     51 
     525. Go to buildout directory: 
     53{{{ 
     54cd .. 
     55}}} 
     56and edit '''buildout.cfg''' file, removing or commenting '''plone''' value in '''parts''' option of buildout section and adding transmogrifier packages in required places. Final buildout.cfg might look like this: 
     57{{{ 
     58[buildout] 
     59parts =  
     60#    plone 
     61    productdistros 
     62    instance 
     63    zopepy 
     64... 
     65eggs = 
     66    ... 
     67    quintagroup.transmogrifier 
     68... 
     69develop = 
     70    src/collective.transmogrifier 
     71    src/plone.app.transmogrifier 
     72    src/quintagroup.transmogrifier 
     73... 
     74[instance] 
     75... 
     76zcml = 
     77    quintagroup.transmogrifier 
     78... 
     79}}} 
     80Additional modification if you dont' have Zope 2.8: 
     81{{{ 
     82[zope2] 
     83... 
     84url = http://www.zope.org/Products/Zope/2.8.5/Zope-2.8.5-final.tgz 
     85}}} 
     86 
     876. Run buildout: 
     88{{{ 
     89python bootstrap.py 
     90bin/buildout 
     91}}} 
     92 
     937. Copy Data.fs file from Zope instance to buildout: 
     94{{{ 
     95cp /path/to/instance/var/Data.fs var/filestorage/ 
     96}}} 
     97 
     988. Check whether everything works fine by starting Zope: 
     99{{{ 
     100bin/instance fg 
     101}}} 
     102 
     103== 2. Content export == 
     104 
     105Content migration is carried out with '''transmogrifier''' - a tool for creating configurable pipelines with sections for transforming some input data. In our case pipeline is used for exporting/importing content; pipeline configuration contains setting for sections, that do all work. quintagroup.transmogrifier package contains default pipeline configuration for content migration. Configuration has ini-syntax, that's why it looks in the same way as buildout configuration. 
     106 
     107Now let's get to exporting process. In the browser open the following address: http://localhost:8080; in ZMI go to the Plone site, which content you want to migrate. 
     108 
     109Add '''CMF Setup tool''' in this site, which will be added with a '''portal_setup''' name. Open this tool and on '''Properties''' tab in '''Active site configuration''' field select '''Transmogrifier''', then click on '''Update''' button. Then go to '''Export''' tab and from the list of '''Available Export Steps''' select '''Content''' and click on '''Export selected steps''' button. Content exporting process will begin, its progress will be displayed in the terminal, in case Zope was started in fg mode. As a result content will be exported and you'll get content archive in the browser. Save this archive somewhere in a file system add unpack it to some directory. Then add empty '''quintagroup.transmogrifier-import.txt''' file in that directory and pack it. This can be done with next commands: 
     110{{{ 
     111mkdir content 
     112cd content 
     113tar -xzf path/to/setup_tool-xxxxxxxxxxxxxx.tar.gz 
     114touch quintagroup.transmogrifier-import.txt 
     115tar -czf content.tgz quintagroup.transmogrifier-import.txt structure 
     116}}} 
     117After that '''content.tgz''' is the archive which will be used for importing content. 
     118 
     119== 3. Create buildout for Plone 3.2 site == 
     120For this buildout use the same Python interpreter as for Plone 2.1 buildout. 
     121 
     1221. Create a blank buildout: 
     123{{{ 
     124paster create -t plone3_buildout 
     125}}} 
     126Set project name - directory where buildout will be created (for example: plone32). Also, set HTTP port to different value than 8080, if you plan to run two buildouts at the same time (for example 8081). 
     127 
     1282. Add newer versions of products to the buildout that were used in old Plone 2.1 site and were related to content. 
     129 
     1303. Go to '''src''' subdirectory of buildout: 
     131{{{ 
     132cd plone32/src 
     133}}} 
     134and check out required '''transmogrifier''' packages from repositories:  
     135{{{ 
     136cd plone32/src 
     137svn co http://svn.quintagroup.com/products/quintagroup.transmogrifier/branches/plone-3.1/collective.transmogrifier collective.transmogrifier 
     138svn co http://svn.plone.org/svn/collective/plone.app.transmogrifier/trunk plone.app.transmogrifier 
     139svn co http://svn.quintagroup.com/products/quintagroup.transmogrifier/trunk quintagroup.transmogrifier 
     140}}} 
     141 
     1424. Go to the buildout directory  
     143{{{ 
     144    cd .. 
     145}}} 
     146and edit '''buildout.cfg''' file, adding configuration for transmogrifier packages. After this buildout.cfg may look like this: 
     147{{{ 
     148[buildout] 
     149... 
     150eggs = 
     151    ... 
     152    quintagroup.transmogrifier 
     153... 
     154develop = 
     155    src/collective.transmogrifier 
     156    src/plone.app.transmogrifier 
     157    src/quintagroup.transmogrifier 
     158... 
     159[instance] 
     160... 
     161zcml = 
     162    quintagroup.transmogrifier 
     163... 
     164}}} 
     165 
     1665. Run buildout: 
     167{{{ 
     168python bootstrap.py 
     169bin/buildout 
     170}}} 
     171 
     1726. Start zope: 
     173{{{ 
     174bin/instance fg 
     175}}} 
     176 
     177== 4. Content Import == 
     178Open the following address http://localhost:8081/ in the browser, add new Plone site and install all required products. Go to '''portal_setup''' tool and on '''Import''' tab select archive with content and then click on '''Import uploaded tarball''' button. Content importing will start, dislpaying its progress in the terminal, in case Zope was started in fg mode. 
     179 
     180== Migration Configuration == 
     181Export and import processes are controlled by configuration files. Default configuration was used in previous sections, which is located in file system  - in '''quintagroup.transmogrifier''' package. It's registered with ZCML in configure.zcml file of this package: 
     182 
     183{{{ 
     184<configure 
     185    xmlns:transmogrifier="http://namespaces.plone.org/transmogrifier"> 
     186... 
     187    <transmogrifier:registerConfig 
     188        name="export" 
     189        title="Export pipeline configuration" 
     190        description="This is a Plone content export pipeline configuration." 
     191        configuration="export.cfg" 
     192        /> 
     193 
     194    <transmogrifier:registerConfig 
     195        name="import" 
     196        title="Import pipeline configuration" 
     197        description="This is a Plone content import pipeline configuration." 
     198        configuration="import.cfg" 
     199        /> 
     200... 
     201</configure> 
     202}}} 
     203You may notice in this configure.zcml fragment that transmogrifier pipeline configuration is registered by '''transmogrifier:registerConfig''' ZCML directive, that has 4 parameters: 
     204 * name - not required (if not provided - configuration will be named as '''default''', but it is recommended to provide the name, since name must be unique, name duplication is not acceptable); 
     205 * title - not required; 
     206 * description - not required; 
     207 * configuration - required path to file with pipeline configuration. 
     208 
     209In this fragment two configurations with names '''export''' (export.cfg file) and '''import''' (import.cfg file) were registered. They can be overridden by registrating configurations with the same names in '''overrides.zcml''' file. '''quintagroup.transmogrifier.simpleblog2quills''' and '''quintagroup.transmgorifier.pfm2pfg''' packages referenced in "Additional packages" section of this document perform such overriding. 
     210 
     211You can also modify configuration in ZMI. For that open the following address: http://localhost:8081/site/@@pipeline-config in browser, replacing ''site'' with your site id. In Plone 3.2 you can go to this page from '''Site setup''' page http://localhost:8081/site/plone_control_panel (if quintagroup.transmogrifier product was installed by !QuickInstaller), -> Add-on products configuration -> '''Content migration'''. When you click Save button modified configuration is saved in database and will be used instead of default (that registered with ZCML). 
     212 
     213You can do a little change in export configuration for storing content not in tarball archive, but in the same file system directory (this is required for big sites migration, because when exporting to archive, it's stored in memory and this will require its big amount). Configuration of such export is the following: 
     214{{{ 
     215[transmogrifier] 
     216pipeline = 
     217    sitewalker 
     218    manifestexporter 
     219    fileexporter 
     220    marshaller 
     221    propertiesexporter 
     222    commentsexporter 
     223    datacorrector 
     224    writer 
     225    EXPORTING 
     226 
     227[sitewalker] 
     228blueprint = quintagroup.transmogrifier.sitewalker 
     229 
     230[manifestexporter] 
     231blueprint = quintagroup.transmogrifier.manifestexporter 
     232 
     233[fileexporter] 
     234blueprint = quintagroup.transmogrifier.fileexporter 
     235 
     236[marshaller] 
     237blueprint = quintagroup.transmogrifier.marshaller 
     238 
     239[propertiesexporter] 
     240blueprint = quintagroup.transmogrifier.propertiesexporter 
     241exclude = title 
     242 
     243[commentsexporter] 
     244blueprint = quintagroup.transmogrifier.commentsexporter 
     245 
     246[datacorrector] 
     247blueprint = quintagroup.transmogrifier.datacorrector 
     248sources = 
     249    marshall 
     250 
     251[writer] 
     252blueprint = quintagroup.transmogrifier.writer 
     253context = directory 
     254path = /path/to/export/directory/ 
     255prefix = structure 
     256 
     257[EXPORTING] 
     258blueprint = quintagroup.transmogrifier.logger 
     259keys =  
     260    _type 
     261    _path 
     262}}} 
     263The only change is in '''[writer]''' section in which has two extra options added - '''context = directory''' (determines that files will be created in file system instead of the default archive storage) and '''path = /path/to/export/directory/''' (directory, where they will be created). 
     264 
     265I recommend you to modify configuration only if you have a good idea of what you are doing and how transmogrifier works. Read docs in collective.transmogrifier, plone.app.transmogrifier and quintagroup.transmogrifier packages for more information. 
     266 
     267== Additional packages == 
     268 
     269Explained migration procedure works fine if your site contains default Plone content types. For cases when additional Plone products add new content types - their migration should be accomplished in different way. The following are packages used for such cases: 
     270 
     2711. Blog migration from !SimpleBlog to Quills: 
     272[http://svn.quintagroup.com/products/quintagroup.transmogrifier.simpleblog2quills/trunk/ quintagroup.transmogrifier.simpleblog2quills] 
     273 
     2742. Form migration from !PloneFromMailer to !PloneFormGen: 
     275[http://svn.quintagroup.com/products/quintagroup.transmogrifier.pfm2pfg/trunk/ quintagroup.transmogrifier.pfm2pfg] 
     276 
     277These two packages are added into buildout in the same way. For example, buildout.cfg with added quintagroup.transmogrifier.pfm2pfg package looks like this: 
     278{{{ 
     279[buildout] 
     280... 
     281eggs = 
     282    ... 
     283    quintagroup.transmogrifier.pfm2pfg 
     284... 
     285develop = 
     286    src/collective.transmogrifier 
     287    src/plone.app.transmogrifier 
     288    src/quintagroup.transmogrifier 
     289    src/quintagroup.transmogrifier.pfm2pfg 
     290... 
     291[instance] 
     292... 
     293zcml = 
     294    quintagroup.transmogrifier.pfm2pfg 
     295... 
     296}}}