Last active
December 14, 2015 14:29
-
-
Save samalba/5101010 to your computer and use it in GitHub Desktop.
Run gunicorn for a Python app on dotCloud using a custom service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $SERVICE_APPROOT | |
[ -d ~/env ] || | |
virtualenv --python=python2.7 ~/env || exit 1 | |
. ~/env/bin/activate | |
[ -f requirements.txt ] && | |
pip install --download-cache=~/.pip-cache -r requirements.txt || exit 1 | |
cp -R * ~/ | |
cat > ~/profile << ENDPROFILE | |
. ~/env/bin/activate | |
export PYTHONPATH=~/ | |
ENDPROFILE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api: | |
type: custom | |
buildscript: ./build.sh | |
processes: | |
# If you don't need websocket, remove the `-k' option and its argument. | |
api: gunicorn -b 0.0.0.0:$PORT_WWW -w 8 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker wsgi:app | |
ports: | |
www: http |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunicorn | |
gevent-websocket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment