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
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
Sub LogError (ErrorStr As String)
Print ("Error: " + ErrorStr)
End Sub
Function GetDocByFormula (db As NotesDatabase, FormulaStr As String) As NotesDocument
Dim session As New NotesSession
Dim nc As NotesNoteCollection
Dim doc As NotesDocument
Dim nid As String
Set nc = db.CreateNoteCollection (False)
nc.Selectdocuments = True
nc.Selectionformula = FormulaStr
Call nc.BuildCollection
nid = nc.GetFirstNoteId
If ("" = nid) Then
Exit Function
End If
Set GetDocByFormula = db.GetDocumentByID(nid)
End Function
Sub SendError (ErrorStr As String)
Print "Content-Type: text/plain"
Print ""
Print ErrorStr
End Sub
Sub DownloadRedirect (WebDoc As NotesDocument)
Dim KeyName As String
Dim db As New NotesDatabase ("", "autoupdate.nsf")
Dim doc As NotesDocument
Dim count As Integer
On Error GoTo error_handler
KeyName = StrToken (StrToken (WebDoc.QUERY_STRING_DECODED(0), "&", 2), "=", 2)
If ("" = KeyName) Then
Call SendError ("Not Software specified")
Exit Sub
End If
Set Doc = GetDocByFormula (db, {(Form = "Software") & fileName = "} + KeyName + {"})
If (Doc Is Nothing) Then
Call SendError ("Software not found: " + KeyName)
Exit Sub
End If
If (doc.Status(0) <> "A") Then
Call SendError ("Software not available")
Exit Sub
End If
Print "Location: /" + db.Filepath + "/0/" + doc.Universalid + "/$File/" + KeyName
Print ""
Exit Sub
error_handler:
LogError "Software - Error: " + Error()
Exit Sub
End Sub
- Comments [0]