Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
Upgrade to version 3.4 and fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
jadsonlourenco committed Sep 19, 2017
1 parent aa0f6ad commit b21842e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ FROM ubuntu:16.04
MAINTAINER Jadson Lourenço <[email protected]>
LABEL Description="Percona MongoRocks"

RUN apt-get update && apt-get install -y curl && \
curl -s -o /tmp/percona-server-mongodb-3.2.9-2.1-rd497c75-xenial-x86_64-bundle.tar https://www.percona.com/downloads/percona-server-mongodb-3.2/percona-server-mongodb-3.2.9-2.1/binary/debian/xenial/x86_64/percona-server-mongodb-3.2.9-2.1-rd497c75-xenial-x86_64-bundle.tar && \
tar -xf /tmp/percona-server-mongodb-3.2.9-2.1-rd497c75-xenial-x86_64-bundle.tar -C /tmp/ && \
dpkg -i /tmp/percona-server-mongodb-*.deb && \
apt-get remove -y curl && \
rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

ENV AUTH="yes" \
ENV DEBIAN_FRONTEND="noninteractive" \
AUTH="yes" \
ADMIN_USER="admin" \
ADMIN_PASS="admin" \
DBPATH="/data/db" \
DB_USER="user" \
DB_PASS="password"

EXPOSE 27017

COPY ./set_auth.sh /
COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh && chmod +x /set_auth.sh

RUN apt-get update && apt-get install -y curl libpcap0.8 && \
curl -s -o /tmp/percona-server-mongodb.tar https://www.percona.com/downloads/percona-server-mongodb-LATEST/percona-server-mongodb-3.4.7-1.8/binary/debian/xenial/x86_64/percona-server-mongodb-3.4.7-1.8-rae48d6e032-xenial-x86_64-bundle.tar && \
tar -xf /tmp/percona-server-mongodb.tar -C /tmp/ && \
dpkg -i /tmp/percona-server-mongodb-*.deb && \
rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

ENTRYPOINT ["/entrypoint.sh"]
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ while [[ RET -ne 0 ]]; do
RET=$?
done

mongo admin --eval "db.getSiblingDB('admin').runCommand({setParameter: 1, internalQueryExecYieldPeriodMS: 1000});"
mongo admin --eval "db.getSiblingDB('admin').runCommand({setParameter: 1, internalQueryExecYieldIterations: 100000});"

if [ ! -f "$DBPATH"/.mongodb_password_set ]; then
/set_auth.sh
fi
Expand Down
11 changes: 9 additions & 2 deletions set_auth.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash

echo "Creating user in MongoDB..."
mongo admin --eval "db.createUser({user: '$ADMIN_USER', pwd: '$ADMIN_PASS', roles:[{role: 'root', db: 'admin'}]});"
mongo admin --eval "db.createUser({ user: '$ADMIN_USER', pwd: '$ADMIN_PASS', roles:[{ role: 'root', db: 'admin' }] });"

mongo admin -u "$ADMIN_USER" -p "$ADMIN_PASS" << EOF
use admin
db.getSiblingDB('admin').runCommand({setParameter: 1, internalQueryExecYieldPeriodMS: 1000});
db.getSiblingDB('admin').runCommand({setParameter: 1, internalQueryExecYieldIterations: 100000});
EOF

if [ "$DATABASE" != "" ]; then
mongo admin -u "$ADMIN_USER" -p "$ADMIN_PASS" << EOF
use $DATABASE
db.createUser({user: '$DB_USER', pwd: '$DB_PASS', roles:[{role: 'dbOwner', db: '$DATABASE'}]})
db.createUser({ user: '$DB_USER', pwd: '$DB_PASS', roles:[{ role: 'dbOwner', db: '$DATABASE'}] });
EOF
fi

Expand Down

0 comments on commit b21842e

Please sign in to comment.