Skip to content

griffonnage/griffonnage-sync

Repository files navigation

Griffonnage - Sync Server

Scribble careless drawings with friends, privately

GitHub Tag GitHub Action CI/CD License

Synchronize drawings from Griffonnage using Socket-io.

Build Setup

// install dependencies and post-build app
$ npm install

// run in development mode
$ npm run dev

// run in production mode
$ npm run build
$ npm run start

Docker

Build

docker build -t griffonnage/griffonnage-sync:latest .

Run

docker run --rm --env-file .env -p 9000:9000 griffonnage/griffonnage-sync:latest

Scaling

Some technical requirements are involved if you plan on deploying this synchronization server as a cluster of nodes.

Please referer to the Socket-IO Documentation on the matter for extensive explanations.

Sticky sessions

Due to some long-polling operations required by Socket-IO, you need a "sticky session" mechanism in your load-balancing system.

For instance, if using Heroku you must enable their Session Affinity feature for your app:

$ heroku features:enable http-session-affinity -a <app-id>
$ heroku features -a <app-id>

Message broker

When scaling Socker-IO to multiple nodes, a message broker is required in order to pass messages between nodes seamlessly. Fortunately, Socker-IO as an "adapter" mechanism and an official Redis Adapter.

The Redis adapter is already integrated into this app, but disabled by default. To enable it, simply set the REDIS_URI environment variable:

REDIS_URI=redis://localhost:6379/0

License

Licensed under GNU Affero General Public License v3.0 (AGPLv3)

Copyright (c) 2020 - present Romain Clement