Skip to content

CoLab YJS

Mikkel edited this page Mar 27, 2024 · 13 revisions

Docker Setup

This page will guide you through running CoLab-YJS in a docker container, avoiding having to manually start it when running CoLab locally.

Dockerfile

You may have to change the AUTHHOST and DBHOST ports corresponding to your Payara and Mongo instances. By default Payara should be running on port 8080 and Mongo on port 27017.

From Colab root open the CoLab-YJS Dockerfile : /colab-api/src/main/node/colab-yjs/Dockerfile

ENV AUTHHOST="http://host.docker.internal:<YOUR_PORT_HERE>/"

ENV DBHOST="mongodb://host.docker.internal:<YOUR_PORT_HERE>/colablexical"

Building image and running container

  1. From Colab root navigate to : /colab-api/src/main/node/colab-yjs
  2. Build image from Dockerfile by running : docker build -t colab-yjs .
  3. Start a container from the image by running : docker run --name CoLab-YJS -dp 127.0.0.1:4321:4321 --restart always colab-yjs

Your CoLab-YJS instance should now be running and exposed on port 4321 (default port but you can change it if needed).

Configuring CoLab environment variables

From CoLab root open the colab.properties file : /colab-webapp/colab.properties

Here make sure to add the URL for your CoLab-YJS instance, for example running on port 4321: colab.yjs.url=ws://localhost:4321

MongoDB Setup

We heavily recommend you index your YJS collection in MongoDB by adding a compound index as follows :

db['your-collection'].createIndex({ docName: 1, value: 1, version: 1, });

Clone this wiki locally