Red Hat Production Deployment - abztrakt/labgeeks-buildout GitHub Wiki
These are some notes on how we got things running under Red Hat. We'd like to get buildout to take care of more of the steps that need to be done by hand eventually.
cd /data/labtools/ (don't put project in /var/www because of potential conflicts with other apache things)
make baseline virtualenv alongside project
virtualenv --no-site-packages baseline
checkout the repo
git clone git://github.com/abztrakt/labgeeks-buildout.git labgeeks
make project a virtual env (virtualenv labgeeks)
virtualenv --no-site-packages labgeeks
the activate script may need some additonal PATHs
edit bin/activate around line 45: (add mysql_config location to PATH and add mysql lib and bin location to LD_RUN_PATH)
I changed:
45 _OLD_VIRTUAL_PATH="$PATH"
46 PATH="$VIRTUAL_ENV/bin:$PATH"
47 export PATH
to:
45 _OLD_VIRTUAL_PATH="$PATH"
46 PATH="$VIRTUAL_ENV/bin:$PATH"
47 PATH="/usr/local/mysql-5.5.27-linux2.6-x86_64/bin:$PATH"
48 export PATH
49 LD_RUN_PATH="/usr/local/mysql-5.5.27-linux2.6-x86_64/lib:/usr/local/mysql-5.5.27-linux2.6-x86_64/bin:$LD_RUN_PATH"
50 export LD_RUN_PATH
activate, bootstrap, and buildout
cd labgeeks
source bin/activate
python bootstrap.py
buildout
tweak some things in local_settings.py cp labgeeks/sample_local_settings.py labgeeks/local_setting.py
edit labgeeks/local_settings.py
changes in local_settings.py:
PATH_TO_APP = '/var/django/labgeeks-buildout/labgeeks/'
ADMINS : add yourself and anyone relevant in this section in the format specified
DATABASES : edit as appropriate (use mysql!), remember the name, user and password.
MEDIA_ROOT = '/var/www/uploads/'
STATIC_ROOT = '/var/www/static/'
STATICFILES_DIRS : change uploads to "/var/www/uploads"
if moving an old labgeeksrpg site to the new labgeeks structure, see migrating from old labgeeks for the steps you need to perform before moving on.
set up database
mysql -u root -p
mysql> create database DBNAME;
mysql> GRANT ALL PRIVILEGES ON (insert name).* TO '(insert user)'@'localhost' IDENTIFIED BY '(insert password)' WITH GRANT OPTION;
labgeeks syncdb
labgeeks migrate
labgeeks test
in /etc/apache2/sites-available/default, add:
** unfinished from here - auth still needs to go in! ** ServerName your.server's.name Alias /robots.txt /var/www/robots.txt
<Directory /var/django/labgeeks-buildout>
Alias /static /var/www/static <Directory /var/www/static>
Alias /uploads /var/www/upload <Directory /var/www/static>
In each directory directive, add Order allow,deny Allow from all
WSGISriptAlias / /var/django/labgeeks-buildout/bin/labgeeks.wsgi
give www-data group write privileges over /var/www (chmod g+w www/)
create uploads and static dirs in /var/www/, make sure they are group www-data (see migrating from old labgeeks for details on moving uploads to the new server)
labgeeks collectstatic