nextcloud-exporter icon indicating copy to clipboard operation
nextcloud-exporter copied to clipboard

[BUG] Error after set env NEXTCLOUD_LISTEN_ADDRESS in docker

Open mojerro opened this issue 2 years ago • 4 comments

I'm using version 0.5.1.

Here are the errors when I set NEXTCLOUD_LISTEN_ADDRESS=":9205"

level=info msg="nextcloud-exporter 0.5.1-8-g1025af7"
level=info msg="Nextcloud server: \"http://nextcloud:80\" Authentication using token."
level=info msg="Listen on \":9205\"..."
level=fatal msg="listen tcp: address tcp/9205\": unknown port"
level=info msg="nextcloud-exporter 0.5.1-8-g1025af7"
level=info msg="Nextcloud server: \"http://nextcloud:80\" Authentication using token."
level=info msg="Listen on \":9205\"..."
level=fatal msg="listen tcp: address tcp/9205\": unknown port"

My dockerfile contents:

nextcloud-exporter:
    image: xperimental/nextcloud-exporter
    restart: unless-stopped
    ports:
      - 19205:9205
    environment:
      - TZ=Asia/Shanghai
      - NEXTCLOUD_SERVER="http://nextcloud:80"
      - NEXTCLOUD_AUTH_TOKEN=${NEXTCLOUD_EXPORTER_TOKEN}
      - NEXTCLOUD_LISTEN_ADDRESS=":9205"

if I comment out this line of code like # - NEXTCLOUD_LISTEN_ADDRESS=":9205", everything goes well.

mojerro avatar Sep 26 '22 14:09 mojerro

My guess is that this issue comes from some network or system configuration. Do you have any special configuration? What host operating system are you using? Does it work if you specify a network address, for example 0.0.0.0:9205?

xperimental avatar Sep 27 '22 10:09 xperimental

My guess is that this issue comes from some network or system configuration. Do you have any special configuration? What host operating system are you using? Does it work if you specify a network address, for example 0.0.0.0:9205?

No, I've tried 0.0.0.0:9205 and got the same errors.

mojerro avatar Sep 28 '22 11:09 mojerro

@mojerro What about the other questions? There needs to be something that makes your configuration special, otherwise this would have been noticed earlier.

I'm currently interpreting the error message as "I do not know what tcp is" (because the port is already a number, so does not need a lookup in /etc/services but tcp needs a lookup if it is a known protocol). Do you maybe do something special with /etc or the files in it?

xperimental avatar Oct 03 '22 12:10 xperimental

here is all my configs in compose.yml, and I just need to run docker compose up -d to start it

version: "3.7"

services:
  nextcloud:
    image: nextcloud:24.0-apache
    restart: unless-stopped
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      interval: "$HEALTHCHECK_INTERVAL"
      timeout: "$HEALTHCHECK_TIMEOUT"
      retries: $HEALTHCHECK_RETRIES
      start_period: 10s
      test: [ "CMD-SHELL", "curl localhost:80" ]
    ports:
      - "34488:80"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - "nextcloud-data:/var/www/html"
    environment:
      REDIS_HOST: "redis"
      TZ: Asia/Shanghai

      POSTGRES_DB: ${NEXTCLOUD_POSTGRES_DB}
      POSTGRES_USER: ${NEXTCLOUD_POSTGRES_USER}
      POSTGRES_PASSWORD: ${NEXTCLOUD_POSTGRES_PASSWORD}
      POSTGRES_HOST: "${POSTGRESQL_HOST}:${POSTGRESQL_PORT}"

      NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
      NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
      NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_TRUSTED_DOMAINS}

      SMTP_HOST: ${NEXTCLOUD_SMTP_HOST}
      # SMTP_SECURE: ${}
      SMTP_PORT: ${NEXTCLOUD_SMTP_PORT}
      # SMTP_AUTHTYPE: ${}
      SMTP_NAME: ${NEXTCLOUD_SMTP_NAME}
      SMTP_PASSWORD: ${NEXTCLOUD_SMTP_PASSWORD}

      MAIL_FROM_ADDRESS: ${NEXTCLOUD_MAIL_FROM_ADDRESS}
      MAIL_DOMAIN: ${NEXTCLOUD_MAIL_DOMAIN}

      PHP_MEMORY_LIMIT: $NEXTCLOUD_PHP_MEMORY_LIMIT
      PHP_UPLOAD_LIMIT: $NEXTCLOUD_PHP_UPLOAD_LIMIT

      OBJECTSTORE_S3_HOST: $OBJECTSTORE_S3_HOST
      OBJECTSTORE_S3_BUCKET: $OBJECTSTORE_S3_BUCKET
      OBJECTSTORE_S3_KEY: $OBJECTSTORE_S3_KEY
      OBJECTSTORE_S3_SECRET: $OBJECTSTORE_S3_SECRET
      # OBJECTSTORE_S3_PORT: The port that the object storage server is being served over
      OBJECTSTORE_S3_SSL: $OBJECTSTORE_S3_SSL
      OBJECTSTORE_S3_REGION: $OBJECTSTORE_S3_REGION

  nextcloud-exporter:
    image: xperimental/nextcloud-exporter
    restart: unless-stopped
    ports:
      - 19205:9205
    environment:
      - TZ=Asia/Shanghai
      - NEXTCLOUD_SERVER="http://nextcloud:80"
      - NEXTCLOUD_AUTH_TOKEN=${NEXTCLOUD_EXPORTER_TOKEN:?没有设置 NEXTCLOUD_EXPORTER_TOKEN}
      # - NEXTCLOUD_LISTEN_ADDRESS=":9202"  
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

  redis:
    image: ${REDIS_IMAGE}
    restart: unless-stopped
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - redis-data:/data
    # ports:
    #   - "6379:6379"
    environment:
      - TZ=Asia/Shanghai
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL

  onlyoffice:
    image: onlyoffice/documentserver
    ports:
      - "34489:80"
    environment:
      - REDIS_SERVER_HOST=redis
      - REDIS_SERVER_PORT=6379
      - JWT_ENABLED=true
      - JWT_SECRET=
      - DB_TYPE=postgres
      - DB_HOST=${POSTGRESQL_HOST}
      - DB_PORT=${POSTGRESQL_PORT}
      - DB_NAME=xxx
      - DB_USER=xxx
      - DB_PWD=xxx
      - METRICS_ENABLED="true"
      - METRICS_HOST=agent
      - METRICS_PORT=9125
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - onlyoffice-data:/var/www/onlyoffice/Data
      - onlyoffice-logs:/var/log/onlyoffice
    restart: unless-stopped

  agent:
    image: prom/statsd-exporter:latest
    expose:
      - 9125
      - 9125/udp
    ports:
      - 19102:9102
    restart: unless-stopped

volumes:
  nextcloud-data:
    driver: local
  redis-data:
    driver: local
  onlyoffice-data:
    driver: local
  onlyoffice-logs:
    driver: local

mojerro avatar Oct 04 '22 12:10 mojerro

If you remove the quotes around the value :9202 instead of ":9202", it works for me. There is no interpretation here like what a shell would do, the value is passed verbatim to the exporter. I wonder why I did not get to this result the first time I tested, sorry.

xperimental avatar Nov 13 '22 21:11 xperimental

If you remove the quotes around the value :9202 instead of ":9202", it works for me. There is no interpretation here like what a shell would do, the value is passed verbatim to the exporter. I wonder why I did not get to this result the first time I tested, sorry.

That's all right. It seems to work for me, too. Thank you very much for solving the problem 😄

mojerro avatar Nov 14 '22 05:11 mojerro