Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Connection Refused #7

Open
chrisaddams opened this issue Jul 29, 2022 · 0 comments
Open

Connection Refused #7

chrisaddams opened this issue Jul 29, 2022 · 0 comments

Comments

@chrisaddams
Copy link

chrisaddams commented Jul 29, 2022

It seems that no matter what I do, I can't get elastic search to accept a connection from strapi with this plugin.

This is the error I'm receiving. This is with a basic install of strapi, 4.3.3 and elastic search 7.13.4. Running with docker compose.

strapi             | [2022-08-12 23:11:38.409] error: connect ECONNREFUSED 127.0.0.1:9300
strapi             | ConnectionError: connect ECONNREFUSED 127.0.0.1:9300
strapi             |     at onResponse (/opt/app/src/plugins/elastic/node_modules/@elastic/elasticsearch/lib/Transport.js:220:13)
strapi             |     at ClientRequest.<anonymous> (/opt/app/src/plugins/elastic/node_modules/@elastic/elasticsearch/lib/Connection.js:113:9)
strapi             |     at ClientRequest.emit (node:events:539:35)
strapi             |     at ClientRequest.emit (node:domain:475:12)
strapi             |     at Socket.socketErrorListener (node:_http_client:454:9)
strapi             |     at Socket.emit (node:events:527:28)
strapi             |     at Socket.emit (node:domain:475:12)
strapi             |     at emitErrorNT (node:internal/streams/destroy:157:8)
strapi             |     at emitErrorCloseNT (node:internal/streams/destroy:122:3)
strapi             |     at processTicksAndRejections (node:internal/process/task_queues:83:21)
strapi             | [2022-08-12 23:11:49.612] http: GET /admin/Admin_pluginsPage.6c63d871.chunk.js (6 ms) 200
strapi             | [2022-08-12 23:11:49.747] http: GET /admin/plugins (116 ms) 200
strapi             | [2022-08-12 23:11:53.388] http: GET /admin/8446.dd500eb7.chunk.js (8 ms) 200
strapi             | [2022-08-12 23:11:53.390] http: GET /admin/Admin_marketplace.2b2691b5.chunk.js (4 ms) 200
strapi             | [2022-08-12 23:11:53.814] http: GET /admin/90f49a385afb000fb1d4.svg (3 ms) 200

Here's the compose file.

version: "3"
services:
  strapi:
    container_name: strapi
    build: .
    # image: mystrapi:latest
    restart: unless-stopped
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: strapiDB
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PORT: ${DATABASE_PORT}
      JWT_SECRET: ${JWT_SECRET}
      ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      NODE_ENV: ${NODE_ENV}
    volumes:
      - ./config:/opt/app/config
      - ./src:/opt/app/src
      - ./package.json:/opt/package.json
      - ./yarn.lock:/opt/yarn.lock
      - ./.env:/opt/app/.env
    ports:
      - "1338:1338"
    networks:
      - strapi
    depends_on:
      - strapiDB

  strapiDB:
    image: postgres:12.0-alpine
    container_name: strapiDB
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - strapi-data:/var/lib/postgresql/data/ #using a volume
      #- ./data:/var/lib/postgresql/data/ # if you want to use a bind folder
    ports:
      - "5432:5432"
    networks:
      - strapi

  elasticsearch:
    image: elasticsearch:$ELASTIC_VERSION
    container_name: elasticsearch
    env_file: .env
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - discovery.type=single-node
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD
      - xpack.security.enabled=$ELASTIC_SECURITY
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    ports:
      - "9300:9200"
    networks:
      - strapi

  kibana:
    image: docker.elastic.co/kibana/kibana:$ELASTIC_VERSION
    environment:
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=$ELASTIC_PASSWORD
    ports: ["5602:5601"]
    networks: ["strapi"]
    links: ["elasticsearch"]
    depends_on: ["elasticsearch"]

volumes:
  strapi-data:
  elasticsearch-data:
    driver: local

networks:
  strapi:
    name: Strapi
    driver: bridge

Anyone got any ideas?

@chrisaddams chrisaddams changed the title warn: There is an error to get mapping of articles index from Elasticsearch Connection Refused Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant