Skip to content

Instantly share code, notes, and snippets.

@72squared
Created May 13, 2016 16:03
Show Gist options
  • Save 72squared/366c3f2afdba6fc5da1fe3d5b86e11d3 to your computer and use it in GitHub Desktop.
Save 72squared/366c3f2afdba6fc5da1fe3d5b86e11d3 to your computer and use it in GitHub Desktop.
# download pypy
wget "https://bitbucket.org/pypy/pypy/downloads/pypy-5.1.1-linux64.tar.bz2" -O - | tar -xj
# create virtual env with pypy
virtualenv -p pypy-5.1.1-linux64/bin/pypy .venv
# activate virtual environment
source .venv/bin/activate
# install uwsgi and gevent
pip install uwsgi gevent
# install sample app (restful file system)
pip install -e git://github.com/happybits/napfs@v0.0.3#egg=napfs
# create uwsgi config file - uses gevent
cat << EOF > uwsgi.ini
[uwsgi]
http = 127.0.0.1:8222
pypy-wsgi = main:app
master = true
vacuum = true
enable-threads = true
die-on-term = true
uid = nobody
gid = nogroup
max-requests = 500000
no-orphans = true
disable-logging = true
reload-mercy = 5
processes = 2
gevent = 1000
gevent-monkey-patch = true
EOF
# sample app setup
cat << EOF > main.py
import napfs
app = napfs.create_app()
EOF
# kick off uwsgi in foreground
uwsgi --ini ./uwsgi.ini
@72squared
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment