-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# python-app | ||
# ├── Dockerfile | ||
# └── src | ||
# └── app.py | ||
# └── requirements.txt | ||
|
||
FROM python:3.6 | ||
|
||
MAINTANER [email protected] | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y python3-pip python3-dev | ||
|
||
# Create app directory | ||
WORKDIR /app | ||
|
||
# Install app dependencies | ||
COPY src/requirements.txt ./ | ||
|
||
RUN pip3 install -r requirements.txt | ||
|
||
# Bundle app source | ||
COPY src /app | ||
|
||
EXPOSE 8080 | ||
CMD [ "python3", "app.py" ] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
echo -e "Installation script for Docker CE and nvidia-docker on Ubuntu 16+" | ||
|
||
echo -e "Set non-interactive frontend" | ||
echo -e "Script will run without any prompts" | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
echo -e "\n###\n" | ||
echo -e "Installing prerequisites for Docker CE" | ||
echo -e "\n###\n" | ||
|
||
apt-get update | ||
apt-get remove docker docker-engine docker.io -y | ||
apt-get install -y \ | ||
apt-utils \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
wget \ | ||
software-properties-common | ||
|
||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | ||
|
||
sudo add-apt-repository \ | ||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | ||
$(lsb_release -cs) \ | ||
stable" | ||
|
||
echo -e "\n###\n" | ||
echo -e "Installing Docker CE" | ||
echo -e "Version: latest stable" | ||
echo -e "\n###\n" | ||
|
||
apt-get update | ||
apt-get install docker-ce -y | ||
|
||
docker build -t python-docker-dev . | ||
docker run --rm -it -p 8080:8080 python-docker-dev |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pymongo import MongoClient | ||
|
||
col = MongoClient("mongodb://localhost:27017/")["book_metadata"]["metadata"] | ||
print(col.find().count()) | ||
categories = ["Mystery, Thriller & Suspense" | ||
,"Science Fiction & Fantasy" | ||
,"Action & Adventure" | ||
,"Love & Romance" | ||
,"Business & Money" | ||
,"Health, Fitness & Dieting" | ||
,"Professional & Technical" | ||
,"Administration & Policy" | ||
,"Dictionaries & Thesauruses" | ||
,"Biographies & Memoirs" | ||
] | ||
|
||
def assign_rank(category): | ||
p = {'categories': {'$elemMatch': {'$elemMatch': {'$in': [category]}}}} | ||
documents = col.find(p).limit(10) | ||
ids = [i['asin'] for i in documents] | ||
ranks = list(range(1,11)) | ||
for i,rank in enumerate(ranks): | ||
col.update_one({'asin':ids[i]},{"$set":{"salesRank":{category:rank}}}) | ||
print("Updated category "+category) | ||
|
||
for i in categories: | ||
assign_rank(i) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use admin | ||
db.createUser({ | ||
user: "admin", | ||
pwd: "myadminpassword", | ||
roles: [ | ||
{ role: "userAdminAnyDatabase", db: "admin" }, | ||
{ role: "readWriteAnyDatabase", db: "admin" }, | ||
{ role: "dbAdminAnyDatabase", db: "admin" } | ||
] | ||
}); | ||
use book_log | ||
db.createUser({user:'db_grp7_test',pwd:'1234567',roles:[{role:'readWrite',db:'book_metadata'},{role:'readWrite',db:'book_log'}]}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
wget https://kindle-metadata.s3.amazonaws.com/kindle-metadata-after-correction.json | ||
sudo apt-get update | ||
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - | ||
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list | ||
sudo apt-get update | ||
sudo apt install python3-pip | ||
pip3 install pymongo | ||
sudo apt-get install -y mongodb-org | ||
sudo service mongod start | ||
mongoimport --db book_metadata --collection metadata --file kindle-metadata-after-correction.json | ||
pip3 install pymongo | ||
python3 assign_best_sellers.py | ||
mongo <mongo_util.js | ||
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf | ||
#sudo sed -i "s/#security:/security:\n authorization: 'enabled'/g" /etc/mongod.conf | ||
sudo service mongod restart |