Monday, 8 April 2013

iNotes Deployment in HA Mode with Multiple Clusters using Apache Reverse Proxy - Part 2

In continuation to my first post: http://xpagesera.blogspot.in/2013/03/inotes-deployment-in-ha-mode-with.html

In the last post, we tried setting up the Apache Reverse Proxy with Multiple Domino Clusters. Last week, we successfully implemented Apache Reverse Proxy in a unique way: 

Cluster size: 7 servers - 6 Mail Servers and 1 Admin Server. This setup ensures that all password changes are immediately available to all Servers. 

User's Mail file is available on either Server 1, 3, 5 OR Server 2, 4, 6. In this configuration 4 servers are in DC and 2 servers in DR. We want all traffic to land on Server 1 - 4 (DC). In case none of the DC Servers are available, then it should redirect request to Server 5, 6 (DR).

Instead of relying on the Domino Cluster Information, we have written Rules in Apache httpd.conf file to determine which Load Balancer Group a particular request should be redirected to. 

First, the formula used for Apache field in iNotes Web Redirect database: 

nodecookievalue:= @Name([CN];@NameLookup([NoUpdate];@UserName;"MailServer"));

clustercookievalue:=@DbLookup("":"";@Subset(@DbName;1):"names.nsf";"($ServersLookup)";nodecookievalue;"clustername");

nodecookie:=@SetHTTPHeader("Set-Cookie";"inotesses="+@LowerCase(nodecookievalue));

@Success

This field will write Cookie values inotesses: Mail Server Name in lowercase. 

Second, Check if below modules are present & loaded in Apache Reverse Proxy

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

Third, in the httpd.conf file, add Rules to redirect user request to only that server where user's mailfile is present.

<VirtualHost *:443>

ServerName webmail.demo.com

ProxyRequests off

SSLEngine On

SSLProxyEngine On

RewriteEngine On

SSLCertificateFile    /etc/apache2/ssl/webmail.crt

SSLCertificateKeyFile /etc/apache2/ssl/webmail.key

SSLCertificateChainFile /etc/apache2/ssl/chain.crt

ProxyPreserveHost On

<Proxy balancer://Cluster1/>

# loadfactor is added to ensure equal requests are sent to server01 and server02, while server03 will have lowest priority.

BalancerMember https://server01.demo.com:443/ route=server01 loadfactor=50

BalancerMember https://server03.demo.com:443/ route=server03 loadfactor=50

 BalancerMember https://server05.demo.com:443/ route=server03 loadfactor=1

ProxySet lbmethod=byrequests

</Proxy>

<Proxy balancer://Cluster2/>

BalancerMember https://server02.demo.com:443/ route=server02 loadfactor=50

BalancerMember https://server04.demo.com:443/ route=server04 loadfactor=50

 BalancerMember https://server06.demo.com:443/ route=server03 loadfactor=1

ProxySet lbmethod=byrequests

</Proxy>

ProxyPass / balancer://Cluster1/ stickysession=inotesses nofailover=Off

ProxyPassReverse / https://server01.demo.com/

ProxyPassReverse / https://server03.demo.com/

 

ProxyPass / balancer://Cluster2/ stickysession=inotesses nofailover=Off

ProxyPassReverse / https://server02.demo.com/

ProxyPassReverse / https://server04.demo.com/

 

RewriteCond %{HTTP_COOKIE} inotesses=server01 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server02 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server03 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server04 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

</VirtualHost>

 

Now, Stop & start httpd service.

Monday, 11 March 2013

iNotes Deployment in HA Mode with Multiple Clusters using Apache Reverse Proxy.


High Availability for Lotus iNotes Installation
I am looking for various options available for achieving High Availability with Lotus iNotes installation. The article outlines the options available, work that Domino experts have done and the best option that suits my requirement.
Following available options are possible:
1. ICM (Internet Cluster Manager): ICM only provides initial redirect to correct Domino Web Server. But once user has opened a webpage and server goes down, user has to manually switch the URL to point to the other server or browse the ICM URL again.
http://www-12.lotus.com/ldd/doc/domino_notes/Rnext/help6_admin.nsf/c1f2605b7be6a95985256b870069c0a8/36fd13678096637585256c1d0039a59b?OpenDocument
2. Hardware based Load Balancer
3. Software based Load Balancer: 
Following two options are possible with Domino: Websphere Edge Proxy Server and Apache Web Server. In this article, we'll use Apache Web Server for Reverse Proxy and Load Balancer configuration. 
Note: It seems like Daniel has already done all the hard work.. He has published a great series on the same topic !! The article is in Spanish, but can easily be translated in English via Google Translate. Please copy the code from Original version only.. 

I setup the following piece of code in httpd.conf: 

I setup two Domino Clusters as follows: 

Cluster1 - Server1, Server2

Cluster2 - Server3, Server4

 

<Proxy balancer://Cluster1/>

BalancerMember http://server1.demo.com:80/ route=Server1

BalancerMember http://server2.demo.com:80/ route=Server2

ProxySet lbmethod=byrequests

</Proxy>

 

<Proxy balancer://Cluster2/>

BalancerMember http://server3.demo.com:80/ route=Server3

BalancerMember http://server4.demo.com:80/ route=Server4

ProxySet lbmethod=byrequests

</Proxy>

 

ProxyPass / balancer://Cluster1/ stickysession=inotesses nofailover=Off

ProxyPassReverse / http://server1.demo.com/ 

ProxyPassReverse / http://server2.demo.com/ 

 

ProxyPass / balancer://Cluster2/ stickysession=inotesses nofailover=Off

ProxyPassReverse / http://server3.demo.com/ 

ProxyPassReverse / http://server4.demo.com/ 

 

RewriteCond %{HTTP_COOKIE} _clusterses=Cluster1 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} _clusterses=Cluster2 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

Reference:

Monday, 7 January 2013

Lotus MailFile Template Modification: Prevent changes in received emails

 

In the default Lotus Notes Mail template, users can edit the received emails and modify the content. To prevent the same, following customization is required in template.
Edit "Memo" and "Reply" form in the designer                                

                                                                            
  change "QueryModeChange" event, by adding this code:                 
                 
  If  (Not source.editmode And source.document.HasItem("PostedDate"))   Then
       continue = False                                                         
       Exit Sub                                                                 
  End If                                                                    
                                                                            
Change "QueryOpen" event, and towards the top, add:                         
                                                                            
 If (Not (source.isnewdoc) And source.editmode ) Then        
     If (source.document.HasItem("PostedDate") ) Then           
          Continue = False                                          
          Exit Sub                                                  
     End If                                                     
 End If

Using Linux Desktop - My Favourite Add-ons

I am using RHEL 6 Desktop for last 6 months..


Following are the essential softwares required/installed on my machine to ensure my productivity:
1. Mail: Lotus Notes 9
2. Office Suite: IBM Lotus Symphony 3.1, Open Office 3.4.1
3. PDF Docs: Foxit Reader, Adobe Reader
4. Screenshots: Shutter
5. Notes, Customer Activity Tracking: GNote
6. Web Browser: Firefox, Chrome
7. Virtualization: VMWare Workstation, VMWare Player (Virtual Image: Domino Server, Domino Designer, Domino Administrator)
8. Backup to External Hard-drive: GrSync
9. Media Player: VLC Media Player
10. Remote Control: Teamviewer, Tiger VNC Viewer
11. Graphics: GIMP, Pencil


This list covers all the installations/additions I have done to Vanilla RHEL desktop... Apart from Domino Designer, there is nothing for which I need a Windows environment.. I wish if we can have a Linux version of Domino Designer as well some day !!

Thursday, 13 December 2012

IBM Notes and Domino 9.0 Social Edition Public Beta new features and release notes - Documentation and Cookbooks

IBM Notes and Domino 9.0 Social Edition Public Beta new features and release notes - Documentation and Cookbooks

 

<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } A:link { so-language: zxx } -->

Primary Link - http://www-10.lotus.com/ldd/ndsebetaforum.nsf/topicThread.xsp?action=openDocument&documentId=C6F8337CA6DCC1FB85257AD300574EF3

 

Here are links to documentation for the IBM Notes and Domino 9.0 Social Edition Beta:

IBM Notes and Domino 9.0 Social Edition Public Beta new features and release notes

IBM Notes Traveler 9.0 Public Beta release notes

IBM iNotes 9.0 Social Edition Public Beta Administrator Guide

Cookbook: Encrypting SAML assertions

Cookbook: Setting up a new Federation on TFIM 2.0

Cookbook: Setting up a new partner on TFIM

Cookbook: Setting up a new federation on TFIM 1.1

Cookbook: Setting up Notes federated login

Cookbook: Setting up ADFS for integrated Windows authentication (IWA)

Cookbook: Setting up new Relying Party Trust for AD FS 2.0

IBM Notes and Domino 9.0 Social Edition public beta now available!

IBM Notes and Domino 9.0 Social Edition public beta now available!

 

It's the holiday season, and I brought you a present a little early.

This morning, we posted the public release of IBM Notes and Domino 9.0 Social Edition beta. I've been running this build for a couple of weeks, and it's singing to me.

According to a survey of our Design Partner Program, two-thirds of the Notes/Domino Design Partners plan to deploy the new Social Edition release within three months of eGA. It may say 9, but this is anything but a "dot zero" release.

For many of you, this is the first opportunity to actually check out IBM's investment in this new beta: modernized UI, embedded experiences and OpenSocial, activity streams, improvements in mail and calendar, the "Discover" page to guide users, the Notes browser plug-in, Domino SAML support, Traveler updates for Windows Phone support, and much more. I hope you'll share some of the excitement of the participants in our IBM Notes and Domino Social Edition webcast last month: Scott Souder, Lance Spellman, Daniel Lieber, and Eric Peterson.

If you are not already registered for public beta, visit http://bit.ly/ND9BETA . To provide feedback and access additional resources, visit the beta feedback forum on ibm.com developerWorks.

There are so many great new features in this release... I would be hard-pressed to pick just one, but in the new public beta build, I love that when you finish with replying or forwarding a mail, the original closes as well. One less click. I love that calendar entry updates auto-process, without having to always click "update calendar." I love that the toolbar only shows up in edit mode, since I almost never have a reason to use it in read or view mode. Clean. Simple. More intuitive. Notes 9.0 Social Edition beta delivers.

Monday, 3 December 2012

iNotes Customization: Perform Server side check before sending emails

This blog is dedicated to Lotus iNotes 8.5 Customization to ensure that some Server side checks can be performed before emails is sent out.. The iNotes Customization documentation has certain examples but not complete to demonstrate this exact scenario..

Special thanks to Eric W. Spencer, IBM for providing wonderful insight for the same.

Steps to follow:

1. Setup Forms85_x.nsf: Instructions on creating the Extension Forms File are in the Lotus iNotes Administrator documentation. The topic can be found in Domino and Notes info center here.

2. Edit Custom_JS_Lite Subform in Forms85_x.nsf

Setup a flag "hAgentSend" in each new Email Document that is created. The starting code is there to pick the current UI Form ids and then create an Input element and add it to current Mail form.

function Custom_Scene_PostLoad_Lite( s_SceneName, bInEditMode ){
    if ((s_SceneName || '').split(':')[1] == 'EdT' && s_SceneName.indexOf('$new') !== -1 ) {
        var oMailInfo = EKc.prototype.EYl[s_SceneName];

            var oElem = AAA.EcK.getElementById(s_SceneName.split(':')[0]);

            var sContentId = oElem.getAttribute('com_ibm_dwa_ui_mailinfo_contentid');

            var oContent = AAA.Fkb().getContent(sContentId);

        // Get the current UI document
        var oMainDoc = AAA.EcK;
        // Get the current backend document ID
        var sDocUnid = oContent.sId;
        // Get the current UI form
        var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid ) || {};
   
        var oInput = oMainDoc.createElement('INPUT');
        oInput.setAttribute('name','hAgentSend');
        oInput.setAttribute('id','hAgentSend');
        oInput.setAttribute('type','hidden');
        oForm.appendChild(oInput);

    }
}

Now, set the code to call an Agent from server using AJAX and enable Mail send functionality only in Callback function of AJAX response:

function Custom_Scene_PreSubmit_Lite( s_SceneName, bInEditMode ){
    if  (s_SceneName == "memo") {

        // Get the current backend document ID
        var oContent = AAA.Fkb().EdI.get('T').oPrev;
        var sDocUnid = AAA.Fkb().EdI.get('T').oPrev.sId;

        // Get the current UI document
        var oMainDoc = AAA.EcK;

        // Get the current UI form
        var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid );

        // If the agent is sending the memo, just send
        if (oForm["hAgentSend"]) {
            if (oForm["hAgentSend"].value == "true")
                return true;
        }
   
        // do any checking here and set up xhr to run agent..............
        url= window.location.protocol + "//" + window.location.hostname + "/inotes/forms85_x.nsf/agCheckGroupAccess?OpenAgent";
http_request = false;
if (window.XMLHttpRequest) { // Mozilla
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
    http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}

        //setting mail send on AJAX Call
        http_request.onreadystatechange  = function()
{
    if(http_request.readyState  == 4)
    {
        if(http_request.status  == 200) {    // success

            var resp = http_request.responseText;
    if(resp.indexOf("true") !== -1)
        bOkayToSend = true;
            // Get response info from agent and do any necessary processing
            // Decide if it's okay to send the memo
            // ...

            if (bOkayToSend) {

                // okay to send the memo
           
                // Get the current backend document ID
                var sDocUnid = AAA.Fkb().EdI.get('T').oPrev.sId;
           
                // Get the current UI document
                var oMainDoc = AAA.EcK;
           
                // Get the current UI form
                var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid );
           
                // Set the flag that says memo is being sent
                oForm["hAgentSend"].value = true;
               
                // Send the memo
                setTimeout("AAA.DSq.ELU(null, 'e-actions-mailedit', 'EbK', {sAction: 'a-send'})", 1000);
            }
            else {
                // put up some kind of error message
                alert("invalid email");
            }
        }
    }
}
       
        //Send AJAX Request
        http_request.open('POST', url, true);
        http_request.send();
       
        // Return false to prevent email from getting sent now
        return false;
    }

    return true;
}

The agent should return a value of "true" to enable the mail send.. Here is the code for the smallest agent:

Option Public
Option Declare

Sub Initialize
   
    MsgBox "Running Agent: iNotes Mail Send"
   
    Print "true"
   
End Sub

Reference Documents:

1. http://www-10.lotus.com/ldd/dominowiki.nsf/dx/The_basics_of_iNotes_customization

2. http://www-10.lotus.com/ldd/dominowiki.nsf/dx/manipulating-data-in-inotes-lite-forms

If required I can publish the modified Forms85_x.nsf here as well.. Please let me know.