Configuring Amazon Elastic Beanstalk with PostGIS

前端 未结 6 944
自闭症患者
自闭症患者 2021-01-05 09:47

Does anyone have any experience setting up Amazon Elastic Beanstalk with PostGIS (so that I can take advantage of Geodjango)?

There are a number of features that th

6条回答
  •  误落风尘
    2021-01-05 10:33

    If you want to use geodjango with Amazon Elastic Beanstalk you need to create a custom AMI where you can install PostGIS and then point your Elastic Beanstalk Application to that AMI when spinning up.

    Here is a good tutorial on how to customize an EBS AMI. There is also an AWS tutorial for that but I found the first one easier to understand. On my custom AMI I installed geos, gdal, proj4 and postgis from source, and postgres using yum install postgres. Below are the commands i used to install all libraries into the AMI.

    For the django app to find the libraries, I also set an additional environmental variable in the AWS EBS Console. In the menubar of my environment, I went to configuration --> software configuration and edited the Environment Properties by adding the property LD_LIBRARY_PATH set as /usr/local/lib/:$LD_LIBRARY_PATH.

    Since the beanstalk app instances are not forseen to run the database themselves, I also set up a Amazon RDS Postgres hosted database which is a relatively new service, it supports PostGIS.

    If you put that all together, you should get a very scaleable GeoDjango app!

    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
    

提交回复
热议问题