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

 
alt

Daniel Nashed

 

Leveraging Domino Autoupdate for company internal downloads

Daniel Nashed  17 December 2023 12:10:10

Now that we have software automatically downloaded into autoupdate.nsf in Domino 14.0, the next step would be to distribute software inside your organization.

The attachment data is stored in autoupdate.nsf. An agent could be used to find the software and redirect to the right URL.


I wrote a simple search and redirect agent and a redirect rule.

To download a file it can be just referenced by it's file name.

The agent takes care of finding the document and generating the right redirect.


A download via curl could just look like that:


curl -LO -u autoupdate:mypassword
https://pluto.nashcom.org/software/Domino_14.0_Linux_English.tar

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

100 1068M  100 1068M    0     0  94.1M      0  0:00:11  0:00:11 --:--:--  102M


In my case the logic is in a separate software.nsf database. The target database is protected with Notes ACL.


This is separate logic not added into autoupdate.nsf. No modification to autoupdate.nsf is needed

The agent just generates a redirect and you could also add a redirect rule to hide this is is Notes database providing this redirect service.



HTTP Download Performance Improvements


The performance you see in this example was a test from another server at the same provider (two Hetzner servers).
There is a performance improvement in Domino 14.0 for those type of downloads.


Uncompressed attachment downloads


Attachments in autoupdate.nsf are stored uncompressed on purpose.
First of all the data is already compressed inside the attachment. So the compression would not bring much if any benefit at all.

But more important an download would need to decompress the LZ1 during download.

This takes CPU time and also goes thru a different logic than a plain download.

A plain uncompressed download can just stream the attachment object read 1:1.

The download performance for uncompressed attachments via HTTP/HTTPS has been greatly improved in Domino 14.0.


100 MB/sec for downloading a larger attachment -- like in my example -- is quite impressive speed.


At this speed testing becomes difficult. It's also a matter of your disk write performance and of course your network speed.



How do you like this this idea? Would this be helpful inside your environment for distributing software internally in your organization?


-- Daniel




Image:Leveraging Domino Autoupdate for company internal downloads


Option
Declare

Sub
Initialize
             
     
Dim session As New NotesSession
     
Dim db As NotesDatabase
     
Dim WebDoc As NotesDocument
     
Dim doc As NotesDocument

     
On Error GoTo error_handler
     
     
Set db = session.Currentdatabase
     
Set WebDoc = session.DocumentContext

     
If ("GET" = WebDoc.REQUEST_METHOD(0)) Then

             
Call  DownloadRedirect (WebDoc)

             
Exit Sub
     
End If

     
' Other requests are ignored
     
Exit Sub
     
error_handler:

     
Print "Content-type: text/plain"
     
Print ""
     
Print "Error processing request"
     
     
Exit Sub
     

End
Sub



Su
b LogError (ErrorStr As String)
Prin
t ("Error: " + ErrorStr)        
En
d Sub

Functio
n GetDocByFormula (db As NotesDatabase, FormulaStr As String) As NotesDocument

      Di
m session As New NotesSession
      Di
m nc As NotesNoteCollection
      Di
m doc As NotesDocument
      Di
m nid As String
     

      Se
t nc = db.CreateNoteCollection (False)

      nc.Selectdocuments =
True
      nc.Selectionformula = FormulaStr

      Cal
l nc.BuildCollection
     
      nid = nc.GetFirstNoteId

     

      I
f ("" = nid) Then
     
        Exit Function
      En
d If
     

      Se
t GetDocByFormula = db.GetDocumentByID(nid)
             

En
d Function




Su
b SendError (ErrorStr As String)
     

      Prin
t "Content-Type: text/plain"
      Prin
t ""
      Prin
t ErrorStr
     

En
d Sub

Su
b DownloadRedirect (WebDoc As NotesDocument)
      Di
m KeyName As String        
      Di
m db As New NotesDatabase ("", "autoupdate.nsf")
      Di
m doc As NotesDocument
      Di
m count As Integer

      O
n Error GoTo error_handler
     
      KeyName =
StrToken (StrToken (WebDoc.QUERY_STRING_DECODED(0), "&", 2), "=", 2)
     

      I
f ("" = KeyName) Then
     
        Call SendError ("Not Software specified")
     
        Exit Sub
      En
d If

      Se
t Doc = GetDocByFormula (db, {(Form = "Software") & fileName = "} + KeyName + {"})

      I
f (Doc Is Nothing) Then
     
        Call SendError ("Software not found: " + KeyName)
     
        Exit Sub
      En
d If

      I
f (doc.Status(0) <> "A") Then
     
        Call SendError ("Software not available")
     
        Exit Sub
      En
d If

      Prin
t "Location: /" + db.Filepath + "/0/" + doc.Universalid + "/$File/" + KeyName
      Prin
t ""

      Exi
t Sub
     
error_handler:

      LogError
"Software - Error: " + Error()
     
     
Exit Sub
     

End
Sub

Links

    Archives


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