.gitignore000066400000000000000000000003631516336406000130540ustar00rootroot00000000000000/build /node_modules /node_modules/.yarn-integrity package-lock.json /*.log /*.iws .idea/workspace.xml .idea/tasks.xml .idea/profiles_settings.xml .idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/profiles_settings.xml .scrutinizer.yml000066400000000000000000000010071516336406000142420ustar00rootroot00000000000000checks: javascript: true filter: excluded_paths: - test/* - node_modules/* - build/* - docs/* build: cache: disabled: true environment: google_chrome: use_latest: true dependencies: before: - export LATEST=$(nvm ls-remote | tail -1) - nvm install $LATEST # - nvm use $LATEST - npm install -g grunt-cli tests: override: - command: 'grunt' coverage: file: 'build/coverage/clover.xml' format: 'clover' .travis.yml000066400000000000000000000001231516336406000131670ustar00rootroot00000000000000language: node_js node_js: - "node" before_script: - npm install grunt-cli -g Dockerfile000066400000000000000000000031431516336406000130550ustar00rootroot00000000000000# docker build -t patrikx3/docker-debian-testing-mongodb-stable . # docker container ls # docker exec -it bash # docker attach # docker run -t -i patrikx3/docker-debian-testing-mongodb-stable bash # https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source # https://unix.stackexchange.com/questions/378644/how-to-install-mongodb-3-4-in-debian-stretch-9 # recipe # docker commit ${container_id} patrikx3/docker-debian-testing-mongodb-stable:built # docker commit ${container_id} patrikx3/docker-debian-testing-mongodb-stable:installed FROM debian:testing MAINTAINER patrikx3/docker-debian-testing-mongodb-stable - Patrik Laszlo - alabard@gmail.com ENV DEBIAN_FRONTEND=noninteractive ENV FORCE_UNSAFE_CONFIGURE=1 ENV SHELL=/bin/bash ARG MONGODB_BRANCH=v3.6 ARG MONGODB_RELEASE=r3.6.2 ENV PATH="/build/install:/build/mongo:${PATH}" RUN apt-get -y update RUN apt-get -y upgrade # libboost1.55-dev => libboost-dev # openjdk-8-jdk => openjdk-7-jdk # clang - might not needed RUN apt -y install man mc gcc python scons git glibc-source libssl-dev python-pip RUN mkdir build # clean up RUN apt-get autoremove -y RUN apt-get autoclean -y RUN apt-get clean -y WORKDIR build WORKDIR /build RUN git clone -b ${MONGODB_BRANCH} https://github.com/mongodb/mongo.git WORKDIR /build/mongo RUN git checkout tags/${MONGODB_RELEASE} RUN pip install -r buildscripts/requirements.txt RUN pip2 install --user regex #RUN scons all --disable-warnings-as-errors -j 8 --ssl #RUN scons core --disable-warnings-as-errors -j 8 --ssl #RUN scons install --disable-warnings-as-errors -j 8 --prefix /usr/bin CMD /bin/bash Gruntfile.js000066400000000000000000000004601516336406000133570ustar00rootroot00000000000000module.exports = (grunt) => { const builder = require(`corifeus-builder`); const loader = new builder.loader(grunt); loader.js({ replacer: { type: 'build', npmio: false, }, }); grunt.registerTask('default', builder.config.task.build.js); }; README.md000066400000000000000000000100331516336406000123360ustar00rootroot00000000000000[//]: #@corifeus-header [![Build Status](https://travis-ci.org/patrikx3/docker-debian-testing-mongodb-stable.svg?branch=master)](https://travis-ci.org/patrikx3/docker-debian-testing-mongodb-stable) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/patrikx3/docker-debian-testing-mongodb-stable/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/patrikx3/docker-debian-testing-mongodb-stable/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/patrikx3/docker-debian-testing-mongodb-stable/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/patrikx3/docker-debian-testing-mongodb-stable/?branch=master) # Debian Stretch / Buster / Bullseye / Testing MongoDB and MongoDB Tools build stable [//]: #@corifeus-header:end It is basically a built for the latest MongoDB for Debian. The current varsion is the r3.6.x build (release). ### Warning It will remove all ```mongodb*``` apt packages in ```./scripts/build-server.sh```, your old ```/etc/mongodb.conf``` (though it saves by timestamp like ```/etc/mongodb.conf.$TIMESTAMP.save```) and ```/etc/systemd/system/mongodb-server.service``` is replaced. It install the required apt dependencies and generates the ```SystemD``` service, enables and starts. It is for testing, you build it in Docker to test it, but the live building is on the server in the directory in the GIT repository ```build``` directory and then it puts the files into ```/usr/bin```. ## Scripts It can work with sudo, but the best if you are ```root```. Of course, you can check the ```code```, there is no ```harm``` for sure! ```bash git https://github.com/patrikx3/docker-debian-testing-mongodb-stable cd docker-debian-testing-mongodb-stable ``` If below you get an error, please create and ```issue```, because it is possible I did not added a package, because my server was already there, but I will add in it for you for sure with ```apt```. ### 1. Build MongoDB Server The command: ```bash sudo ./scripts/build-server.sh ``` From: https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source All defaults are in the config are the MongoDB uses: * /var/log/mongodb - log * /var/lib/mongodb - data It generates everything, all you have to do: ```bash sudo ./scripts/build-server.sh r3.6.2 ``` ### 2. Build MongoDB Tools The command: ```bash ./scripts/build-tools.sh ``` It generates and install GoLang and builds the tools that you find them in: https://github.com/mongodb/mongo-tools Then it puts all tools into the default Debian ```/usr/bin``` directories. The exact command is like: ```bash sudo ./scripts/build-tools.sh r3.6.2 ``` ### 3. Sometimes check the kernel The command: ```bash ./scripts/check-kernel.sh ``` It the kernel have changed, it better to re-build the server and the tools. [//]: #@corifeus-footer --- [**P3X-DOCKER-DEBIAN-TESTING-MONGODB-STABLE**](https://pages.corifeus.com/docker-debian-testing-mongodb-stable) Build v3.6.137-90 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=LFRV89WPRMMVE&lc=HU&item_name=Patrik%20Laszlo&item_number=patrikx3¤cy_code=HUF&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) ## Sponsor [![JetBrains](https://www.patrikx3.com/images/jetbrains-logo.svg)](https://www.jetbrains.com/) [//]: #@corifeus-footer:endartifacts/000077500000000000000000000000001516336406000130425ustar00rootroot00000000000000artifacts/root-filesystem/000077500000000000000000000000001516336406000162075ustar00rootroot00000000000000artifacts/root-filesystem/etc/000077500000000000000000000000001516336406000167625ustar00rootroot00000000000000artifacts/root-filesystem/etc/mongodb.conf000066400000000000000000000060531516336406000212620ustar00rootroot00000000000000net: bindIp: 0.0.0.0 port: 27017 unixDomainSocket: filePermissions: 0770 # ssl: # mode: requireSSL # PEMKeyFile: /etc/ssl/patrikx3.com.pem # CAFile: /etc/ssl/acme/patrikx3.com/ca.cer # allowConnectionsWithoutCertificates: true storage: dbPath: "/var/lib/mongodb" journal: enabled: true systemLog: destination: "file" logAppend: true path: "/var/log/mongodb/mongodb.log" # add it after you setup the auth if you need it #security: # authorization: enabled #storage: # dbPath: "/var/lib/mongodb" # directoryPerDB: true # journal: # enabled: true #systemLog: # destination: file # path: "/var/log/mongodb/mongodb.log" # logAppend: true # timeStampFormat: iso8601-utc #processManagement: # fork: true #net: # bindIp: 127.0.0.1,192.168.78.20 # port: 27017 # wireObjectCheck : false # mongodb.conf # Where to store the data. #dbpath=/var/lib/mongodb #where to log #logpath=/var/log/mongodb/mongodb.log #logappend=true #bind_ip = 127.0.0.1,192.168.78.20 #port = 27017 #auth = true # Enable journaling, http://www.mongodb.org/display/DOCS/Journaling #journal=true ############################# # Enables periodic logging of CPU utilization and I/O wait #cpu = true # Turn on/off security. Off is currently the default #noauth = true #auth = true # Verbose logging output. #verbose = true # Inspect all client data for validity on receipt (useful for # developing drivers) #objcheck = true # Enable db quota management #quota = true # Set oplogging level where n is # 0=off (default) # 1=W # 2=R # 3=both # 7=W+some reads #oplog = 0 # Diagnostic/debugging option #nocursors = true # Ignore query hints #nohints = true # Disable the HTTP interface (Defaults to localhost:27018). #nohttpinterface = true # Turns off server-side scripting. This will result in greatly limited # functionality #noscripting = true # Turns off table scans. Any query that would do a table scan fails. #notablescan = true # Disable data file preallocation. #noprealloc = true # Specify .ns file size for new databases. # nssize = # Accout token for Mongo monitoring server. #mms-token = # Server name for Mongo monitoring server. #mms-name = # Ping interval for Mongo monitoring server. #mms-interval = # Replication Options # in replicated mongo databases, specify here whether this is a slave or master #slave = true #source = master.example.com # Slave only: specify a single database to replicate #only = master.example.com # or #master = true #source = slave.example.com # Address of a server to pair with. #pairwith = # Address of arbiter server. #arbiter = # Automatically resync if slave data is stale #autoresync # Custom size for replication operation log. #oplogSize = # Size limit for in-memory storage of op ids. #opIdMem = # SSL options # Enable SSL on normal ports #sslOnNormalPorts = true # SSL Key file and password #sslPEMKeyFile = /etc/ssl/mongodb.pem #sslPEMKeyPassword = pass artifacts/root-filesystem/etc/systemd/000077500000000000000000000000001516336406000204525ustar00rootroot00000000000000artifacts/root-filesystem/etc/systemd/system/000077500000000000000000000000001516336406000217765ustar00rootroot00000000000000artifacts/root-filesystem/etc/systemd/system/mongodb-server.service000066400000000000000000000010101516336406000263010ustar00rootroot00000000000000[Unit] Description=An object/document-oriented database Documentation=man:mongod(1) After=network.target [Service] User=mongodb Group=mongodb RuntimeDirectory=mongodb RuntimeDirectoryMode=0755 EnvironmentFile=-/etc/default/mongodb Environment=CONF=/etc/mongodb.conf Environment=SOCKETPATH=/run/mongodb ExecStart=/usr/bin/mongod --unixSocketPrefix=${SOCKETPATH} --config ${CONF} $DAEMON_OPTS LimitFSIZE=infinity LimitCPU=infinity LimitAS=infinity LimitNOFILE=64000 LimitNPROC=64000 [Install] WantedBy=multi-user.target build-configure000077500000000000000000000002151516336406000140640ustar00rootroot00000000000000#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" docker build -t patrikx3/docker-debian-testing-mongodb-stable . docker-debian-testing-mongodb-stable.iml000066400000000000000000000006241516336406000206240ustar00rootroot00000000000000 docker-scripts/000077500000000000000000000000001516336406000140165ustar00rootroot00000000000000docker-scripts/build000077500000000000000000000005311516336406000150420ustar00rootroot00000000000000#!/usr/bin/env bash # https://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line # CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu || echo "$NUMBER_OF_PROCESSORS") CORES=$(grep -c ^processor /proc/cpuinfo) scons all --disable-warnings-as-errors -j ${CORES} --ssl docker-scripts/install000077500000000000000000000005511516336406000154130ustar00rootroot00000000000000#!/usr/bin/env bash # https://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line # CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu || echo "$NUMBER_OF_PROCESSORS") CORES=$(grep -c ^processor /proc/cpuinfo) scons install -j ${CORES} --disable-warnings-as-errors --prefix /usr/bin package.json000066400000000000000000000024701516336406000133530ustar00rootroot00000000000000{ "name": "p3x-docker-debian-testing-mongodb-stable", "corifeus": { "prefix": "p3x-", "type": "build", "cdn": true, "nodejs": "v9.5.0", "icon": "fa fa-database", "code": "MissOut" }, "version": "3.6.137-90", "description": "Debian Stretch / Buster / Bullseye / Testing MongoDB and MongoDB Tools build stable ", "main": "src/index.js", "directories": { "test": "test" }, "scripts": { "test": "grunt", "coverage": "istanbul cover node_modules/mocha/bin/_mocha --report clover -- -R spec test/mocha/**/*.js" }, "repository": { "type": "git", "url": "https://github.com/patrikx3.com/docker-debian-testing-mongodb-stable" }, "keywords": [ "debian", "mongodb", "mongodb tools", "stretch", "buster", "bullseye", "testing", "tools", "mongodb-tools", "build", "linux", "stable", "latest" ], "author": "Patrik Laszlo ", "license": "MIT", "devDependencies": { "corifeus-builder": "^1.7.1209-305" }, "engines": { "node": ">=8.9.0" }, "homepage": "https://pages.corifeus.com/docker-debian-testing-mongodb-stable", "dependencies": {} }run-built000077500000000000000000000002731516336406000127330ustar00rootroot00000000000000#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" docker run -v $DIR/docker-scripts:/build/scripts -ti patrikx3/docker-debian-testing-mongodb-stable:built bash run-preconfigured000077500000000000000000000002741516336406000144510ustar00rootroot00000000000000#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" docker run -v $DIR/docker-scripts:/build/scripts -ti patrikx3/docker-debian-testing-mongodb-stable:latest bash scripts/000077500000000000000000000000001516336406000125515ustar00rootroot00000000000000scripts/build-server.sh000077500000000000000000000077101516336406000155200ustar00rootroot00000000000000#!/usr/bin/env bash # based on https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source # the current directory DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # if an error exit right away, don't continue the build set -e # some info echo #echo "Works like command, use a tag: sudo ./scripts/build-.sh v3.6 r3.6.2" echo "Works like command, use a tag: sudo ./scripts/build-server.sh r3.6.2" echo # check if we are root if [[ $EUID -ne 0 ]]; then echo "This script must be ran via root 'sudo' command or using in 'sudo -i'." exit 1 fi # require mongo branch #if [ -z "${1}" ]; then # echo "First argument must be the MONGODB_BRANCH for example 'v3.6'" # exit 1 #fi #MONGODB_BRANCH="${1}" # require mongo release #if [ -z "${2}" ]; then # echo "The second argument must be the MONGODB_RELEASE for example 'r3.6.2'" # exit 1 #fi #MONGODB_RELEASE="${2}" # require mongo release if [ -z "${1}" ]; then echo "The first argument must be the MONGODB_RELEASE for example 'r3.6.2'" exit 1 fi MONGODB_RELEASE="${1}" # delete all mongo other programs, we self compile apt remove --purge mongo* # the required packages for debian apt -y install gcc python scons git glibc-source libssl-dev python-pip # generate build directory variable BUILD=$DIR/../build # delete previous build directory rm -rf $BUILD/mongo # generate new build directory mkdir -p $BUILD # the mongodb.conf and systemd services files in a directory variable ROOT_FS=$DIR/../artifacts/root-filesystem # find out how many cores we have and we use that many CORES=$(grep -c ^processor /proc/cpuinfo) # go to the build directory pushd $BUILD # clone the mongo by branch #git clone -b ${MONGODB_BRANCH} https://github.com/mongodb/mongo.git # clone the mongo by branch git clone https://github.com/mongodb/mongo.git # the mongo directory is a variables MONGO=$BUILD/mongo # go to the mongo directory pushd $MONGO # checkout the mongo release git checkout tags/${MONGODB_RELEASE} # install the python requirements pip install -r buildscripts/requirements.txt # somewhere in the build it says if we install this, it is faster to build pip2 install --user regex # build everything scons all --disable-warnings-as-errors -j $CORES --ssl # install the mongo programs all scons install --disable-warnings-as-errors -j $CORES --prefix /usr # create a copy of the old config TIMESTAMP=$(($(date +%s%N)/1000000)) cp /etc/mongodb.conf /etc/mongodb.conf.$TIMESTAMP.save # copy the mongodb.conf configured and the systemd service file chmod o-rwx -R $ROOT_FS cp -avr $ROOT_FS/. / # generate mongodb user and group useradd mongodb -d /var/lib/mongodb -s /bin/false || true # create the required mongodb database directory and add safety mkdir -p /var/lib/mongodb chmod o-rwx -R /var/lib/mongodb chown -R mongodb:mongodb /var/lib/mongodb # create the required mongodb log directory and add safety mkdir -p /var/log/mongodb chmod o-rwx -R /var/log/mongodb chown -R mongodb:mongodb /var/log/mongodb # create the required run socket directory and add safety mkdir -p /run/mongodb chmod o-rwx -R /run/mongodb chown -R mongodb:mongodb /run/mongodb # add safety to the mongodb config file chmod o-rwx /etc/mongodb.conf chown mongodb:mongodb /etc/mongodb.conf # add safety to the mongodb systemd service file chmod o-rwx /etc/systemd/system/mongodb-server.service chown root:root /etc/systemd/system/mongodb-server.service # reload systemd services systemctl daemon-reload # enable the mongodb-server systemctl enable mongodb-server # start the mongodb-server service mongodb-server start # exit of the mongo directory popd # exit the build directory popdscripts/build-tools.sh000077500000000000000000000035551516336406000153550ustar00rootroot00000000000000#!/usr/bin/env bash # based on https://github.com/mongodb/mongo-tools # the current directory DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # if an error exit right away, don't continue the build set -e # some info echo echo "Works like command: sudo ./scripts/build-tools.sh r3.6.2" echo # check if we are root if [[ $EUID -ne 0 ]]; then echo "This script must be ran via root 'sudo' command or using in 'sudo -i'." exit 1 fi # require mongo release if [ -z "${1}" ]; then echo "The first argument must be the MONGODB_RELEASE for example 'r3.6.2'" exit 1 fi MONGODB_RELEASE="${1}" ## delete all mongo other programs, we self compile ##apt remove --purge mongo* ## the required packages for debian ##apt -y install gcc python scons git glibc-source libssl-dev python-pip apt -y install golang libpcap-dev # generate build directory variable BUILD=$DIR/../build # delete previous build directory rm -rf $BUILD/mongo-tools # generate new build directory mkdir -p $BUILD # find out how many cores we have and we use that many CORES=$(grep -c ^processor /proc/cpuinfo) # go to the build directory pushd $BUILD # clone the mongo by branch git clone https://github.com/mongodb/mongo-tools # the mongo directory is a variables MONGO_TOOLS=$BUILD/mongo-tools # go to the mongo directory pushd $MONGO_TOOLS # checkout the mongo release git checkout tags/${MONGODB_RELEASE} bash ./build.sh chown root:adm -R ./bin chmod o-rwx -R ./bin chmod ug+rx ./bin/* cp -r ./bin/. /usr/bin # for PROGRAM in bsondump mongodump mongoexport mongofiles mongoimport mongoreplay mongorestore mongostat mongotop # do # go build -o bin/${PROGRAM} -tags "ssl sasl" ${PROGRAM}/main/${PROGRAM}.go # done # exit of the mongo directory popd # exit the build directory popdscripts/check-kernel.sh000077500000000000000000000003211516336406000154370ustar00rootroot00000000000000#!/usr/bin/env bash # check if we are root sudo bash -c 'clear && echo && echo MongoDB: && cat /var/log/mongodb/mongodb.log | grep Kernel | tail -1 | cut -d \" -f16 && echo && echo System: && uname -r && echo'src/000077500000000000000000000000001516336406000116515ustar00rootroot00000000000000src/index.js000066400000000000000000000000431516336406000133130ustar00rootroot00000000000000module.exports = console.log('CI');tag-built000077500000000000000000000004651516336406000127050ustar00rootroot00000000000000#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z "${1}" ]; then echo "First argument is unset or set to the empty string, it should be a container_id that is built before installed." exit 1 fi docker commit ${1} patrikx3/docker-debian-testing-mongodb-stable:built tag-installed000077500000000000000000000004541516336406000135430ustar00rootroot00000000000000#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z "${1}" ]; then echo "First argument is unset or set to the empty string, it should be a container_id that is installed." exit 1 fi docker commit ${1} patrikx3/docker-debian-testing-mongodb-stable:installed test/000077500000000000000000000000001516336406000120415ustar00rootroot00000000000000test/arg-first.sh000077500000000000000000000000521516336406000142730ustar00rootroot00000000000000#!/usr/bin/env bash echo ${1} ls -all ${1}