File update optimizations
Assumptions/Caveats
- assumes use of Node 18 (untested on lower versions)
- start script is changed to require pre-compilation of the webserver with tsc. this was to address an error from the worker thread and to speed up execution on production.
- building/starting the server in prod becomes more complex. running build_and_start.sh after pulling the latest code should do all the needed steps from the Dockerfile. For the time being, this implies a slightly longer downtime when application code (not JSON files) changes. a ZD deployment implemented with pm2 or via another deployment provider that handles it automatically would address this.
Summary
- make more operations non-blocking
- spawn a separate Worker thread via the threads.js library to run the expensive EntityState constructor
- build frontend in dockerfile
- use lower version of Ubuntu in Dockerfile to prevent "error on docker build: The repository 'http://security.ubuntu.com/ubuntu groovy-security Release' does not have a Release file." locally (more background described here: https://meta.discourse.org/t/docker-does-not-have-a-release-file-in-ubuntu-20-10/168097)
- other minor optimizations/refactors
- see TODOs added in code for additional questions/comments
Edited by Leo Thorp