Shipping MongoDB with our project

Hi,

I am interested in deploying MongoDB on target workstations for our software (possible licence issues and best practices)

I am working on a goverment funded project for an educational facility. We are planning to ship some kind of installer that sets up the software and its dependencies on the target workstations.

Would it be possible to distribute some kind of minimal MongoDB-backend with our software. I don’t see any problem in setting up the base dataset, once there is some kind of mongodb server installed. I do worry about licence issues and I wonder what would be the best practice to provide the users of our software with a lean and unobstusive db backend.

I admit that I did not have much time to search the documention and this forum for answers to my question. If this topic is already covered, please provide a link.

Best regards

I’ve covered all the deployment issues.

I am still worrying a bit about license issues because sadly we can’t avoid to include a closed-source shared library in our project.

Hello , This is an issue i am facing also - have you got an answer on this?

Hi Eyal, I am still a beginner regarding MongoDB. But deployment was surprisingly easy.

We are still in development/testing and for our test workstations we are using this (I don’t know if it’s best practice, but it’s working perfectly fine):

We are shipping the tgz/zip versions of the MongoDB software with a small setup script, that generates a minimal configuration file with absolute paths for system-log, storage and pid-file.

systemLog:
  destination: file
  logAppend: false # we want to keep the logs short
  path: /PORTABLE_MONGODB_FOLDER/mongod.log

storage:
  dbPath: /PORTABLE_MONGODB_FOLDER/data
  journal:
    enabled: true

processManagement:
  fork: true  # fork and run in background
  pidFilePath: /PORTABLE_MONGODB_FOLDER/mongod.pid

net:
  port: CUSTOM_PORT
  bindIp: 127.0.0.1

Additionally some kind of init-file is created, that provides the database path to our software. When our software launches we start the mongodb daemon binary with the -f option so that it uses our custom configuration and not searches for a global one.

/PORTABLE_MONGODB_FOLDER/bin/mongod -f /PORTABLE_MONGODB_FOLDER/mongod.conf

And killing it with the process ID provided in the pid file.

kill $(cat /PORTABLE_MONGODB_FOLDER/mongod.pid)

This is working like a charm on linux and windows workstations (with small adjustments for windows). It is very lean and totally unubstrusive. We don’t need any installation. We can also access the db at a custom port and prevent interference with another mongodb that the customer might have already installed. All mongodb-related files are in one directory.

I don’t know, if it would even be possible to use relative paths in the configuration. Then we wouldn’t even need the setup script.

I haven’t figured out all the licensing issues. Seems like it wouldn’t be any problem at all if our software was completely open source. Unfortunately, we’re depending on at least one closed source static library. We couldn’t find out, if it would be OK to ship the mongodb binaries together with this closed source library. Therefore we plan to make the install script download the mongodb binaries instead of shipping them once we deliver to customers.