-
Notifications
You must be signed in to change notification settings - Fork 7
HOWTO: Amazon EC2 Setup
-
Update AMI tools:
sudo yum update
-
Install nginx, uWSGI and required libraries:
sudo yum install python26 python26-devel make automake nginx gcc gcc-c++ python-setuptools git sudo easy_install pip sudo pip install uwsgi virtualenv
-
Grab the latest Flask from github:
cd /your/directory/ git clone https://github.com/hrybacki/crowd-scholar.git
-
Setup a virtualenv for the repo:
cd /your/directory/crowd-scholar virtualenv venv . venv/bin/activate pip install Flask pymongo
-
Create database directories and launch MongoDB instances:
sudo mkdir -p /your/directory/crowd-scholar/data/raw sudo mkdir -p /your/directory/crowd-scholar/data/articles
-
Download and install MongoDB:
curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.3.tgz tar -xzf mongodb-linux-x86_64-2.4.3.tgz cd mongodb-linux-x86_64-2.4.3/bin ./mongod --version
-
Launch MongoDB instances: (Note: If you see File Preallocator Progress status continuing stop the service and attempt to reexecute it.)
sudo ./mongod --port 27018 ../../data/raw & sudo ./mongod --port 27017 ../../data/articles &
-
Launch the Flask server:
cd /your/directory/crowd-scholar/ python main.py &
-
Now, move it to where you want and fix the permissions:
cd ~ sudo mkdir -p ~/run sudo chown -R nginx:nginx ~
-
Configure uWSGI -- make some directories:
sudo mkdir -p /var/log/uwsgi sudo mkdir -p /etc/uwsgi/apps-available sudo mkdir -p /etc/uwsgi/apps-enabled
-
Create a uWSGI configuration file via: sudo vim /etc/init/uwsgi.conf
description "uWSGI" start on runlevel [2345] stop on runlevel [06] respawn env UWSGI=/usr/bin/uwsgi env LOGTO=/var/log/uwsgi/emperor.log exec $UWSGI --master --emperor /etc/uwsgi/apps-enabled --die-on-term --uid nginx --gid nginx --logto $LOGTO
-
Start uWSGI:
start uwsgi
-
Configure a simple fork to run the blog via: sudo vim /etc/uwsgi/apps-available/hairycode.ini
[uwsgi] # Variables base = /crowd app = simple # Generic Config plugins = http,python home = %(base)/venv pythonpath = %(base) socket = /var/www/run/%n.sock module = %(app) callable = app logto = /var/log/uwsgi/%n.log
-
Link configuration file to the enabled sites folder:
sudo ln -s /etc/uwsgi/apps-available/hairycode.ini /etc/uwsgi/apps-enabled/hairycode.ini
-
Configure nginx to serve up the blog via: sudo vim /etc/nginx/conf.d/default.conf
server { listen 80; server_name crowd-scholar; server_name crowdscholar.net; root /crowd-scholar; location /static/ { alias /crowd-scholar/static/; expires 30d; access_log off; } location / { include uwsgi_params; uwsgi_pass unix:/run/crowdscholar.sock; } }
-
Launch ngnix:
cd /crowd-scholar sudo service nginx start Note: Here is the problem location - states /var/lib/nginx/tmp/client_body failed to load.