skip to Main Content

I’m currently developing a Python application and I would like to know if there are any ways to pack MongoDB and MySQL (or Postgresql) into the application. By packing I mean taking those application binaries and distribute them with the application files.

For example, Metasploit PRO has some applications like nginx, postgresql, java, ruby, etc… under /opt/metasploit (they come with the application setup), and I would like to know if that could be done with any Linux application. And if so, how could I "choose" what binaries are needed? Would they work for any Debian distro? Can any application follow that procedure? Could it be done with MySQL and MongoDB?

P.D: I would like to do this to distribute one unique application instead of having to "obligate" the user to setup the databases independently, and for pure curiosity.

Thank you very much in advance!

2

Answers


  1. I think you can pack the required services and your application as Docker image or Virtual Machine box.

    As my experience, I used to package the MongoDB and other Linux CLI tools with my NodeJS web application into a VM box using Vagrant. Or you can use Docker if you prefer container-based application.

    If you use Vagrant, the provisioning feature may help you to setup the database before running the application. Check https://www.vagrantup.com/docs/provisioning

    Login or Signup to reply.
  2. MongoDB already distributes its binaries as standalone binaries in the sense that everything needed for the database (or shell tools) to run is included in the respective binary (mongo/mongos/mongod).

    However, these binaries are OS (Linux distribution)-specific. Meaning, for example, they dynamically link against libssl and libcurl and you need to have the right versions of those libraries on the host system. So, for example, a MongoDB binary for Ubuntu 14.04 is likely to not work on Ubuntu 16.04.

    As far as I know MongoDB does not support building for "generic linux". Only specific OSes like Ubuntu 16.04 are supported.

    With that said, you could possibly build a "portable" MongoDB yourself if you accept some limitations, since its source code is available:

    • You need to figure out how to build MongoDB on some linux distribution that gives you the baseline glibc that would be compatible with all of your targets.
    • You may have to forego functionality like TLS connections, or figure out how to link against openssl statically (probably non-trivial).
    • This would be easier with older MongoDB versions (4.0, 3.6) since they have fewer system dependencies.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search