Medium Rare
A Scalable Publishing Platform
Chris Giuffrida & Thomas Krill
Project Idea
Idea
What is Medium Rare?
Functionality Overview
Functionality Overview
Architecture
Unscaled Architecture
Flask Application Structure
Example Routing Function
@app.route('/article/<article_id>', methods=['POST','GET'])
@login_required
def blog_post(article_id):
try:
article = db.get_article(article_id)
suggested_articles = db.get_suggested_articles(article_id)
result = db.increase_article_views(article_id, 1)
except Exception as ex:
print(ex)
else:
if article:
article["date"] = "{:%A, %B %d, %Y, %I:%M %p}".format(article["date"])
paragraphs = article["text"].split("\r\n\r\n")
article["paragraphs"] = paragraphs
session["current_article"] = article_id
return render_template('blog-post.html', article=article, suggested_articles=suggested_articles)
return redirect(url_for("index", page="1"))
MongoDB Article and User Collection Structure
Article:
{
"_id": ObjectId("an-auto-generated-hash"),
"title": "Article Title",
"text": "Article Text",
"path": "/static/images/image-name.jpg",
"date": ISODate("YYYY-MM-DDTHH:MM:SS.XXXX"),
"reads": X,
"upvotes": X,
"downvotes": X,
"voters": {"Voter Username": true},
"author": "Author Username"
}
User:
{
"_id": "Username",
"username": "Username",
"email": "username@example.com",
"password": "pbkdf2:sha256:a-secure-hash"
}
Scaled Architecture
Benchmarking
Challenge: Picking a Testing Framework
CasperJS
-Needs node environment to execute
-Lots of dependencies
-Not well suited for running on a pool of machines (Condor)
PhantomJS
-Can run on Condor by sending over PhantomJS executable
-Difficult to write sequential testing programs with asynchronous JavaScript
Selenium
-Can be compiled into single JAR and run on any Condor machine with Java
-Intuitive to write test programs that require sequential page navigation
Selenium Tests
Initial Results
What’s Left?
Work Left to be Completed
Thank you!