Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...


Daniel Nashed

One Touch Setup meets automated lab setup

Daniel Nashed – 2 January 2022 18:06:19

Domino One-Touch is the base for all the automation.
Once you started automation, it's only limited to your imagination.

Probably this will officially be available after our DNUG CertMgr and certificate hands-on workshop, were we will use the auto deployment of course.
Stay tuned for more functionality.. Looks like ideas are floating faster then  I write them.
But it's just the 2nd day of the year..

-- Daniel

Image:One Touch Setup and meets automated lab setup

Note: I had to short cut the fields for the configuration with a X_ instead of SERVERSETUP_ because I hit the limit for field len with some variables.

Image:One Touch Setup and meets automated lab setup

As some of you know I have my own lab registration database automating Hetzner server deployment including DNS leveraging their REST APIs.
I just added an agent, generating JSON on the fly based on the IP address of them machine.
And I have added an auto deployment and download routine to the "setup" of my start script.

In combination with JSON templating, I can download and customize JSON on-the-fly in any way.
I added a JSON based customizable menu, which can be also used to deploy other software.

The auto JSON generation is a Lotus Script agent, which dynamically replaced place holders in JSON files as shown above.
Probably I should make the agent available to show how simple this

For my lab environment setup database I also introduced a new well known URL to auto deploy configurations.
So for any host in an internet domain (like would look like this -->
Now that JSON configuration with templating makes deployment via JSON easier than editing a ENV file, JSON setup is the new default!

And there are many options I will document over time.
One example would be   " domino setup  "
The short cut  " domino setup auto " would provide the same functionality.
And if your host is part of the domain, you could even use  " domino setup auto " to hit the default configuration in

There is a lot new stuff coming. It's all prepared. But it's a lot of work to write up the documentation.

I just moved the Domino start script documentation in mark down. And this will be the new base to write up easier to read documentation.
The One-Touch functionality is also moved into a separate file, to keep rc_domino_script small and the functionality separated.
The updated scripts are in the develop branch of the Domino Docker Community image, but not added to the start script tar for now.

Agent Code

Surprisingly this isn't much code and sort of elegant.
It has some tricky parts. The replacement function needs exactly the right number of elements.
Having empty elements will cause the resulting text to be empty.. Took me a while to find - specially the Redim needs to be for n-1 if the index is zero based.

Sub Initialize
        Dim session As New NotesSession
        Dim db As NotesDatabase
        Dim WebDoc As NotesDocument
        Dim TemplateDoc As NotesDocument
        Dim doc As NotesDocument
        Dim TemplateItem As NotesItem
        Dim FormulaStr As String
        Dim item As NotesItem
        Dim x As Long
        Dim count As Long
        Dim OneTouchConfig As String
        Dim ret As Variant
        Print "Content-type: application/json"
        On Error GoTo error_handler
        Set db = session.Currentdatabase
        Set WebDoc = session.DocumentContext

        Set Doc = GetDocByFormula ( {(Form = "Server") & IP = "} + WebDoc.remote_addr(0) + {"} )

        ' If remote IP not found, get default document for testing
        If (Doc Is Nothing) Then
                Set Doc = GetDocByFormula ( {(Form = "Server") & (IP = "")} )
        End if

        If (Doc Is Nothing) Then
                LogError "OneTouchSetup - No counfiguration for " + WebDoc.remote_addr(0)
                Exit Sub
        End If

        OneTouchConfig = doc.OneTouchConfig(0)
        If ("" = OneTouchConfig) then
                OneTouchConfig = "Default"
        End If

        Set TemplateDoc = GetDocByFormula ( { (Form = "OneTouchSetup") & (TemplateName = "} + OneTouchConfig + {") })
        If (TemplateDoc Is Nothing) Then
                LogError "No Template Doc found"
                Exit Sub
        End If
        Set TemplateItem = TemplateDoc.Getfirstitem("Body")
        If (TemplateItem Is Nothing) Then
                LogError "No Template Item found"
                Exit Sub
        End If

        FormulaStr = TemplateDoc.Formula(0)
        If ( "" <> FormulaStr) Then
                ret = Evaluate (FormulaStr, doc)
        End If
        count = 0
        ForAll i In doc.Items
                x = InStr (1,, "X_", 1)
                If (1 = x) And ("" <> i.text ) Then
                        count = count + 1
                End If
        End ForAll

        If (0 = count) Then
                LogError "No Fields found"
                Exit Sub
        End If

        ReDim ReplaceFromArray (count-1) As String
        ReDim ReplaceToArray (count-1) As String

        count = 0
        ForAll i In doc.Items
                x = InStr (1,, "X_", 1)
                If (1 = x) And ("" <> i.text ) Then
                        ReplaceFromArray(count) = "{{ SERVERSETUP_" + StrRight (UCase (, "X_") + " }}"
                        ReplaceToArray(count) = i.text
                        count = count + 1
                End If
        End ForAll

        Print Replace (TemplateItem.text, ReplaceFromArray, ReplaceToArray, 1, 1000)

        Exit Sub

        LogError "OneTouchSetup - Error: " + Error()
        Exit Sub
No Comments Found



    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]