Issue
I've followed the guides to increase App timeout, and I have Domino 4.5 or older, can I avoid editing the configmap?
There are guides for the manual proxy_read_timeout available, can I avoid doing this every time?
Resolution
Normally Apps will not refresh their files, you cannot 'sync', and the normal way to get new files and new version of your App, is to restart the App.
If you've established an API Key, you can try a different method. Your app.sh can try downloading a more up-to-date file, which you've synced to the Files/DFS area!
This is not a Domino endorsed method but possible! Use at your own risk!
Check in a Workspaces Terminal or User Settings in Domini. Run the 'set' command to print your environment variables, and search for API (in a terminal, set |grep API)
You can view the 'raw' file in the DFS, and the URL for your file is something like:
https://$URL/u/$USER/$PROJECT/raw/$UNIQUEID/$FILENAME?inline=true
We'll work that into the app.sh on a loop, but you'll need to add a trigger in the App code to exit (add a button which does exit(0) for example. We could catch the exit code, so you could make the following loop dependent on a particular exit code instead of checking for the file difference.
Your app.sh might then look like:
#!/bin/bash
PROGRAM_NAMED=MyPythonApp.py
UNIQUEID=xxxx # Taken from the RAW URL
while true ; do
# At this point you should have the 'latest' program version as MyPythonApp.py.new
# We'll always to run the 'original code'
python ${PROGRAM_NAMED}
EXIT_CODE=$?
# replace with your Domino FQDN:
MYDOMINO_SITE=my_Domino_fqdn
curl -u $DOMINO_USER_API_KEY:$DOMINO_USER_API_KEY https://${MYDOMINO_SITE}/u/${DOMINO_PROJECT_OWNER}/${DOMINO_PROJECT_NAME}/raw/${UNIQUEID}/${PROGRAM_NAMED}?inline=true -o ${PROGRAM_NAMED}.new || echo "Failed to download a new version"
# Check if the .new file is different from the original
DIFF=$( diff ${PROGRAM_NAMED}.new ${PROGRAM_NAMED} )
if [ $DIFF -eq 0 ]; then
# same file, exiting, this will Stop the App
break
else
# Make a backup just in case, then swap!
cp ${PROGRAM_NAMED} ${PROGRAM_NAMED}.backup.$( date +%s )
mv ${PROGRAM_NAMED}.new ${PROGRAM_NAMED}
echo "Renaming the .new file for a loop after updated binary found"
fi
done
Please note this is untested, not guaranteed or endorsed and could possibly 'delete' your python code if it syncs curl's output back to your project (you can revert the code in the Files area if that happens! We'll make extra backups just in case! Also, the health check could kill off the pod, in case this takes longer than the health check timeout!!!
Of course, after applying and testing, we'll still need to adjust the timeout at least once!
Comments
0 comments
Please sign in to leave a comment.