I've been running the frontend of my kegbot install on Dreamhost for sometime now. I thought I would post some instructions on how I set this up in case others were interested. Just a little background on my setup. I have a linux machine that is hooked up locally at my kegerator, it uses the latest repository tip of the pykeg software. I have pykeg setup to use a MySQL database, this database exists on my dreamhost server. This allows me to source this data from anywhere with an internet connection. I then have the pykeg package installed on one of my Dreamhost subdomains. This ensures that my kegweb is always available, even if I take my local kegerator offline. Outlined below is the process I used to setup pykeg on my Dreamhost account. This will probably work with other shared hosting services as well.
1. Setup a new sub/domain with the following settings (DH Panel)
- Check: Passenger (Ruby/Python apps only)
- Make sure that "/public" was appended to the web directory
- It is reccomended to create a new user for this site, the user requires shell access
2. Connect to your host using ssh
3. Download and install python 2.6.6
cd ~
mkdir tmp
cd tmp
wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
tar -xzvf Python-2.6.6.tgz
cd Python-2.6.6
./configure --prefix=$HOME
make
make install
4. Add local directories to PATH
-Add the following lines to .bash_profile
export PATH="$HOME/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/lib/"
-Load the updated profile
source ~/.bash_profile
-Confirm that the localy installed python is first in the path
which python
5. Get Kegbot source
You can also push your local pykeg source to your own repository so that your remote Dreamhost install always has the same changes as your local install. In that case, clone your repo instead of the one below.
cd ~
hg clone https://kegbot.googlecode.com/hg/ kegbot
6. Install Kegbot in develop mode
cd ~/kegbot/pykeg
python setup.py develop
7. Setup configuration files
mkdir ~/.kegbot
cp ~/kegbot/pykeg/common_settings.py.example ~/.kegbot/common_settings.py
Make the following changes to ~/.kegbot/common_settings.py
-Complete the database settings to match your mysql server
-Set timezone
-Set MEDIA_ROOT='/home/
USERNAME/kegbot/pykeg/src/pykeg/web/media/'
-Alter the secret key from the default
-Set the admin name/email
-Set TEMPLATE_DIR='/home/
USERNAME/kegbot/pykeg/src/pykeg/web/templates/'
8. Copy kegweb.wsgi to web directory
cp ~/kegbot/pykeg/kegweb.wsgi ~/SITENAME/passenger_wsgi.py
Be sure the file is named passenger_wsgi.py as the Dreamhost Apache settings look for this specific file.
9. Edit passenger_wsgi.py
-Remove shebang line (#!/usr/bin/env python)
-Add following lines after import statement
INTERP = "/home/USERNAME/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
-Set Virtual Env
VIRTUAL_ENV = '/home/USERNAME'
10. Setup symlinks
cd ~/SITENAME/public
ln -s /home/USERNAME/lib/python2.6/site-packages/Django-1.2.5-py2.6.egg/django/contrib/admin/media admin_media
(Note: the Django directory may be different based on version downloaded)
ln -s /home/USERNAME/kegbot/pykeg/src/pykeg/web/media/ media
11. Add restart file
mkdir ~/SITENAME/tmp
touch ~/SITENAME/tmp/restart.txt
If all worked out you should have a functioning kegweb install on your Dreamhost account.
My Kegbot on Dreamhost