Skip to content

Instantly share code, notes, and snippets.

@keokilee
keokilee / apache-wsgi-gist
Created December 27, 2010 22:04
Gist of Apache WSGI config for Makahiki
<VirtualHost 127.0.0.1:8100>
WSGIDaemonProcess kukui-cup-pinax python-path=/pinax-env/lib/python2.6/site-packages user=user group=staff home=/Users/user/kukui-cup-pinax
WSGIProcessGroup kukui-cup-pinax
ServerAdmin user@hawaii.edu
DocumentRoot "/Users/user/kukui-cup-pinax/"
WSGIScriptAlias / "/Users/user/kukui-cup-pinax/deploy/pinax.wsgi"
<Directory "/Users/user/kukui-cup-pinax/deploy">
@keokilee
keokilee / jenkins_virtualenv.sh
Created March 12, 2011 00:40
Creates a virtual env with Pinax if it doesn't exist.
#!/bin/bash
if [ -d ".env" ]; then
echo "**> virtualenv exists"
else
echo "**> creating virtualenv"
virtualenv .env
echo "**> Downloading Pinax"
curl http://downloads.pinaxproject.com/Pinax-0.7.3-bundle.tar.gz -o Pinax-0.7.3-bundle.tar.gz
echo "**> Extracting Pinax"
tar -xf Pinax-0.7.3-bundle.tar.gz
@keokilee
keokilee / jenkins_requirements.sh
Created March 12, 2011 00:47
Update the requirements in .env
source .env/bin/activate;
echo "**> Updating requirements."
pip install -r requirements.pip -q;
@keokilee
keokilee / local_settings.sh
Created March 12, 2011 00:50
Set up the local_settings.py for Jenkins.
source .env/bin/activate;
rm local_settings.py
# rename hudson specific file
cp example_settings/local_settings.py.test local_settings.py
echo "local_settings.py replaced with hudson version"
@keokilee
keokilee / jenkins_tests.sh
Created March 12, 2011 00:56
Run the tests in Jenkins and capture code coverage.
source .env/bin/activate;
coverage erase
coverage run --source="apps/,apps/" manage.py test --with-xunit --exe
# generate an xml coverage report
coverage xml -o coverage.xml
# generate html coverage reports
coverage html -d ../../builds/${BUILD_ID}/coverage_html
@keokilee
keokilee / jenkins_cleanup.sh
Created March 12, 2011 01:30
Clean up compiled files.
source .env/bin/activate;
# Clean files to prep for copy
echo "Cleaning local compiled files."
./manage.py clean_pyc
@keokilee
keokilee / jenkins-copy.sh
Created March 12, 2011 01:42
Copy to the staging folder
source .env/bin/activate;
echo "Copying to staging."
# Create new folder
mkdir ~/staging/$BUILD_TAG
# Copy files over.
cp -R . ~/staging/$BUILD_TAG/
@keokilee
keokilee / staging-virtualenv.sh
Created March 12, 2011 01:43
Start up the staging virtualenv
echo "Setting up environment."
source ~/Envs/user/bin/activate
rm -rf ~/staging/$BUILD_TAG/.env
echo "Linking settings, db, and files from current."
cp ~/staging/local_settings.py ~/staging/$BUILD_TAG/
cd ~/staging/$BUILD_TAG/
rm -rf site_media
ln -s ~/staging/site_media site_media
@keokilee
keokilee / update-reqs-db
Created March 12, 2011 01:47
Update the staging server's requirements and its database.
source ~/Envs/user/bin/activate
cd ~/staging/$BUILD_TAG/
echo "Updating requirements and migrating database."
pip install -r requirements.pip -q;
python manage.py syncdb
python manage.py migrate
@keokilee
keokilee / cd-reload.sh
Created March 12, 2011 01:50
Reload the code
source ~/Envs/user/bin/activate
cd ~/staging/$BUILD_TAG/
echo "Updating symlink and deploying."
ln -fns ~/staging/$BUILD_TAG ~/staging/makahiki
touch ~/staging/makahiki/deploy/pinax.wsgi