Any company that owns a portal infrastructure such as ALUI will usually also plan for extra portal environments for troubleshooting and test purposes. Any portlet developments, portal customizations, or administrative changes will be implemented and tested in those environments. This is very good practice indeed. But you will quickly notice something happening: Your production portal is no longer in sync with your other staging / QA / Test environments. Although not necessarily a huge deal in the immediate future, that could become a problem when your test environment is really too different from the production one: Imagine the test team trying to execute a test plan in Staging environment, but half the production communities are simply not present in the test environment...etc...etc...etc...
I am sure you figured where I am going: Sooner or later, a clean refresh of your tests environments will be needed. Such a refresh is best done by a full database copy from production to your test environment (ALUI built-in export / import functionality is not suited for a large amount of objects, and thus is totally inappropriate and not recommended in the present case)
Besides restoring all the appropriate repositories (documents, published content, search indexes etc...), a major problem remains: All the various service' urls specified in the various ALUI objects (Remote servers, web services, KD cards, server urls, etc...) are no longer accurate in the refreshed test environments (of course: those urls are the production ones). Thus your test environment is far from working yet.
2 possibilities from here (1 good and 1 less good):
- You use host files in your test environments. These hosts files will direct the same production urls to the appropriate test servers (not good in my point of view because it is dangerous: if the hosts files is removed, there is a huge risk of having your test environment accessing production - thus not good :) )
- You use environment-specific DNS entries for each services. (Much better because no risk of inter-environment communication)
First, it is much better practice to call each service through DNS name rather than directly to through the server name. And secondly, it makes it much easier when it comes to environment refresh.
Why? Because all the DNS entries follow a global "intelligent" pattern (i.e. PUBLISHER.COMPANY.COM / PUBLISHER-TEST.COMPANY.COM / PUBLISHER-DEV.COMPANY.COM / etc...), it is much easier to create a tool (or a DB query for those DB gurus out there) that will allow for automatic replace of these DNS names.
That's where I wanted to lead you:
I created a tool that allow just that: for all the portal objects that contain URLs, the tool can replace a specific pattern with another one that you define. Although I could have created a set of DB queries that could do the job (I actually started to do that when I had to do my first environment refresh), I realized that a utility written in JAVA (most portable language) and using ALUI server API would guaranty portability, extensibility and reusability. The main advantage is that it is completely independent from backend technologies, and can work with any ALUI portal (.NET or JAVA), as well as any database (MS SQL or Oracle). It has been tested with JRE 1.4 and used by me on all G6 portal versions (until 6.1 MP1 included)
DISCLAIMER: ALTHOUGH I PERSONNALY USE THIS TOOL, THERE IS NO GUARANTY; SO USE THIS TOOL AT YOUR OWN RISK blah blah blah AND USE IT ONLY IF YOU ARE PROFFICIENT ENOUGH WITH ALUI PORTAL TECHNOLOGIES.
2 smart moves if you are not the easily scared type of person: First, make a DB backup of the test environment you are going to refresh, and second, test it in your local environment first, and see with your own eyes that it works perfectly well :)
For the moment, this migration utility only updates the main portal objects that contain urls:
-Remote servers
-Web Services
-Portal Settings
When I have time, I'll improve the utility and include publisher content items (especially urls embedded in them) in the list of migration objects.
Shell scripts (.bat and .sh) are created in order to facilitate and secure the usage of this utility. The user must provide several key information for the program to run:
-Application name (by default: portal)
-Administration username (must be an ALUI local database user)
-Username password
-Pattern to look for (any valid regular expression)
-Replacement String
-Optional: Debug mode? (if true, details of the parsed objects is output to screen)
The executable JAR along the appropriate launch scripts (bat for windows, sh for unix/linux) must be copied into the <PT_HOME>/bin folder in order to access the required libraries (otherwise the shell script -especially the java classpath- can be changed appropriately)
I zipped this tool (scripts and jar) for your convenience and uploaded it (pturlreplace-1.0.zip) to my google code project (http://code.google.com/p/alui-toolbox/).
Let me know what you think of it after you tested it. If you think it is useful, I'll update this post with new version of the tool as I come up with it. Enjoy!
Fabien, The dev2dev.bea.com site seems to be redirecting to oracle now, and I cannot download your wonderful PTURLReplace too any more. Is it possible you can repost the zip file somewhere else?
ReplyDeleteSam
deleted
ReplyDeleteoh something i forgot to migrate fro mdev2dev :)
ReplyDeleteI'll update that shortly.
Hi Fabien,
ReplyDeleteFirstly, please accept my thanks for this wonderful script.
Secondly, I need information for a ALUI production instance migration from one server to another server on windows platform. The DB and the app server both are in a single host. The ALUI is built on top of .NET framework.
(a) What are the steps to migrate a production instance from an existing server to a new server? The IP and host name will be different for the target instance.
(b) Can I use the environment refresh tool provided by you for such a migration?
Your thoughts on this would be appreciated very much.
Thanks & Regards,
Viks