Created
January 21, 2018 15:15
-
-
Save terakilobyte/46273d69d51b2e38f3b64e172dda8468 to your computer and use it in GitHub Desktop.
m036 docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Grabbing Ubuntu | |
FROM ubuntu | |
# Install MongoDB | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 && \ | |
echo "deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-enterprise.list && \ | |
apt-get update && \ | |
apt-get install -y mongodb-enterprise && apt-get install -y libgssapi-krb5-2 libsasl2-2 libssl1.0.0 libstdc++6 snmp && \ | |
echo 'manual' | tee /etc/init/mongod.override | |
# make a user called vagrant | |
RUN useradd -ms /bin/bash vagrant | |
# USER newuser | |
# WORKDIR /home/newuser | |
# make directories for datasets | |
RUN mkdir /data && mkdir /shared && \ | |
mkdir -p /var/m036/auth && \ | |
chown -R vagrant:vagrant /data | |
# validator and change stream environment setup | |
RUN echo "#!/bin/bash echo -n 'm036 rocks' | openssl sha256 | sed -e s/\(stdin\)=.//" > /usr/local/bin/validate_box.bash && \ | |
chmod +x /usr/local/bin/validate_box.bash && \ | |
mkdir -p /var/m036/changestreams/{0,1,2} && \ | |
chown -R vagrant:vagrant /var/m036 && \ | |
apt-get -y install curl && \ | |
curl https://s3.amazonaws.com/university-courses/m036/streamer.tgz -o /tmp/streamer.tgz && \ | |
tar xzf /tmp/streamer.tgz && \ | |
mv streamer/streamer.conf /etc/init/ && \ | |
mv streamer/streamer.py /var/m036/changestreams/.streamer.py && \ | |
rm -rf /tmp/streamer.tgz && \ | |
chmod 0001 /var/m036/changestreams/.streamer.py | |
# network restrictions setup | |
RUN mkdir -p /var/m036/auth && \ | |
chown vagrant:vagrant /var/m036/auth && \ | |
curl https://s3.us-east-2.amazonaws.com/m036/restrictive -o /tmp/restrictive && \ | |
chmod +x /tmp/restrictive && \ | |
mv /tmp/restrictive /usr/bin/ | |
# install python dependencies | |
RUN apt-get -y install python-pip && \ | |
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" && \ | |
python get-pip.py && \ | |
rm -f get-pip.py && \ | |
pip install docopt faker && \ | |
pip install https://github.com/mongodb/mongo-python-driver/zipball/master | |
# User setup | |
RUN mkdir -p /data && \ | |
chmod -R 777 /data && \ | |
mkdir -p /data/db && \ | |
mkdir -p /home/vagrant/data && \ | |
chmod -R 777 /home/vagrant/data && \ | |
chown -R vagrant:vagrant /home/vagrant/data && \ | |
echo "Set LC_ALL=C to .profile" && \ | |
echo "export LC_ALL=C" >> /home/vagrant/.profile | |
CMD [ "tail", "-f", "/dev/null" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment