KeyDB with ModJS

Hey All,

I am using the KeyDB image that Fly created. It has been working great -

I am curious if anyone has had any experience adding ModJS to KeyDB, and if so, how did it do.

Here is the ModJS repo that lets you add it to KeyDB.

Looking at the example KeyDB Dockerfile, I can see that they copy modjs.so over, but I am unclear from where since it looks like they created an empty folder just before it. Is modjs.so part of the default keydb image already?

# Use the latest KeyDB Docker Image and add ModJS layer
FROM eqalpha/keydb:latest
RUN mkdir -p /usr/lib/keydb/modules
# Copy over precompiled ubuntu18.04 module along with latest bootstrap.js
COPY modjs.so /usr/lib/keydb/modules
COPY bootstrap.js /usr/lib/keydb/modules
VOLUME /scripts
# Call module to load with keydb-server
CMD ["keydb-server", "/etc/keydb/keydb.conf", "--loadmodule", "/usr/lib/keydb/modules/modjs.so"]

I am still new to Docker, so I am fairly confused about how the add this. Especially since the Fly repo for KeyDB add Prometheus and Hivemind which makes it a little more confusing. Because those are custom scripts instead of just running KeyDB directly.

You should be able to use the pre-built Keydb image with modjs: eqalpha/modjs:keydb-latest.

$ docker run eqalpha/modjs:keydb-latest
<some output>
1:1:M 14 Feb 2022 09:22:48.748 # Server initialized
1:1:M 14 Feb 2022 09:22:48.914 # <module> Initialized ModJS v0.1.0
1:1:M 14 Feb 2022 09:22:48.946 * Module 'modjs' loaded from /usr/lib/keydb/modules/modjs.so

If you want the automatic peer discovery our image supports, you can clone our repo and replace the image in the FROM line in the Dockerfile.