Reactive-Resume icon indicating copy to clipboard operation
Reactive-Resume copied to clipboard

[Bug] ECONNREFUSED connecting to minio

Open danielkinahan opened this issue 1 year ago • 10 comments

Is there an existing issue for this?

  • [X] Yes, I have searched the existing issues and none of them match my problem.

Product Variant

Self-Hosted

Current Behavior

App can't connect to minio storage. I have changed the ports.

/app/dist/apps/server/main.js:570

            throw new common_1.InternalServerErrorException(error);
...

    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '172.28.0.3',
    port: 3002
  },
  status: 500,
  options: {}
}
Node.js v20.10.0
 ELIFECYCLE  Command failed with exit code 1.

Expected Behavior

Connection not refused. 200 return codes.

Steps To Reproduce

  1. Copy and modify the simple.yml docker compose file.
version: "3.8"

services:
  # Database (Postgres)
  postgres:
    image: postgres:15-alpine
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Storage (for image uploads)
  minio:
    image: minio/minio
    restart: unless-stopped
    command: server /data
    ports:
      - 3002:9000
    volumes:
      - minio_data:/data
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin

  # Chrome Browser (for printing and previews)
  chrome:
    image: browserless/chrome:1.61.0-puppeteer-21.4.1
    restart: unless-stopped
    environment:
      TOKEN: chrome_token
      EXIT_ON_HEALTH_FAILURE: "true"
      PRE_REQUEST_HEALTH_CHECK: "true"

  # Redis (for cache & server session management)
  redis:
    image: redis:alpine
    restart: unless-stopped
    command: redis-server --requirepass password

  app:
    image: amruthpillai/reactive-resume:latest
    restart: unless-stopped
    ports:
      - 3001:3000
    depends_on:
      - postgres
      - minio
      - redis
      - chrome
    environment:
      # -- Environment Variables --
      PORT: 3001
      NODE_ENV: production

      # -- URLs --
      PUBLIC_URL: http://localhost:3001
      STORAGE_URL: http://localhost:3002

      # -- Printer (Chrome) --
      CHROME_TOKEN: chrome_token
      CHROME_URL: ws://chrome:3001

      # -- Database (Postgres) --
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres

      # -- Auth --
      ACCESS_TOKEN_SECRET: access_token_secret
      REFRESH_TOKEN_SECRET: refresh_token_secret

      # -- Emails --
      MAIL_FROM: noreply@localhost
      # SMTP_URL: smtp://user:pass@smtp:587 # Optional

      # -- Storage (Minio) --
      STORAGE_ENDPOINT: minio
      STORAGE_PORT: 3002
      STORAGE_REGION: us-east-1 # Optional
      STORAGE_BUCKET: default
      STORAGE_ACCESS_KEY: minioadmin
      STORAGE_SECRET_KEY: minioadmin
      STORAGE_USE_SSL: "false"

      # -- Cache (Redis) --
      REDIS_URL: redis://default:password@redis:6379

volumes:
  minio_data:
  postgres_data:
  1. docker-compose up -d

What browsers are you seeing the problem on?

No response

What template are you using?

None

Anything else?

I'm sure there is something I'm doing wrong here but couldn't find any documentation about how these env vars are used.

danielkinahan avatar Dec 22 '23 18:12 danielkinahan

Try to change STORAGE_URL to http://localhost:3002/default/

Lyxon1337 avatar Dec 31 '23 20:12 Lyxon1337

Try to change STORAGE_URL to http://localhost:3002/default/

This gives the same error unfortunately. Is there anything else I could try?

danielkinahan avatar Jan 04 '24 20:01 danielkinahan

I'm also getting this error, with a Minio instance that is not part of the reactive-resume compose manifest. The Minio trace shows a 400 Bad Request on the s3.HeadBucket action.

StarkZarn avatar Jan 12 '24 19:01 StarkZarn

I'm also getting this error, with a Minio instance that is not part of the reactive-resume compose manifest. The Minio trace shows a 400 Bad Request on the s3.HeadBucket action.

The policy for my bucket is image

StarkZarn avatar Jan 12 '24 20:01 StarkZarn

Hey I'd love to set this up but I am still running into 500 errors. Is there anything else I can try?

danielkinahan avatar Jan 20 '24 19:01 danielkinahan

Same thing here. I haven't found any solution yet. I'd even be fine without minio as backing storage, just filesystem mounts or something else like that if there's a development/debug option like that.

StarkZarn avatar Jan 24 '24 15:01 StarkZarn

I'm also having the same issue.

punithrudrappa avatar Jan 25 '24 01:01 punithrudrappa

I'm also having the same issue.

I found a solution to this. This is happening because of changing the port for minio. minio is having some issue taking the port number from the port specified in the docker compose. So I had to change the command of minio from "server /data" to " server /data ----address :"9001" " with 9001 being the new port. So the new simple.yml looks like

version: "3.8"

# In this Docker Compose example, it assumes that you maintain a reverse proxy externally (or chose not to).
# The only two exposed ports here are from minio (:9000) and the app itself (:3000).
# If these ports are changed, ensure that the env vars passed to the app are also changed accordingly.

services:
  # Database (Postgres)
  postgres:
    image: postgres:15-alpine
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Storage (for image uploads)
  minio:
    image: minio/minio
    restart: unless-stopped
    command: server /data --address :"9001"
    ports:
      - 9001:9001
    volumes:
      - minio_data:/data
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin

  # Chrome Browser (for printing and previews)
  chrome:
    image: browserless/chrome:1.61.0-puppeteer-21.4.1
    restart: unless-stopped
    environment:
      TOKEN: chrome_token
      EXIT_ON_HEALTH_FAILURE: true
      PRE_REQUEST_HEALTH_CHECK: true

  # Redis (for cache & server session management)
  redis:
    image: redis:alpine
    restart: unless-stopped
    command: redis-server --requirepass password

  app:
    image: amruthpillai/reactive-resume:latest
    restart: unless-stopped
    ports:
      - 3000:3000
    depends_on:
      - postgres
      - minio
      - redis
      - chrome
    environment:
      # -- Environment Variables --
      PORT: 3000
      NODE_ENV: production

      # -- URLs --
      PUBLIC_URL: http://localhost:3000
      STORAGE_URL: http://localhost:9001

      # -- Printer (Chrome) --
      CHROME_TOKEN: chrome_token
      CHROME_URL: ws://chrome:3000

      # -- Database (Postgres) --
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres

      # -- Auth --
      ACCESS_TOKEN_SECRET: access_token_secret
      REFRESH_TOKEN_SECRET: refresh_token_secret

      

      # -- Storage (Minio) --
      STORAGE_ENDPOINT: minio
      STORAGE_PORT: 9001
      STORAGE_BUCKET: default
      STORAGE_ACCESS_KEY: minioadmin
      STORAGE_SECRET_KEY: minioadmin
      STORAGE_USE_SSL: false

      # -- Cache (Redis) --
      REDIS_URL: redis://default:password@redis:6379



volumes:
  minio_data:
  postgres_data:

punithrudrappa avatar Jan 25 '24 02:01 punithrudrappa

I'm also having the same issue.

I found a solution to this. This is happening because of changing the port for minio. minio is having some issue taking the port number from the port specified in the docker compose. So I had to change the command of minio from "server /data" to " server /data ----address :"9001" " with 9001 being the new port. So the new simple.yml looks like

I don't think that's the case here. I'm getting a response from Minio, and Minio is logging the network connection. There is no port mismatch. I could see getting a 500 series response if the frontend couldn't talk to Minio though, so I don't doubt that you've solved your own problem here. The original issue still stands as far as I can tell, however.

StarkZarn avatar Jan 30 '24 20:01 StarkZarn

While it doesn't fill the same need, an alternative for anyone looking is to build a static site with hugo that generates your resume. See https://github.com/StarkZarn/hugo-orbit-theme for an example. The benefit here is that it actually works.

StarkZarn avatar Feb 12 '24 22:02 StarkZarn

@StarkZarn I had the same issue as you and many others in here. The root "issue", or is not an issue per se, but docker cannot resolve "localhost" ie. 127.0.0.1 loopback address internally. You need to use the service name for each container.

I spent some time to replace all this hardcoded ports etc in each *.yml with environment variables instead so I can replace things in one place. Just a tip.

JohnKesko avatar Mar 21 '24 19:03 JohnKesko

I'm also having the same issue.

I found a solution to this. This is happening because of changing the port for minio. minio is having some issue taking the port number from the port specified in the docker compose. So I had to change the command of minio from "server /data" to " server /data ----address :"9001" " with 9001 being the new port. So the new simple.yml looks like

version: "3.8"

# In this Docker Compose example, it assumes that you maintain a reverse proxy externally (or chose not to).
# The only two exposed ports here are from minio (:9000) and the app itself (:3000).
# If these ports are changed, ensure that the env vars passed to the app are also changed accordingly.

services:
  # Database (Postgres)
  postgres:
    image: postgres:15-alpine
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Storage (for image uploads)
  minio:
    image: minio/minio
    restart: unless-stopped
    command: server /data --address :"9001"
    ports:
      - 9001:9001
    volumes:
      - minio_data:/data
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin

  # Chrome Browser (for printing and previews)
  chrome:
    image: browserless/chrome:1.61.0-puppeteer-21.4.1
    restart: unless-stopped
    environment:
      TOKEN: chrome_token
      EXIT_ON_HEALTH_FAILURE: true
      PRE_REQUEST_HEALTH_CHECK: true

  # Redis (for cache & server session management)
  redis:
    image: redis:alpine
    restart: unless-stopped
    command: redis-server --requirepass password

  app:
    image: amruthpillai/reactive-resume:latest
    restart: unless-stopped
    ports:
      - 3000:3000
    depends_on:
      - postgres
      - minio
      - redis
      - chrome
    environment:
      # -- Environment Variables --
      PORT: 3000
      NODE_ENV: production

      # -- URLs --
      PUBLIC_URL: http://localhost:3000
      STORAGE_URL: http://localhost:9001

      # -- Printer (Chrome) --
      CHROME_TOKEN: chrome_token
      CHROME_URL: ws://chrome:3000

      # -- Database (Postgres) --
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres

      # -- Auth --
      ACCESS_TOKEN_SECRET: access_token_secret
      REFRESH_TOKEN_SECRET: refresh_token_secret

      

      # -- Storage (Minio) --
      STORAGE_ENDPOINT: minio
      STORAGE_PORT: 9001
      STORAGE_BUCKET: default
      STORAGE_ACCESS_KEY: minioadmin
      STORAGE_SECRET_KEY: minioadmin
      STORAGE_USE_SSL: false

      # -- Cache (Redis) --
      REDIS_URL: redis://default:password@redis:6379



volumes:
  minio_data:
  postgres_data:

This fixed it for me. Thank you!

danielkinahan avatar Apr 22 '24 21:04 danielkinahan