阅读背景:

在AWS Elastic Beanstalk上使用Django - Oscar自动设置Apache 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.

我需要确保Apache Solr与我的django-oscar应用程序一起安装,并且已经使用这些指令和.ebextensions配置文件来自动安装Solr并重建索引。

Here is the .ebextensions/03_solr.config

这是.ebextensions / 03_solr.config

container_commands:
  01_install_solr:
    command: "wget https://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"

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

我需要在此处添加/更新以使solr自动安装

eb deploy

?

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

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

org.eclipse.jetty.server.AbstractConnector - Started [email protected]:8983

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:

这个过程应该是一个后台进程,因为它正在导致部署挂起,并在不部署新应用程序的情况下超时。根据这篇SO帖子,在部署新的应用程序版本之后开始延迟工作需要一些工作。有什么建议么?澄清:

Run the

跑过

java -jar start.jar

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

命令作为EB的非阻塞后台进程?

2 个解决方案

#1


3  

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.

因此,答案确实最终需要使用后部署钩子,如上所述。终止并重新启动EB EC2实例和全新部署解决了该问题。

container_commands:
  01_install_solr:
    command: "cd /opt/python/current/app &&
    wget https://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 &

#2


2  

Note that each of these steps is executed in the default folder, so issuing a cd command is ineffective. You should run all those steps in a single command rather than multiple ones.
step 04 will fail as it starts in the default directory rather than the solr one

请注意,每个步骤都在默认文件夹中执行,因此发出cd命令无效。您应该在一个命令而不是多个命令中运行所有这些步骤。步骤04将失败,因为它在默认目录而不是solr目录中启动


分享到: