Giter VIP home page Giter VIP logo

rpi3-mongodb3's Introduction

MongoDB 3.0.14 for Raspberry Pi 3 (ARMv7l) - Docker 17.11.0-ce+

This docker image uses pre-compiled 32bit ARM binaries from Andy Felong and the latest Raspbian Stretch build from Resin (https://hub.docker.com/r/resin/rpi-raspbian/)

Where to find this:

Github: https://github.com/andresvidal/rpi3-mongodb3

Docker Hub: https://hub.docker.com/r/andresvidal/rpi3-mongodb3/

MongoDB (32bit) Binary Notes

Binaries are built and maintained here: http://andyfelong.com/2017/08/mongodb-3-0-14-for-raspbian-stretch/

From the Andy Felong:

The latest version as of August 2017 is “Raspbian Stretch” — based upon the current stable version of Debian 9.  The previous version was known as “Raspbian Jessie”.  One difference between versions is OpenSSL libraries. OpenSSL is a general purpose cryptography library that provides an open source implementation of the Secure Sockets Layer (SSL).  My previous builds of MongoDB relied on the older library.  As a result, my previous binaries for 3.0.14 and 3.0.9 do not run under Raspbian Stretch.  Given this change as well as other changes to MongoDB source and newer compilers, I could no longer compile MongoDB 3.0.14 with SSL.

After a few source tweaks and use of various compiler flags, I have manged to compile MongoDB core apps and tools.  These binaries do NOT support SSL and only run under Raspian Stretch on a Raspberry Pi 3:

Usage

Prerequisites

  1. Docker 17.11.0-ce+

Build

docker build -t andresvidal/rpi3-mongodb3 .

Run

Starting MongoDB with Auth enabled.

First Read How to setup auth in MongoDB 3.0 Properly

$ docker run -d \
--name rpi3-mongodb3 \
--restart unless-stopped \
-v /data/db:/data/db \
-v /data/configdb:/data/configdb \
-p 27017:27017 \
-p 28017:28017 \
andresvidal/rpi3-mongodb3:latest \
mongod --auth

Add the initial Admin User. Replace [username] and [password]

From CLI

# creating a root user

$ docker exec -it rpi3-mongodb3 mongo admin --eval "db.createUser({user: '[username]', pwd: '[password]', roles:[{role:'root',db:'admin'}]});"

From Container's terminal

$ docker exec -it rpi3-mongodb3 mongo admin

connecting to: admin

> db.createUser({ user: "[username]", pwd: "[password]", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] })

Check the user has been created successfully

> db.auth("admin", "adminpassword")

Restart Container to ensure policies have applied.

#TODO: update docker entry script to allow SIGINT to gracefully stop MongoDB on stop/restart container.

$ docker kill --signal=SIGINT rpi3-mongodb3
$ docker start rpi3-mongodb3

Creating a Database and add a User with permissions

$ docker exec -it rpi3-mongodb3 mongo admin
> db.auth("admin", "adminpassword")

> use yourdatabase
> db.createUser({ user: "youruser", pwd: "yourpassword", roles: [{ role: "dbOwner", db: "yourdatabase" }] })

> db.auth("youruser", "yourpassword")
> show collections

Read more on how to Grant User Roles

FYI: The connection string to MongoDB for your application will look like this:

mongodb://youruser:yourpassword@localhost/yourdatabase

Starting MongoDB with REST enabled.

docker run -d \
--name rpi3-mongodb3 \
--restart unless-stopped \
-v /data/db:/data/db \
-v /data/configdb:/data/configdb \
-p 27017:27017 \
-p 28017:28017 \
andresvidal/rpi3-mongodb3:latest \
mongod --rest

rpi3-mongodb3's People

Contributors

andresvidal avatar

Stargazers

Hadj H. avatar

Watchers

lowdef avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.