A real-time collaborative editing server for OpenProject documents, powered by Yjs and Hocuspocus.
# Clone the repository
git clone https://github.com/opf/op-blocknote-hocuspocus.git
cd op-blocknote-hocuspocus
# Install dependencies
npm install
# Start the server with the appropriate environment variables setup
SECRET=secret12345 npm run startThe SECRET environment variable is a shared value between this application and OpenProject. Make sure to configure the same value in OpenProject - Settings Hocuspocus secret and in the SECRET environment variable of this project.
docker pull openproject/hocuspocus:latest
docker run -d \
-p 1234:1234 \
-e SECRET=secret12345 \
openproject/hocuspocus:latestThis is the base URL hocuspocus will use to connect to OpenProject. It is undefined by default, in which case the URL is derived from the edited resources (e.g. documents) in OpenProject.
This can fail in some cases where hocuspocus cannot reach the host under the given URL,
for instance when using the docker compose setup with localhost for the OpenProject host.
In this case hocuspocus would try to connect to itself.
To fix that you can configure OPENPROJECT_URL to 'rebase' the resource URLs to the given value.
For instance, in the case of docker compose:
OPENPROJECT_URL=http://webWhere web is the DNS name for the OpenProject container in the docker compose setup.
When overriding the base URL like this, you may also need to set
OPENPROJECT_ADDITIONAL__HOST__NAMESon the OpenProject side. In the example above you would set it toweb.
# Development Mode (with hot reload):
npm run dev
# Production Mode
npm run start
# Debug Mode (with Node.js inspector):
npm run debug
# Run tests
npm run test
# Lint code
npm run lintMaintained by the OpenProject team