在AWS Elastic Beanstalk上使用Django-Oscar自动设置Apache Solr [英] Automatically setup Apache Solr with Django - Oscar on AWS Elastic Beanstalk

查看:107
本文介绍了在AWS Elastic Beanstalk上使用Django-Oscar自动设置Apache Solr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要确保 Apache Solr 已与我的django-oscar应用程序一起安装一直将这些说明与.ebextensions配置文件一起自动使用安装Solr并重建索引.

I need to ensure that Apache Solr is installed with my django-oscar application, and have been using these instructions with an .ebextensions config file to automatically install Solr and rebuild the index.

这是.ebextensions/03_solr.config

Here is the .ebextensions/03_solr.config

container_commands:
  01_install_solr:
    command: "wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz &&
    tar xzf solr-4.7.2.tgz &&
    cd solr-4.7.2.example/solr/collection1 && 
    mv conf conf.original && 
    ln -s /opt/python/current/app/deploy/solr conf &&
    cd ../.. && 
    java -jar start.jar"
  02_rebuild_index:
    command: "python manage.py rebuild_index --noinput"

我需要在此处添加/更新什么才能使solr自动安装在

What do I need to add/update here to get the solr to install automatically on

eb deploy

?

更新:将bash更改为单个命令.看起来该过程已完成,但是在执行java -jar start.jar时,.ebextensions/03_solr.config任务将执行

Update: changed the bash to a single command. It looks like the process is completing, but on executing java -jar start.jar, the .ebextensions/03_solr.config task executes the

org.eclipse.jetty.server.AbstractConnector - Started SocketConnector@0.0.0.0:8983

此过程实际上应该是一个后台过程,因为当前它正在导致部署挂起,并且超时而没有部署新的应用程序.根据此SO帖子,要在部署新的应用程序版本后开始延迟的作业,需要进行一些工作.有什么建议?要澄清:

This process should really be a background process, as currently it is causing the deploy to hang, and timeout without deploying the new application. According to this SO post, to start a delayed job AFTER the new application version is deployed takes some work. Any suggestions? To clarify:

运行

java -jar start.jar

命令是EB的非阻塞后台进程吗?

command as a non-blocking, background process for EB?

推荐答案

因此,答案最终就是需要使用部署后挂钩,如所述.终止并重新启动EB EC2实例,然后重新部署即可解决该问题.

So the answer did end up being the need to use the post deployment hooks, as described. Terminating and restarting the EB EC2 instance and a fresh deploy solved the issue.

container_commands:
  01_install_solr:
    command: "cd /opt/python/current/app &&
    wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz &&
    tar xzf solr-4.7.2.tgz &&
    cd solr-4.7.2/example/solr/collection1/ &&
    cp -r conf conf.original &&
    ln -s /opt/python/current/app/deploy/solr conf"
    leader_only: true
  02_rebuild_index:
    command: "python manage.py rebuild_index --noinput"
    leader_only: true
commands:
  create_post_dir:
    command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
    ignoreErrors: false

  files:
    "/opt/elasticbeanstalk/hooks/appdeploy/post/start_solr.sh":
      mode: "000755"
      owner: root
      group: root
      content: |
        #!/usr/bin/env bash
        nohup java -jar /opt/python/current/app/solr-4.7.2/example/start.jar queue:work --daemon >/dev/null 2>&1 &

这篇关于在AWS Elastic Beanstalk上使用Django-Oscar自动设置Apache Solr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆