Setting up Django with GeoDjango Support in AWS Beanstalk or EC2 Instance

前端 未结 5 1986
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 01:58

So I have at one point had this going via Beanstalk, using Amazon Instance (2013.09) ami-35792c5c . At the time this ebextension scripts worked great when placed in the root

相关标签:
5条回答
  • 2021-01-07 02:36

    For the 2015.03 image, I had good luck using this value for the pgdg repo:

    pgdg-redhat93-9.3-1: 'http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-ami201503-93-9.3-1.noarch.rpm'
    

    With that, I was able to install gdal without needing to bring in libpoppler, etc., as separate rpms from S3.

    0 讨论(0)
  • 2021-01-07 02:44

    My solution to a 2017.03 image was to:

    commands:
      01_yum_update:
        command: sudo yum -y update
      02_epel_repo:
        command: sudo yum-config-manager -y --enable epel
      03_install_gdal_packages:
        command: sudo yum -y install gdal gdal-devel
    
    files:
      "/etc/httpd/conf.d/wsgihacks.conf":
        mode: "000644"
        owner: root
        group: root
        content: |
          WSGIPassAuthorization On
    
    packages:
      yum:
        git: []
        postgresql95-devel: []
        gettext: []
        libjpeg-turbo-devel: []
        libffi-devel: []
    
    0 讨论(0)
  • 2021-01-07 02:46

    I was finally able to get this to work on the 2015.03 image and PostgreSQL 9.4 with a suggestion I found on the PostgreSQL yum mailing list (http://www.postgresql.org/message-id/1429688221.3808.17.camel@gunduz.org)

    Specifically, I installed libpoppler straight from a CentOS 6 mirror. I also used Mike Edward's suggestion of the Amazon Linux specific pgdg rpm. In whole, it ended up being a rather simple solution, which looked like:

    yum -y install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-ami201503-94-9.4-1.noarch.rpm
    yum --enablerepo=epel -y install postgis2_94 http://centos-distro.cavecreek.net/centos/6.6/os/x86_64/Packages/poppler-0.12.4-3.el6_0.1.x86_64.rpm
    
    0 讨论(0)
  • 2021-01-07 02:51

    I had a similar issue on the 2014.09 stack, ami id ami-246ed34c and got around the problem like this:

    1. I found and downloaded the required dependencies online here and here. These are the versions that work:

      • lib64jpeg8-8b-5.1.mga1.x86_64.rpm
      • lib64poppler5-0.12.4-2.1mdv2010.1.x86_64.rpm
    2. Zipped both .rpm files

    3. Uploaded the .zip files to S3 and make sure the server can access them.
    4. Added to ebextensions/00_sources.config the following code: /etc/mylibs/jpeg8/ : https://s3.amazonaws.com/path-to-first-rpm-file.rpm.zip /etc/mylibs/poppler/ : https://s3.amazonaws.com/path-to-second-rpm-file.rpm.zip
    5. Installed via yum in ebextensions/01_packages.config. I had to use these commands to be able to install them.

      commands: 
        jpeg8_repo:
          command: yum -y install /etc/mylibs/jpeg8/lib64jpeg8-8b-5.1.mga1.x86_64.rpm
          ignoreErrors: true
        poppler_repo:
          command: yum -y install /etc/mylibs/poppler/lib64poppler5-0.12.4-2.1mdv2010.1.x86_64.rpm 
          ignoreErrors: true
      
    0 讨论(0)
  • 2021-01-07 02:56

    So I now have a working ebextensions workflow on 2013.09 stack ami ami-35792c5c. For the 2014.09 stack see the other solution. The solution below works with postgis by installing the needed gdal component, 00_repo.config needs to look like this:

    files:
      "/etc/yum.repos.d/pgdg-93-redhat.repo":
        mode: "000644"
        owner: root
        group: root
        content: |
          [pgdg93]
          name=PostgreSQL 9.3 $releasever - $basearch
          baseurl=http://yum.postgresql.org/9.3/redhat/rhel-6-$basearch
          enabled=1
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-93
    
          [pgdg93-source]
          name=PostgreSQL 9.3 $releasever - $basearch - Source
          failovermethod=priority
          baseurl=http://yum.postgresql.org/srpms/9.3/redhat/rhel-6-$basearch
          enabled=0
          gpgcheck=1
          gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-93
    
    commands:
      epel_repo:
        command: yum-config-manager -y --enable epel
      remi_repo:
        command: yum-config-manager -y --enable remi
    
    packages:
      rpm:
        pgdg-redhat93-9.3-1: 'http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm'
        remi: 'http://rpms.famillecollet.com/enterprise/remi-release-6.rpm'
        qt4-devel: 'http://mirror.centos.org/centos/6/os/x86_64/Packages/qt-4.6.2-28.el6_5.x86_64.rpm'
    

    The 2nd extension stays in tact. This works on Amazon Instance (2013.09) ami-35792c5c, I haven't tried the newer containers yet with it.

    Alternative 1:

    If you want less dependencies on repos / rpms from the ebextensions file, you could upload all required rpms to S3 and update the ebextensions 'packages' to point to your s3 rpms. Setup your S3 bucket for public get access using CORS headers.

    Alternative 2:

    Create a custom AMI where you compile all dependencies from source. This way there will be no rpm conflicts and you don't have to temper with the default repos supplied by the AMI you are customizing. See this answer: Configuring Amazon Elastic Beanstalk with PostGIS

    Also check out the tool I made:

    https://github.com/radlws/django-awseb-tasks

    0 讨论(0)
提交回复
热议问题