Skip to content

Commit

Permalink
Update install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Jun 6, 2013
1 parent 6de46ed commit 804c70a
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
#!/bin/sh

# libevent development files are required for gevent
sudo apt-get install libevent-dev
apt-get install libevent-dev

# Install GeoDjango dependencies -- see
# https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ubuntu
apt-get install binutils gdal-bin libproj-dev postgresql-9.1-postgis \
postgresql-server-dev-9.1 python-psycopg2

virtualenv .env
source .env/bin/activate

echo "Install the python requirements"
pip install -r requirements.txt

echo "Install the non-python requirements"
apt-get install poppler-utils

echo "... and this, optional testing stuff"
pip install coverage

# Create a PostGIS template database
psql -c "CREATE DATABASE template_postgis;" -U postgres
psql -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" -U postgres
createlang plpgsql template_postgis -U postgres
# Loading the PostGIS SQL routines
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql -q
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql -q
# Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"

psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"

createdb -T template_postgis councilmatic

echo "Create the database"
psql -U postgres <<EOF
CREATE USER councilmatic WITH PASSWORD 'councilmatic';
CREATE DATABASE councilmatic WITH TEMPLATE = template_postgis;
GRANT ALL ON DATABASE template_postgis TO councilmatic;
GRANT ALL ON DATABASE councilmatic TO councilmatic;
ALTER USER councilmatic WITH CREATEDB;
EOF
echo "Initialize the project settings"
cp councilmatic/local_settings.py.template councilmatic/local_settings.py
exit #to return to your normal user
-----------------------------------
cp councilmatic/oakland_local_settings.py.template councilmatic/local_settings.py

0 comments on commit 804c70a

Please sign in to comment.