Created
November 9, 2010 19:07
-
-
Save anonymous/669608 to your computer and use it in GitHub Desktop.
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
# easy_install fabric | |
# | |
# Usage: | |
# fab geonode | |
from fabric.api import env, sudo, run, cd | |
def setup(): | |
sudo('apt-get -y update') | |
sudo('apt-get -y dist-upgrade') | |
sudo('add-apt-repository "deb http://archive.canonical.com/ lucid partner"') | |
sudo('apt-get -y update') | |
# not working yet, how can we programmatically accept the EULA? | |
# run("DEBIAN_FRONTEND=noninteractive sudo apt-get install -y sun-java6-jdk || debconf 'echo SET shared/accepted-sun-dlj-v1-1 true; echo $(read) >&2' apt-get install -y sun-java6-jdk") | |
sudo('apt-get install -y openjdk-6-jdk') | |
sudo('apt-get install -y subversion git-core binutils build-essential python-dev python-setuptools python-imaging python-reportlab gdal-bin libproj-dev libgeos-dev unzip maven2 python-urlgrabber') | |
def build(): | |
run('git clone git://github.com/GeoNode/geonode.git') | |
run('cd geonode;git submodule update --init') | |
# WORKAROUND: Avoid compiling reportlab because it is already installed via apt-get and it hangs with fabric (too much data) | |
run("sed '/reportlab/d' geonode/shared/core-libs.txt > core-libs.txt;mv core-libs.txt geonode/shared/core-libs.txt") | |
run('cd geonode;python bootstrap.py') | |
run('cd geonode;source bin/activate; paver build') | |
run('cd geonode;source bin/activate; paver make_release') | |
def deploy(): | |
dns = config.get('ec2', 'HOST') | |
run("perl -pi -e 's/127.0.0.1/0.0.0.0/g' geonode/shared/dev-paste.ini") | |
run("perl -pi -e 's/localhost/0.0.0.0/g' geonode/src/geoserver-geonode-ext/jetty.xml") | |
run('echo "SITEURL = \'http://%s:8000/\'" >> geonode/src/GeoNodePy/geonode/local_settings.py' % dns ) | |
run('echo "GEOSERVER_BASE_URL = \'http://%s:8001/geoserver/\'" >> geonode/src/GeoNodePy/geonode/local_settings.py' % dns ) | |
run('echo "GEONETWORK_BASE_URL = \'http://%s:8001/geonetwork/\'" >> geonode/src/GeoNodePy/geonode/local_settings.py' % dns ) | |
# set the django settings module in the activate script to avoid having to type in some cases | |
run('echo "export DJANGO_SETTINGS_MODULE=\'geonode.settings\'" >> geonode/bin/activate') | |
# create a passwordless superuser, you can use 'django-admin.py changepassword admin' afterwards | |
run('cd geonode;source geonode/bin/activate;django-admin.py createsuperuser --noinput --username=admin [email protected]') | |
print "In order to login you have to run first 'django-admin.py changepassword admin'" | |
def hosty(): | |
dns = config.get('ec2', 'HOST') | |
print "Access your new geonode instance via the following url:" | |
run('cd geonode;source bin/activate;django-admin.py createsuperuser --noinput --username=admin [email protected]') | |
print "http://%s:8000" % dns | |
run('cd geonode;source bin/activate;paver host') | |
def geonode(): | |
setup() | |
build() | |
deploy() | |
hosty() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment