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

前端 未结 5 1989
隐瞒了意图╮
隐瞒了意图╮ 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: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

提交回复
热议问题