Last active
August 29, 2015 14:00
-
-
Save ziodave/11395260 to your computer and use it in GitHub Desktop.
install CKAN on Mac OS X (very alpha)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export CKAN_HOME=~/Developer/ckan | |
export SOLR_TMPL_CONF=/usr/local/opt/solr/libexec/example/solr | |
install_prerequisites() { | |
brew install solr | |
brew install postgres | |
brew install python | |
pip install --upgrade setuptools | |
pip install --upgrade pip | |
pip install --upgrade virtualenv | |
} | |
activate () { | |
. $CKAN_HOME/lib/default/bin/activate | |
} | |
rm_fr() { | |
rm -fr $CKAN_HOME/etc | |
rm -fr $CKAN_HOME/lib | |
rm -fr $CKAN_HOME/solr | |
} | |
create_folders() { | |
mkdir -p $CKAN_HOME/etc/default | |
mkdir -p $CKAN_HOME/lib/default | |
} | |
create_postgres() { | |
psql -c "CREATE ROLE ckan_default PASSWORD 'md55371973b6a925d285c554feaeb575e19' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;" postgres | |
createdb -O ckan_default ckan_default -E utf-8 | |
} | |
drop_postgres() { | |
dropdb ckan_default | |
dropdb ckan_test | |
dropdb datastore_default | |
dropdb datastore_test | |
dropuser ckan_default | |
} | |
restart_solr() { | |
kill $(ps aux | grep $CKAN_HOME/solr | awk '{print $2}') | |
sleep 5s | |
solr $CKAN_HOME/solr & | |
sleep 5s | |
} | |
rm_fr | |
install_prerequisites | |
create_folders | |
virtualenv --no-site-packages $CKAN_HOME/lib/default | |
cd $CKAN_HOME | |
activate | |
pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan' | |
# pip install -e 'git+https://github.com/ckan/[email protected]#egg=ckan' | |
pip install --allow-external argparse -r $CKAN_HOME/lib/default/src/ckan/requirements.txt | |
deactivate | |
activate | |
drop_postgres | |
create_postgres | |
cd $CKAN_HOME/lib/default/src/ckan | |
paster make-config ckan $CKAN_HOME/etc/default/development.ini | |
cp -R $SOLR_TMPL_CONF $CKAN_HOME | |
restart_solr | |
export SOLR_CONF=$CKAN_HOME/solr/collection1/conf | |
mv $SOLR_CONF/schema.xml $SOLR_CONF/schema.xml.bak | |
ln -s $CKAN_HOME/lib/default/src/ckan/ckan/config/solr/schema.xml $SOLR_CONF/schema.xml | |
restart_solr | |
cd $CKAN_HOME/lib/default/src/ckan | |
paster db init -c $CKAN_HOME/etc/default/development.ini | |
ln -s $CKAN_HOME/lib/default/src/ckan/who.ini $CKAN_HOME/etc/default/who.ini | |
cd $CKAN_HOME/lib/default/src/ckan | |
paster sysadmin add admin -c $CKAN_HOME/etc/default/development.ini |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment