Adds docker file and mongo config

This commit is contained in:
Patrick McDonagh
2017-05-02 15:14:00 -05:00
parent 1cc1933df4
commit 2be84b694b
3 changed files with 106 additions and 0 deletions

44
mongo.Dockerfile Normal file
View File

@@ -0,0 +1,44 @@
FROM ubuntu:latest
# Install MongoDB
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb http://repo.mongodb.org/apt/ubuntu $(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2)/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
RUN apt-get update && apt-get install -y mongodb-org
RUN mkdir -p /data/db
COPY setup_mongo_admin.js /tmp/setup_mongo_admin.js
RUN mongod --fork --logpath=/var/log/mongodb.log && sleep 5 && mongo < /tmp/setup_mongo_admin.js
# COPY mongod.conf /etc/mongod.conf
EXPOSE 27107
CMD ["/usr/bin/mongod"]
# nginx python3 python3-pip python python-pip supervisor
# RUN service mongod restart
# COPY setup_mongo_users.js /tmp/setup_mongo_users.js
# RUN mongo -u "admin" -p "HenryPump@1903" --authenticationDatabase admin < /tmp/setup_mongo_users.js && service mongod restart
#
# COPY poc.conf /etc/nginx/sites-available/poc.conf
# RUN rm /etc/nginx/sites-endabled/default && ln -s /etc/nginx/sites-available/poc.conf /etc/nginx/sites-endabled/ && service nginx restart
#
# COPY pocwww /root/www/pocwww
# COPY production.ini /root/www/production.ini
# COPY setup.py /root/www/setup.py
# COPY README.txt /root/www/README.txt
# COPY CHANGES.txt /root/www/CHANGES.txt
# COPY generate_cert.sh /root/www/generate_cert.sh
# RUN chmod +x /root/www/generate_cert.sh
# RUN /root/www/generate_cert.sh
#
# RUN pip3 install /root/www/
# RUN pserve /root/www/development.ini http_port=6543
#
#
#
# RUN apt-get clean
# RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#
# EXPOSE 27017
#
# CMD ["pserve", "/root/www/development.ini", "http_port=6543"]

42
mongod.conf Normal file
View File

@@ -0,0 +1,42 @@
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
security:
authorization: enabled
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:

20
setup_mongo_admin.js Normal file
View File

@@ -0,0 +1,20 @@
admin = db.getSiblingDB('admin');
admin.createUser(
{
user: "admin",
pwd: "HenryPump@1903",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
);
poc = db.getSiblingDB('poc');
poc.createUser({
user: "poc_www",
pwd: "HenryPump1903",
roles: [ { role: "readWrite", db: "poc" } ]
});
poc.createUser({
user: "poc_java",
pwd: "HenryPump@1903",
roles: [ { role: "readWrite", db: "poc" } ]
});