Recently, MongoDB announced that they are discontinuing support for Atlas Sync, and developers will be looking for alternatives. I thought it would be a good idea to write an article on how we host the Realm server ourselves.
In the realm-core
repository, the source code for the synchronization server is located. We will need to add some wrappers and launch the server. Launching is trivial. Build realm-core
from here: https://github.com/molind/realm-core/tree/auth_check (There are minimal changes to allow authorization with our tokens. You can check the diff). Then, in your server.cpp
, write approximately the following:
#include <stdio.h>
#include <unistd.h>
#include <realm/sync/noinst/server/server.hpp>