Skip to content

Instantly share code, notes, and snippets.

@cvan
Last active July 31, 2022 06:52
Show Gist options
  • Save cvan/4742341 to your computer and use it in GitHub Desktop.
Save cvan/4742341 to your computer and use it in GitHub Desktop.
install zamboni
# Install homebrew.
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# Acquire compiled dependencies.
brew install python libxml2 mysql libmemcached openssl swig jpeg redis elasticsearch
# Start services.
mkdir -p ~/Library/LaunchAgents
ln -nfs /usr/local/Cellar/mysql/*/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
ln -nfs /usr/local/Cellar/redis/*/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
ln -nfs /usr/local/Cellar/elasticsearch/*/homebrew.mxcl.elasticsearch.plist ~/Library/LaunchAgents/
launchctl load -wF ~/Library/LaunchAgents/*.plist
# Create a virtual environment.
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | $SHELL
source ~/.profile
mkvirtualenv --python=$(which python2.6) --no-site-packages zamboni
# Acquire python dependencies.
pip install --no-deps -r requirements/dev.txt
# Copy local settings.
cp docs/settings/settings_local.dev.py settings_local.py
cp settings_local.py settings_local_mkt.py
# Set up MySQL and import a fresh database dump.
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysqladmin -uroot create zamboni
python manage.py install_landfill
# Run database migrations for any recent schema changes.
schematic migrations
# Run Django development server.
python manage.py runserver 0.0.0.0:8000
# Run with Marketplace settings_local_mkt:
python manage.py runserver --settings=settings_local_mkt 0.0.0.0:8000
# Load up http://localhost:8000 and click the "Log In / Register" button.
# Make that user an admin:
mysql -uroot zamboni -e "select id from auth_user order by date_joined desc limit 1 into @id; update auth_user set is_superuser=1, is_staff=1 where id=@id; insert into groups_users (group_id, user_id) values (1, @id);"
# Install node.js and our node dependencies.
brew install nodejs
# For LESS CSS compilation.
npm install less -g
# For CSS minification on -dev and prod.
npm install clean-css -g
# For JS minification on -dev and prod.
npm install uglify-js -g
# Set up elasticsearch.
cp scripts/elasticsearch/elasticsearch.yml ../
elasticsearch -f -D es.config=$(pwd)'/../elasticsearch.yml'
python manage.py reindex --settings=settings_local
python manage.py reindex_mkt --settings=settings_local_mkt
# Edit cluster name in ../elasticsearch.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment