gpt4 book ai didi

postgresql - 在 AWS Beanstalk 或 EC2 实例中使用 GeoDjango 支持设置 Django

转载 作者:行者123 更新时间:2023-11-29 11:53:15 26 4
gpt4 key购买 nike

因此,我曾经使用 Amazon Instance (2013.09) ami-35792c5c 通过 Beanstalk 进行此操作。当时这个 ebextension 脚本放在 .ebextensions/中的 repo 的根目录下时效果很好

00_repo.config

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'

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

01_app.config

packages:
yum:
libtiff-devel: ''
libjpeg-devel: ''
libzip-devel: ''
freetype-devel: ''
postgresql-devel: ''
gdal: ''
gdal-python: ''
geos: ''
proj: ''
libmemcached: ''
libmemcached-devel: ''
cyrus-sasl-devel: ''
zlib-devel: ''

container_commands:
01_collectstatic:
command: 'PYTHONPATH=.:..:../lib cd site/kpmkhv && ./manage.py collectstatic -c --noinput && cd ../..'
leader_only: true
02_syncdb:
command: 'PYTHONPATH=.:..:../lib cd site/kpmkhv && ./manage.py syncdb --noinput && cd ../..'
leader_only: true
03_migrate:
command: 'PYTHONPATH=.:..:../lib cd site/kpmkhv && ./manage.py migrate --noinput && cd ../..'
leader_only: true

option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: site/kpmkhv/wsgi.py
- namespace: aws:elasticbeanstalk:container:python:staticfiles
option_name: /static/
value: site/kpmkhv/static/
- option_name: DJANGO_SETTINGS_MODULE
value: settings_prod

所以现在当我使用同一个实例并启动我的环境时,我收到有关依赖项的错误。

Error: Package: gdal-libs-1.9.2-5.rhel6.x86_64 (pgdg93)
Requires: libpoppler.so.5()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

看起来同一个 repo 现在正在返回更新版本的 poppler,它是 12.x,现在是 22.x,gdal 需要旧版本。

我还在 EC2 实例上对此进行了测试,但遇到了同样的错误。但后来我在 locking an AMI to its original repository version 上从亚马逊看到了这份文件.

因此,当您启动时通过 EC2 控制台将此添加到用户选项可修复 EC2 上的问题:

#cloud-config
repo_releasever: 2014.03

当您的 Beanstalk 代表您启动 EC2 实例时,始终拥有此选项的最佳方式是什么?我阅读了有关 cloud-init 的信息,也许通过 ebextensions 部署的脚本是最好的选择?

感谢任何对此的见解,谢谢。

最佳答案

我对 2017.03 图像的解决方案是:

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: []

关于postgresql - 在 AWS Beanstalk 或 EC2 实例中使用 GeoDjango 支持设置 Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27177327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com