Django 如何在aws elasticbean上安装redis和芹菜

Django 如何在aws elasticbean上安装redis和芹菜,django,amazon-web-services,redis,celery,amazon-elastic-beanstalk,Django,Amazon Web Services,Redis,Celery,Amazon Elastic Beanstalk,我正试图在aws elasticbean上为我的django应用程序安装redis和芹菜。以下是文件夹中的配置文件。ebextensions/ option_settings: "aws:elasticbeanstalk:application:environment": DJANGO_SETTINGS_MODULE: "lawCalender.settings" PYTHONPATH: "/opt/python/current/app/lawCalender:$PYTHO

我正试图在aws elasticbean上为我的django应用程序安装redis和芹菜。以下是文件夹中的配置文件。ebextensions/

 option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "lawCalender.settings"
    PYTHONPATH: "/opt/python/current/app/lawCalender:$PYTHONPATH"
  "aws:elasticbeanstalk:container:python":
    WSGIPath: "lawCalender/wsgi.py"


Resources:
  MyCacheSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      GroupDescription: "Lock cache down to webserver access only"
      SecurityGroupIngress :
        - IpProtocol : "tcp"
          FromPort :
            Fn::GetOptionSetting:
              OptionName : "CachePort"
              DefaultValue: "6379"
          ToPort :
            Fn::GetOptionSetting:
              OptionName : "CachePort"
              DefaultValue: "6379"
          SourceSecurityGroupName:
            Ref: "AWSEBSecurityGroup"
  MyElastiCache:
    Type: "AWS::ElastiCache::CacheCluster"
    Properties:
      CacheNodeType:
        Fn::GetOptionSetting:
          OptionName : "CacheNodeType"
          DefaultValue : "cache.t1.micro"
      NumCacheNodes:
        Fn::GetOptionSetting:
          OptionName : "NumCacheNodes"
          DefaultValue : "1"
      Engine:
        Fn::GetOptionSetting:
          OptionName : "Engine"
          DefaultValue : "redis"
      VpcSecurityGroupIds:
        -
          Fn::GetAtt:
            - MyCacheSecurityGroup
            - GroupId

Outputs:
  ElastiCache:
    Description : "ID of ElastiCache Cache Cluster with Redis Engine"
    Value :
      Ref : "MyElastiCache"

files:
    "/opt/python/log/django.log":
        mode: "000666"
        owner: ec2-user
        group: ec2-user
        content: |
          # Log file  
          Test Data             
    "/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh":
        mode: "000755"
        owner: root
        group: root
        content: |
          #!/usr/bin/env bash
          # Get django environment variables
          celeryenv=`cat /opt/python/current/env | tr '\n' ',' | sed 's/%/%%/g' | sed 's/export //g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`
            celeryenv=${celeryenv%?}

          # Create celery configuraiton script
          celeryconf="[program:celeryd]
          ; Set full path to celery program if using virtualenv
          command=/opt/python/run/venv/bin/celery worker -A lawCalender --loglevel=INFO

          directory=/opt/python/current/app
          user=nobody
          numprocs=1
          stdout_logfile=/var/log/celery-worker.log
          stderr_logfile=/var/log/celery-worker.log
          autostart=true
          autorestart=true
          startsecs=10

          ; Need to wait for currently executing tasks to finish at shutdown.
          ; Increase this if you have very long running tasks.
          stopwaitsecs = 600

          ; When resorting to send SIGKILL to the program to terminate it
          ; send SIGKILL to its whole process group instead,
          ; taking care of its children as well.
          killasgroup=true

          ; if rabbitmq is supervised, set its priority higher
          ; so it starts first
          priority=998

          environment=$celeryenv"

          # Create celerybeat configuraiton script
          celerybeatconf="[program:celerybeat]
          ; Set full path to celery program if using virtualenv
          command=/opt/python/run/venv/bin/celery beat -A lawCalender --loglevel=INFO

          ; remove the -A avtotest argument if you are not using an app instance

          directory=/opt/python/current/app
          user=nobody
          numprocs=1
          stdout_logfile=/var/log/celerybeat.log
          stderr_logfile=/var/log/celerybeat.log
          autostart=true
          autorestart=true
          startsecs=10

          ; Need to wait for currently executing tasks to finish at shutdown.
          ; Increase this if you have very long running tasks.
          stopwaitsecs = 600

          ; When resorting to send SIGKILL to the program to terminate it
          ; send SIGKILL to its whole process group instead,
          ; taking care of its children as well.
          killasgroup=true

          ; if rabbitmq is supervised, set its priority higher
          ; so it starts first
          priority=999

          environment=$celeryenv"

          # Create the celery and beat supervisord conf script
          echo "$celeryconf" | tee /opt/python/etc/celery.conf
          echo "$celerybeatconf" | tee /opt/python/etc/celerybeat.conf

          # Add configuration script to supervisord conf (if not there already)
          if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
            then
              echo "[include]" | tee -a /opt/python/etc/supervisord.conf
              echo "files: celery.conf celerybeat.conf" | tee -a /opt/python/etc/supervisord.conf

          fi

          # Reread the supervisord config
          supervisorctl -c /opt/python/etc/supervisord.conf reread

          # Update supervisord in cache without restarting all services
          supervisorctl -c /opt/python/etc/supervisord.conf update

          # Start/Restart celeryd through supervisord
          supervisorctl -c /opt/python/etc/supervisord.conf restart celeryd
出于某种原因,这不起作用。我可以看到所有文件都已创建并位于不同的文件夹中,但我看不到服务器上安装或运行的redis。
我做错了什么?如果您需要任何其他信息,请发表评论。(我对aws和beanstalk非常陌生。)

Elastic beanstalk与web服务器(django)配合得很好,很难配置其他任何东西(例如redis)。我可以建议一种不同的方法吗?用作redis主机和芹菜经纪人。

一般来说,您可以避开内部设置,将部署简化到极致,并让aws完成所有工作。这就是它的工作原理。

Elastic Beanstalk与web服务器(django)配合得很好,很难配置其他任何东西(如redis)。我可以建议一种不同的方法吗?用作redis主机和芹菜经纪人。

一般来说,您可以避开内部设置,将部署简化到极致,并让aws完成所有工作。这就是它的工作原理。

sqs是一种排队服务。我可以和芹菜一起吃。但它无法取代它。我需要一些东西来处理后台任务。sqs是一种排队服务。我可以和芹菜一起吃。但它无法取代它。我需要一些东西来处理背景任务。