Monday, April 11, 2016

Renaming an IBM Connections hostname. Redirecting IHS/Apache

Ok, I´ve done some renaming of IBM Connections servers lately.


Basically the renaming consists of
  • Changing the Lotus-ConnectionsConfig.xml file.
  • Changing the LtpaToken Domain name
  • Changing the SSL cert in iKeyman
  • Changing IBM HTTP Server config, (ssl config and hostname changes)
  • Running wsadmin commands to change url that´s stored in various conten, like Blogs and StatusUpdates (See "update" at the end of this blogentry).
 What I want to focus on here, are the Apache Redirect rules which I like to implement, in order for easing the single users day.

If users already have bookmarked IBM Connections stuff in their local browser, and access this bookmark a lot. They would be upset that suddenly, one day, the bookmark does not work. The users don´t normally read the Admin emails about major system changes, so this is a way of simplifying things for them. (and you, hehe)


So. When you have done all the renaming steps that are required, and you have a working system up and running, on the new host names, then this is the httpd.conf redirection I use.



Redirect rules in Apache:
I have not tested this in IHS before, but I guess it should work there as well. I did this one in Apache the last time, and this is the config this blog entry is based on.

The way I do this, is that I create two new VirtualHosts in addition to the two that was already in the httpd.conf config file. (one for port 80 and one for 443, basic stuff)
The VirtualHost names has the same names as the ones that already exists, namely "*:80" and "*.443".
To make sure that Apache don´t create error messages about "this VirtualHost already exists" and so on, the following 2 lines also has to exist in the httpd.conf:
NameVirtualHost *:80
NameVirtualHost *:443
Just put the two lines somewhere above all of your VirtualHost config, but not inside your VirtualHost config.

And then, lets say the old hostname was "CNXOLD.item.no" and the new hostname is "CNXNEW.item.no"
I added this brand new VirtualHost config in the httpd.conf file:

<VirtualHost>
    ServerName CNXOLD.item.no
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<VirtualHost>
    ServerName CNXOLD.item.no
    UseCanonicalName On
    RewriteEngine on
    RewriteRule   ^/$  /homepage  [NE,R]

    RewriteRule ^/blogs/(.*) https://CNXNEW.item.no/blogs/$1 [R,L]
    RewriteRule ^/activities/(.*) https://CNXNEW.item.no/activities/$1 [R,L]
    RewriteRule ^/communities/(.*) https://CNXNEW.item.no/communities/$1 [R,L]
    RewriteRule ^/dogear/(.*) https://CNXNEW.item.no/dogear/$1 [R,L]
    RewriteRule ^/files/(.*) https://CNXNEW.item.no/files/$1 [R,L]
    RewriteRule ^/forums/(.*) https://CNXNEW.item.no/forums/$1 [R,L]
    RewriteRule ^/homepage/(.*) https://CNXNEW.item.no/homepage/$1 [R,L]
    RewriteRule ^/mobile/(.*) https://CNXNEW.item.no/mobile/$1 [R,L]
    RewriteRule ^/profiles/(.*) https://CNXNEW.item.no/profiles/$1 [R,L]
    RewriteRule ^/wikis/(.*) https://CNXNEW.item.no/wikis/$1 [R,L]

    .........
    Plus some basic SSL stuff here :-)

</VirtualHost>


So, in this way, browser requests towards "cnxnew.item.no" behaves normally, because you already have the VirtualHost config in place for this. This above mentioned addittional VirtualHost config, will redirect any user over to the new server, and also maintaining the url entirely. The old bookmark "https://cnxold.item.no/profiles/blablabla" will redirect the user to the url "https//cnxnew.item.no/profiles/blablabla".

The fun part was the added surprise of also learning that the Mobile iOS App also handeled the redirection automatically. The Config of the app towards the old server will automatically store the new hostname.

Sadly, the Desktop Plugin did not. So this one has to be manually fixed regarding the hostname.

Update: 
By request, here´s the wsadmin commands:
I mentioned the wsadmin commands for changing urls in Blog-entries and status-updates.
Here´s the link for this:
Blogs: https://www.ibm.com/support/knowledgecenter/SSYGQH_5.0.0/admin/admin/t_admin_blogs_replace_urls.dita

Status Updates: As of right now, there´s no wsadmin command for changing url´s that´s been pasted into status updates. If this is important to change, you need to go directly into the database and change there.
I got this confirmed by Christoph Stoettner today, as I asked him about it.
Since status updates has a short lifespan (by default 45 days), both he and I tend to just ignore changing the url´s that exists inside of status-updates and just do the ones for Blogs.


8 comments:

Matteo Bisi said...

Hello Robert, thanks for share.

Could you publish also a post about the wsadmin stuff regarding Blogs and status update?

I've to do same job near future :-)

Thanks

Robert Farstad said...

Hi Matteo. I updated the blogentry now and added some info regarding blogs and status update url-changing.

Matteo Bisi said...

Thanks Robert, super fast update! I really appreciate that! ;-)

Richard Dew said...

Hi Robert, This is very useful but is there any chance you can also add in more detail about the first steps for renaming. I always seem to have an issue where it all works fine until you install a CR as it then reverts everything back to the server name held in WAS.

Thanks

Robert Farstad said...

Hi there Richard.
Does the CR upgrade change the LotusConnections-config.xml file back to it´s original hostname-values?
I was not aware of this happening. Or does it change the server name other places in WAS?

Robert Farstad said...

Richard, I see that you already noticed this one:
https://www.ibm.com/developerworks/community/blogs/4021cbfe-77ed-4a39-89de-59b2fd63adb5/entry/Guidelines_for_Changing_Hostname_on_a_Connections_Environment?lang=en

:-)

Richard Dew said...

Hi Robert thanks for getting back to me. It changes the hostname in the LotusConnections_config.xml back to the server hostname that is still listed in WAS. Just to make it clear the host server still has the original name and the WAS still lists the original host name in the app server and node listings etc all I have done is what you listed above not changing any host URLs

The other part here is do you need to do anything for the CCM integration so to change any filenet settings?

Robert Farstad said...

If that´s the case, then I believe that there´s some renaming to do in the IBM Installation Manager as well. If you search through the settings files for the IBMIM I´m guessing you´ll find old host names in there somewhere.

I have actually never worked with the Filenet/CCM part, so this I do not know.