Havarti 0.4

A quaint cheese shop that plays nicely in The Cloud
havarti is a quaint cheese shop that plays nicely in The Cloud.

Installation

Havarti is a Flask app with a Celery downloader. Anything that can handle that can run it, but here are some suggestions on how to run it.

Heroku

The default way of hosting Havarti is with Heroku, MongoHQ, and S3.

 git clone git@github.com:jakebasile/Havarti.git && cd havarti
 heroku apps:create --stack cedar
 heroku addons:add mongohq:free
 heroku config:add STORAGE=s3storage \
 AWS_ACCOUNT_KEY_ID=< Your AWS Key ID > \
 AWS_SECRET_KEY_ID=< Your AWS Secret > \
 MONGO_KEY=MONGOHQ_URL
 git push heroku master
 heroku scale web=1 downloader=1


You can also use Rackspace Cloud Files to store the cache by changing the config line to:

 heroku config:add STORAGE=rackspacestorage \
 RACKSPACE_USERNAME=< Your Rackspace Username > \
 RACKSPACE_KEY=< Your Rackspace API Key > \
 MONGO_KEY=MONGOHQ_URL


Local

Maybe you don't want to be a cool cat and run Havarti on Heroku. You want to run it locally. Here's one way to do it. First, install Havarti somewhere:

 virtualenv havarti-install
 cd havarti-install
 source bin/activate
 pip install havarti gunicorn supervisor


This will install Havarti, Gunicorn, and Supervisor to run it all. Now, make a supervisord.conf file in this directory:

[unix_http_server]
file=supervisord.sock
chmod=0777

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisord]
logfile=logs/supervisor.txt
loglevel=info
pidfile=supervisord.pid

[supervisorctl]
serverurl=unix://supervisord.sock

[program:mongodb]
command=mongod
stdout_logfile=logs/mongodb.txt
stderr_logfile=logs/mongodb-err.txt
priority=1

[program:havarti]
command=bin/gunicorn -w 3 --preload -b 0.0.0.0:80 havarti:app
stdout_logfile=logs/havarti.txt
stderr_logfile=logs/havarti-err.txt
environment=STORAGE=localstorage
priority=2

[program:celery]
command=bin/celery --app=havarti worker -l info
stdout_logfile=logs/celery.txt
stderr_logfile=logs/celery-err.txt
environment=STORAGE=localstorage
priority=3


This assumes that you have MongoDB installed previously. Then, again from this directory, just create the directories needed and start Supervisor!

 mkdir logs
 sudo mkdir -p /data/db
 sudo bin/supervisord


You can now control the processes through supervisorctl. Check out Supervisor's documentation for more info on it.

Usage

Havarti acts as a proxy for PyPI, intercepting requests for packages. When it recieves a package request, it follows a simple decision tree:

- Is package/version cached?
- Yes: serve cached package.
- No: Mark package for caching, serve PyPI package.

Havarti checks for new versions with every request, so you are always able to get the very newest version of whatever package you require (and then the new version will be cached from then on).

Downloading

Just substitute your Havarti Index URL when using Pip. Your Havarti Index URL is wherever you hosted Havarti + '/i/', e.g. 'http://random-phrase-5000.herokuapp.com/i/'.

 pip install -i http://random-phrase-5000.herokuapp.com/i/ reap

You can add this to your pip.conf to save some keystrokes.

Uploading

You can also upload packages to Havarti directly. These will not be pushed to PyPI, but are available to anyone with the Havarti url. To upload, just use your Havarti Upload URL with setup.py. Your Havarti Upload URL is wherever you hosted Havarti + '/u/', e.g. 'http://random-phrase-5000.herokuapp.com/u/'.

 python setup.py sdist upload -r http://random-phrase-5000.herokuapp.com/u/

You can also set this up in a .pypirc file to save even more keystrokes.

last updated on:
September 14th, 2012, 16:21 GMT
price:
FREE!
developed by:
Jake Basile
homepage:
github.com
license type:
The Apache License 2.0 
category:
ROOT \ Utilities

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Add your review!

SUBMIT