<div dir="ltr">Dear all,<div>please find here</div><div><br></div><div><a href="https://github.com/GeoNode/geonode/commit/f10163a3ffdb73a4bdfdedc0308427d014354ec4">https://github.com/GeoNode/geonode/commit/f10163a3ffdb73a4bdfdedc0308427d014354ec4</a></div><div><br></div><div>a first implementation of a script able to use the JSON fixtures backedup by backup command, mangle them and add the layers and maps (along with attributes and metadata) to a GeoNode instance.</div><div><br></div><div>The script is able to import also Layers and Maps from GeoNode 2.0 accordingly to the configuration.</div><div><br></div><div>Notice that the script ADDs the resources to an existing instance, even if it has Layers and Maps already configured. Just be sure to not add duplicates otherwise GeoNode will complain about it.</div><div><br></div><div><b>WARNING: </b>Still missing the GeoServer automatic part. The GeoServer data for the moment must be replicated manually. This is a work-in-progress.</div><div><br></div><div><b>NOTICE:</b> Working on converting the script into a DJango management command like the backup and restore ones.</div><div><br></div><div>How the script works</div><div>===================</div><div><br></div><div>1. It needs basically two things:</div><div><br></div><div>   a) JSON fixtures from GN 2.0 or 2.4 in a zip file (those can be obtained using the backup command)</div><div><br></div><div>   b) An existing user defined into the target GeoNode which will became the new owner of the layers.</div><div><br></div><div>2. Edit the settings.ini file as follows:</div><div><br></div><div><div><font face="monospace, monospace" size="1">[targetdb]</font></div><div><font face="monospace, monospace" size="1">dbname = geonode_rst</font></div><div><font face="monospace, monospace" size="1">host   = localhost</font></div><div><font face="monospace, monospace" size="1">port   = 5432</font></div><div><font face="monospace, monospace" size="1">user   = geonode</font></div><div><font face="monospace, monospace" size="1">passwd = geonode</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">[fixtures]</font></div><div><font face="monospace, monospace" size="1">#NOTE: Order is important</font></div><div><font face="monospace, monospace" size="1">apps   = people,account,avatar.avatar,base.license,base.topiccategory,base.region,base.resourcebase,base.contactrole,base.link,base.restrictioncodetype,base.spatialrepresentationtype,guardian.userobjectpermission,guardian.groupobjectpermission,layers.uploadsession,layers.layer,layers.attribute,maps.map,maps.maplayer,documents.document,taggit</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">dumps  = people,accounts,avatars,licenses,topiccategories,regions,resourcebases,contactroles,links,restrictioncodetypes,spatialrepresentationtypes,useropermissions,groupopermissions,uploadsessions,layers,attributes,maps,maplayers,documents,tags</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1"># Migrate from GN 2.0 to GN 2.4</font></div><div><font face="monospace, monospace" size="1">#migrations = base.resourcebase,layers.layer,layers.attribute,maps.map,maps.maplayer</font></div><div><font face="monospace, monospace" size="1">#manglers   = gn20_to_24.ResourceBaseMangler,gn20_to_24.LayerMangler,gn20_to_24.LayerAttributesMangler,gn20_to_24.MapMangler,gn20_to_24.MapLayersMangler</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1"># Migrate from GN 2.4 to GN 2.4</font></div><div><font face="monospace, monospace" size="1"><b>migrations = base.resourcebase,layers.layer,layers.attribute,maps.map,maps.maplayer</b></font></div><div><font face="monospace, monospace" size="1"><b>manglers   = gn24_to_24.ResourceBaseMangler,gn24_to_24.LayerMangler,gn24_to_24.LayerAttributesMangler,gn24_to_24.DefaultMangler,gn24_to_24.MapLayersMangler</b></font></div></div><div><br></div><div><br></div><div><b>NOTICE</b> that the setting file associates specific <b>manglers</b> to the geonode apps. They can still be customized accordingly to your needs or you can implement your own ones.</div><div><br></div><div>3. Launch the migration as follows:</div><div><br></div><div><font face="monospace, monospace">python migrate_layers.py <backup_zip_file> <owner></font><br></div><div><br></div><div>e.g.: python migrate_layers.py backup/2016-02-25_180915.zip admin<br></div><div><br></div><div><br></div><div>And that's it.</div><div>If everything goes fine you will find the new Layers and Maps on GeoNode.</div><div><br></div><div><b>NOTICE </b>that the script computes automatically the primary keys for the new resources.</div><div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div style="font-size:12.8px">Best Regards,</div><div style="font-size:12.8px">Alessio Fabiani.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>==</div><div>GeoServer Professional Services from the experts!</div><div>Visit <a href="http://goo.gl/it488V" target="_blank">http://goo.gl/it488V</a> for more information.</div><div>==</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Ing. Alessio Fabiani</div><div style="font-size:12.8px">@alfa7691</div><div style="font-size:12.8px">Founder/Technical Lead</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>GeoSolutions S.A.S.</div><div>Via di Montramito 3/A</div><div>55054  Massarosa (LU)</div><div>Italy</div><div>phone: +39 0584 962313</div><div>fax:     +39 0584 1660272</div><div>mob:   +39 331 6233686</div><div><br></div><div><a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a></div><div><a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">-------------------------------------------------------</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><p><span lang="IT"><font size="1"><b>AVVERTENZE AI SENSI DEL D.Lgs. 196/2003</b></font></span></p><p><span lang="IT"><font size="1">Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.</font></span></p><p><span lang="IT"><font size="1"> </font></span></p><p><font size="1">The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.</font></p><p><font size="1">---------------------------------------------------------------------</font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div>