在大厅容器上运行Elasticsearch 8

发布于 2025-02-03 17:45:21 字数 576 浏览 3 评论 0原文

我正在使用大厅来构建我的Java包。

为了运行该软件包的集成测试,我需要一个lasticsearch的本地实例。

在ES版本8之前,我所做的只是在Docker Image中安装ES,然后我将用作Concourse Task的Image资源来构建我的Java软件包:

FROM openjdk:11-jdk-slim-stretch
RUN apt-get update && apt-get install -y procps
ADD "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-amd64.deb" /es.deb
RUN dpkg -i es.deb
RUN rm es.deb

以后我会在使用以下方式之前直接启动它: /etc/init.d/elasticsearch start

问题开始升级到版本8时开始。我发现的一些建议建议运行ES作为容器,因此在大厅容器内运行ES容器,对于我的用例来说似乎太复杂了。

如果您的项目中有类似的问题,您是如何解决这些问题的?

I'm using Concourse for building my java package.

In order to run integration tests of that package, I need a local instance of elasticsearch present.

Prior to ES version 8, all I was doing was installing ES in Docker image that I would then use as Concourse task's image resource to build my java package in:

FROM openjdk:11-jdk-slim-stretch
RUN apt-get update && apt-get install -y procps
ADD "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-amd64.deb" /es.deb
RUN dpkg -i es.deb
RUN rm es.deb

Later I would just start it right before building with:
/etc/init.d/elasticsearch start

Problems started when upgrading ES to version 8. That init.d file does not seem to exist anymore. Some of the advices I found suggest running ES as a container, so running ES container inside of the concourse container which seems a bit too complex for my use case.

If you had similar problems in your projects, how did you solve them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坠似风落 2025-02-10 17:45:21

这就是我要做的:

FROM elasticsearch:8.2.2
USER root
RUN apt update && apt install -y sudo
  1. 在您的任务中启动弹性。假设将图像推到docker上的oozie/弹性。那么以下管道作业应该成功:
jobs:
  - name: run-elastic
    plan:
    - task: integtest
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: oozie/elastic
        run:
          path: /bin/bash
          args:
          - -c
          - |
            (sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -Expack.security.enabled=false -E discovery.type=single-node > elastic.log) &
            while ! curl http://localhost:9200; do sleep 10; done

应导致以下任务运行:

”

This is what I would do:

  1. Build your docker image off of an official Elastic docker image, e.g.:
FROM elasticsearch:8.2.2
USER root
RUN apt update && apt install -y sudo
  1. Start Elastic within your task. Suppose the image got pushed to oozie/elastic on docker. Then the following pipeline job should succeed:
jobs:
  - name: run-elastic
    plan:
    - task: integtest
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: oozie/elastic
        run:
          path: /bin/bash
          args:
          - -c
          - |
            (sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -Expack.security.enabled=false -E discovery.type=single-node > elastic.log) &
            while ! curl http://localhost:9200; do sleep 10; done

It should result in the following task run:

pipeline run with elastic

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文