Skip to content

Instantly share code, notes, and snippets.

@silpol
Forked from woodb/setup_flask_and_friends.sh
Last active August 28, 2015 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silpol/10f488fb05563a5b6910 to your computer and use it in GitHub Desktop.
Save silpol/10f488fb05563a5b6910 to your computer and use it in GitHub Desktop.
Shell script to get setup with Flask, nginx and uWSGI on an Amazon EC2 Linux image
#!/bin/bash
#
# Shell script to automatically configure a new Flask, nginx and uWSGI based blog
# on an Amazon EC2 instance.
#
# See http://bit.ly/MeGwjD for more information!
#
# If you are forking this for your own custom configuration script, see the following other gists:
# https://gist.github.com/3071737
# https://gist.github.com/3071739
# https://gist.github.com/3071740
#
# python26 promoted to python27
sudo yum install python27 python27-devel make automake nginx gcc gcc-c++ python-setuptools git
sudo easy_install pip
sudo pip install uwsgi virtualenv
cd ~
git clone https://github.com/orf/simple.git myblog
cd ~/myblog
virtualenv venv
. venv/bin/activate
pip install Flask Flask-SQLAlchemy markdown
python create_config.py
cd ~
sudo mkdir -p /var/www/run
sudo cp -R myblog /var/www/blog
sudo chown -R nginx:nginx /var/www/
sudo mkdir -p /var/log/uwsgi
sudo mkdir -p /etc/uwsgi/apps-available
sudo mkdir -p /etc/uwsgi/apps-enabled
# raw gist switched to forked current sample
sudo wget https://gist.githubusercontent.com/silpol/ba89b87a65194e87a7d4/raw/e6b20da91d75e9134dcc0b962235c42e8ccdade9/uwsgi.conf /etc/init/uwsgi.conf
sudo vim /etc/init/uwsgi.conf
# raw gist switched to forked current sample
sudo wget https://gist.githubusercontent.com/silpol/1d6f1cabe6dd050be5db/raw/c58c01c0f2876a5fb270bbb7f63639c8e724b190/blog.ini /etc/uwsgi/apps-available/blog.ini
sudo vim /etc/uwsgi/apps-available/blog.ini
sudo ln -s /etc/uwsgi/apps-available/blog.ini /etc/uwsgi/apps-enabled/blog.ini
# raw gist switched to forked current sample
sudo wget https://gist.githubusercontent.com/silpol/8d1b2ffc6a001e1d6feb/raw/88e75a41f00d82377fa3bf83a39fdfe7d227c6c3/default.conf /etc/nginx/conf.d/default.conf
sudo vim /etc/nginx/conf.d/default.conf
sudo service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment