Open 360disrupt opened 5 years ago
The container was built and pushed this way: $ git clone https://github.com/mattlord/mongo-embedded-sample.git $ cd mongo-embedded-sample $ sudo docker build -t mattalord/mongo-embedded-sample:armhf . $ sudo docker push mattalord/mongo-embedded-sample
MongoDB Embedded is a library that you link into your application -- in this case the example iot_guestbook app. You cannot run it as a separate binary and it has no network support.
Thank you for your interest!
Ok thank you, that makes things more clear.
To build a non embedded version would I just have to change the target to mongod
instead of install-embedded-dev
in step 5 of your tutorial (and would I need step 4)?
Or is this a completely different story?
https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source#building-with-scons
I never installed it before from scratch, I used this packages:
yes | apt-get install g++ protobuf-compiler libprotobuf-dev libboost-dev curl m4 wget libssl-dev
yes | apt-get install mongodb-server
Is there a difference in the embedded version or why can a newer version be run on the pi than 3.2, Wasn't there this problem with MongoDB and 32bit ARM?
What's your primary goal? Is it e.g. to install and run standard MongoDB 4.0 on Debian 9/Stretch ARM64? I can then help you get there. :-)
Yes, I have a RPI3B+ with rasbian stretch.
My goal is to run a multi container app with a nodejs application in the backend which uses mongodb as a database. Currently, I have all running without docker and an old mongodb I installed with the package above. This is the setup I would like to get on my rpi.
version: "3"
services:
watchtower:
container_name: watchtower
image: v2tec/watchtower
env_file:
- watchtower.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /root/.docker/config.json:/config.json
command: --interval 30
mongo:
container_name: mongo
ports:
- '27017:27017'
volumes:
- '/var/opt/im/docker/mongo/data:/data/db'
- '/var/opt/im/docker/backup:/data/backup'
image: mongo
360disrupt_nodeapp:
container_name: 360disrupt_nodeapp
ports:
- '8080:8080'
env_file:
- nodeapp.env
depends_on:
- "mongo"
volumes:
- '/var/opt/im/docker/logs:/data/logs'
- '/var/opt/im/docker/backup:/data/backup'
image: index.docker.io/360disrupt/360disrupt_nodeapp:latest
360disrupt_gui:
container_name: 360disrupt_gui
ports:
- '80:80'
depends_on:
- "360disrupt_core"
image: index.docker.io/360disrupt/360disrupt_gui:latest
I want to expose the port of the mongo container and use it in my node container. I've done this on linux server but I didn't find a mongo 4.0 docker build for arm. Thus I anted to create my own.
OK. I also have a Pi3b+: https://medium.com/@mattalord/embedded-mongodb-4-0-on-raspberry-pi-e50fd1d65e43
You could build MongoDB 4.0 directly on the device as I did there, just changing the SCons target from "install-embedded-{dev,test}" to "mongo mongod" or even "all". As you saw, we have general instructions on building from source here: https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
You can also cross-compile as I did here: https://github.com/mattlord/mongo-embedded-sample/blob/master/build-instructions.md
I would recommend doing the cross-compile as it will be so much faster.
Scons fails to build the DB with the error:
Implicit Dependency src/mongo/libshell_core.so not found, needed by target ...
Do you have any idea what I need to install additionally?
I just did the steps from the tutorial on a new virtual machine linux debian 9.6 stretch
. I additionally installed
pip, git, libcurl4-openssl-dev, libssl-dev
It's hard to say much without knowing the specific scons invocation used, but I would start with this (removing all embedded specific notations):
python ./buildscripts/scons.py CC=/usr/bin/arm-linux-gnueabihf-gcc CXX=/usr/bin/arm-linux-gnueabihf-g++ --disable-warnings-as-errors --ssl --lto --prefix=$INSTALL_DIR core install -j$(grep -c ^processor /proc/cpuinfo)
If you haven't already done so set the INSTALL_DIR environment variable to where you want the build artifacts to be placed. You can then -- after a successful build -- tar it all up and scp it over to the Pi. For example:
export INSTALL_DIR=$HOME/mongodb-4.0.4-armhf && mkdir -p $INSTALL_DIR
Since you're just trying to build standard MongoDB Community 4.0, you can follow the general building from source instructions, but specifying the cross compilers as I did here using the CC and CXX variables.
I hope this helps! Let me know if you run into any snags.
I did follow your instructions and I was able to compile it and run the guestbook. I've seen that you build a docker container from it. It would be great if you could describe how to run it (and how to build a docker container out of it) in a way that it runs without the guestbook and listens to a specific port. E.g. after a debian package installation you can run it on a default port:
And store the data in
/home/pi/app/mongodb_data
.