Permalink
Browse files

Added GeoDjango initialization scripts

  • Loading branch information...
1 parent 3e3026c commit 510e2e828b45d9bd2e315535776854258bffda1b @tlpinney committed Feb 27, 2012
Showing with 141 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +13 −0 README
  3. +20 −0 manifests/create_template_postgis-debian.sh
  4. +106 −0 manifests/geodjango.pp
View
@@ -0,0 +1,2 @@
+extra/oab-java6.sh
+extra/oab-java6.sh.log
View
13 README
@@ -50,6 +50,19 @@ http://127.0.0.1:9080
# there is a bug where the apache2 server will need to be restarted manually
# if the vm is installe from scratch...
+# GeoDjango
+# Does not automatically install
+# To install (do this inside the vm)
+sudo puppet apply /vagrant/manifests/geodjango.pp
+# after this is done, do
+cd
+source virtualenvs/geodjango/bin/activate
+cd demo
+python manage.py runserver 0.0.0.0:9081
+
+
+
+
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Modified from
+# https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-debian.sh
+# had to add -T template0 because of a UTF8 problem...
+
+
+# For Ubuntu 10.10 (with PostGIS 1.5)
+POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib/postgis-1.5
+POSTGIS_SQL=postgis.sql
+
+
+createdb -E UTF8 template_postgis -T template0 && \
+createlang -d template_postgis plpgsql && \
+psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" && \
+psql -d template_postgis -f $POSTGIS_SQL_PATH/$POSTGIS_SQL && \
+psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql && \
+psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" && \
+psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
+psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
View
@@ -0,0 +1,106 @@
+
+
+package { "python-pip":
+ ensure => installed,
+}
+
+package { "python-virtualenv":
+ ensure => installed,
+}
+
+package { "postgis":
+ ensure => installed,
+}
+
+package { "ipython":
+ ensure => installed,
+}
+
+
+package { "libgeos-3.2.0":
+ ensure => installed,
+}
+
+package { "gdal-bin":
+ ensure => installed,
+}
+
+package { "proj":
+ ensure => installed,
+}
+
+package { "postgresql-8.4-postgis":
+ ensure => installed,
+}
+
+
+
+
+
+exec { "geodjango_virtualenv":
+
+ cwd => "/home/vagrant",
+ user => "vagrant",
+ command => "/usr/bin/virtualenv virtualenvs/geodjango",
+ creates => "/home/vagrant/virtualenvs/geodjango",
+ require => [Package["python-virtualenv"], Package["python-pip"], Package["ipython"]],
+}
+
+
+exec { "django_install":
+ cwd => "/home/vagrant",
+ user => "vagrant",
+ path => ["/home/vagrant/virtualenvs/geodjango/bin"],
+ environment => ["VIRTUAL_ENV=/home/vagrant/virtualenvs/geodjango"],
+ command => 'pip install django && /bin/mkdir /home/vagrant/django_ilogs && /usr/bin/touch /home/vagrant/django_ilogs/django.log',
+ creates => "/home/vagrant/django_ilogs/django.log",
+ require => [Exec["geodjango_virtualenv"]],
+}
+
+
+exec { "setup_postgis":
+ cwd => "/vagrant/manifests",
+ user => "postgres",
+ command => "/bin/sh ./create_template_postgis-debian.sh && /usr/bin/touch /var/lib/postgresql/postgis_setup.log",
+ creates => "/var/lib/postgresql/postgis_setup.log",
+ require => [Package["postgresql-8.4-postgis"], Package["proj"], Package["libgeos-3.2.0"] ],
+}
+
+# in the future create a specific user for a django application
+# need to somehow check if this already exists (will exist from the rails port install)
+#exec { "createuser_vagrant":
+# cwd => "/vagrant/manifest",
+# user => "postgres",
+# command => "/bin/sh ./create_template_postgis-debian.sh && /usr/bin/touch /var/lib/postgresql/postgis_setup.log",
+# creates => "/var/lib/postgresql/postgis_setup.log",
+# require => [Package["postgresql-8.4-postgis"], Package["proj"], Package["libgeos-3.2.0"] ],
+#}
+
+
+# create the demo django app
+exec { "demo_install":
+ cwd => "/home/vagrant",
+ user => "vagrant",
+ path => ["/home/vagrant/virtualenvs/geodjango/bin"],
+ environment => ["VIRTUAL_ENV=/home/vagrant/virtualenvs/geodjango"],
+ command => 'django-admin.py startproject demo && /usr/bin/touch /home/vagrant/django_ilogs/demo.log',
+ creates => "/home/vagrant/django_ilogs/demo.log",
+ require => [Exec["setup_postgis"]],
+}
+
+# create an osm django app
+exec { "demo_osm_install":
+ cwd => "/home/vagrant/demo",
+ user => "vagrant",
+ path => ["/home/vagrant/virtualenvs/geodjango/bin"],
+ environment => ["VIRTUAL_ENV=/home/vagrant/virtualenvs/geodjango"],
+ command => 'python manage.py startapp osm && /usr/bin/touch /home/vagrant/django_ilogs/demo_osm.log',
+ creates => "/home/vagrant/django_ilogs/demo_osm.log",
+ require => [Exec["demo_install"]],
+}
+
+
+
+# cd
+# mkdir data
+# cd data

0 comments on commit 510e2e8

Please sign in to comment.