PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

Configurazione di Amazon Elastic Beanstalk con PostGIS

Se desideri utilizzare geodjango con Amazon Elastic Beanstalk, devi creare un AMI dove puoi installare PostGIS e quindi indirizzare la tua applicazione Elastic Beanstalk a quell'AMI durante l'avvio.

Ecco un buon tutorial su come personalizzare un'AMI EBS . C'è anche un tutorial AWS per questo ma ho trovato il primo più facile da capire. Sulla mia AMI personalizzata ho installato geos, gdal, proj4 e postgis da source e postgres usando yum install postgres . Di seguito sono riportati i comandi che ho usato per installare tutte le librerie nell'AMI.

Affinché l'app django trovi le librerie, ho anche impostato una variabile ambientale aggiuntiva nella console AWS EBS. Nella barra dei menu del mio ambiente, sono andato a configurazione --> configurazione software e modificato le Proprietà dell'ambiente aggiungendo la proprietà LD_LIBRARY_PATH imposta come /usr/local/lib/:$LD_LIBRARY_PATH .

Poiché le istanze dell'app Beanstalk non sono previste per eseguire il database da sole, ho anche impostato un Amazon RDS Postgres database ospitato che è un servizio relativamente nuovo, supporta PostGIS.

Se metti tutto insieme, dovresti ottenere un'app GeoDjango molto scalabile!

sudo yum install postgresql postgresql-devel postgresql-server postgresql9-contrib gcc gcc-c++ make libtool curl libxml2 libxml2-devel python-devel

wget http://download.osgeo.org/proj/proj-4.8.0.zip
unzip proj-4.8.0.zip
cd proj-4.8.0
./configure
make
sudo make install
cd ..

wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
tar -xvf geos-3.4.2.tar.bz2
cd geos-3.4.2
./configure
make
sudo make install
cd ..

wget http://download.osgeo.org/gdal/1.10.1/gdal1101.zip
unzip gdal1101.zip
cd gdal-1.10.1
./configure --with-python=yes
make
sudo make install
cd ..

wget http://download.osgeo.org/postgis/source/postgis-2.1.1.tar.gz
tar -xvf postgis-2.1.1.tar.gz
cd postgis-2.1.1
./configure
make
sudo make install