Currently the server persists YJS Docs to leveldb on the local file system. This is a poor solution as the DigitalOcean file system is ephemeral.
(As a workaround, there is a backup script that uploads a backup to DigitalOcean Spaces [an S3-compatible endpoint]. Running npm run predeploy before deploying to DigitalOcean will preserve the database.)
Unfortunately there is no readily available Postgres plugin for YJS, and indeed the founder has even stated that Postgres is not a good target to store incremental updates. However that does not leave is with a lot of options for reliable server-side persistence.
HocusPocus Database Extensions apparently work fine with Postgres. Perhaps they perform the throttling and update merging necessary to make it performant.
This will work for loading Thought and Lexeme docs, but there may need to be some custom logic for the permissions doc, which must be loaded before the server starts as it is used for authentication. This requires querying the database outside of HocusPocus hooks.
Resources
Implementation of a websocket server storing yjs documents in a postgresql database
Currently the server persists YJS Docs to leveldb on the local file system. This is a poor solution as the DigitalOcean file system is ephemeral.
(As a workaround, there is a backup script that uploads a backup to DigitalOcean Spaces [an S3-compatible endpoint]. Running
npm run predeploy
before deploying to DigitalOcean will preserve the database.)Unfortunately there is no readily available Postgres plugin for YJS, and indeed the founder has even stated that Postgres is not a good target to store incremental updates. However that does not leave is with a lot of options for reliable server-side persistence.
HocusPocus Database Extensions apparently work fine with Postgres. Perhaps they perform the throttling and update merging necessary to make it performant.
This will work for loading Thought and Lexeme docs, but there may need to be some custom logic for the permissions doc, which must be loaded before the server starts as it is used for authentication. This requires querying the database outside of HocusPocus hooks.
Resources
Notes
Sample server logs: