Chirpstack network server refuses connection

Hello, I’m trying to add my NS, but everytime I try to add it, I get this error:

context deadline exceeded (code: 2)

In docker console it looks like this:


chirpstack-application-server_1  | time="2022-07-08T06:35:43.941920744Z" level=warning msg="creating insecure network-server client" server="localhost:9191"
chirpstack-application-server_1  | time="2022-07-08T06:35:43.942937327Z" level=warning msg="[core] grpc: addrConn.createTransport failed to connect to {localhost:9191 localhost:9191 <nil> 0 <nil>}. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:9191: connect: connection refused\". Reconnecting..."
chirpstack-application-server_1  | time="2022-07-08T06:35:44.443273866Z" level=error msg="finished unary call with code Unknown" ctx_id=9b4eca8c-ced8-4e36-8a3a-6bc6399d9eb2 error="rpc error: code = Unknown desc = context deadline exceeded" grpc.code=Unknown grpc.method=Create grpc.service=api.NetworkServerService grpc.start_time="2022-07-08T06:35:43Z" grpc.time_ms=505.026 peer.address="127.0.0.1:36264" span.kind=server system=grpc

My NS config:

# See https://www.chirpstack.io/network-server/install/config/ for a full
# configuration example and documentation.
#
# This file is for the EU868 band. See the examples/ folder for more
# configuration examples.

[postgresql]
dsn="postgres://chirpstack_ns:chirpstack_ns@postgresql/chirpstack_ns?sslmode=disable"

[redis]
url="redis://redis:6379"

[network_server]
net_id="000000"

  [network_server.band]
  name="EU433"

  [network_server.network_settings]
  frequency=433000000
  min_dr=0
  max_dr=5

  [[network_server.network_settings.extra_channels]]
  frequency=433175000
  min_dr=0
  max_dr=5

  [network_server.api]
  # ip:port to bind the api server
  bind="0.0.0.0:9191"

  [network_server.gateway.backend.mqtt]
  server="tcp://mosquitto:1883"

  [join_server.default]
server="http://chirpstack-application-server:8003"

My AS config:

# See https://www.chirpstack.io/application-server/install/config/ for a full
# configuration example and documentation.

[postgresql]
dsn="postgres://chirpstack_as:chirpstack_as@postgresql/chirpstack_as?sslmode=disable"

[redis]
url="redis://redis:6379"

[application_server.integration.mqtt]
server="tcp://mosquitto:1883"

[application_server.api]
public_host="chirpstack-application-server:8001"

public_host="myServerIp:9090"

[application_server.external_api]
bind="0.0.0.0:9090"
jwt_secret="verysecret"

This is what I put into add fields:

This happens even If I use default NS config, only thing I have changed is the AS config where I use different port, because I use port 8080 for other website

What am I doing wrong?

Since you are using Docker, one possibility is that 127.0.0.1/localhost (as shown in your configuration) refers to the Docker container itself. If AS runs in a different container, you need to specify the DNS name of the container running the NS.

I think they run in same container. I just ran docker-compose up. And how do I find out what the DNS name is?

This goes beyond Chirpstack, but is related to Docker.

Usually, a Docker container contains only one service.
Docker Compose orchestrates the deployment of Docker containers, so you probably started multiple containers.

You need to look at your docker-compose.yml file to know what name(s) were given to the NS container, for the network that it shares with the AS. Yes, they should be on the same network too.

So Into the field of network server server (in web interface) I should put dns name:port intead of localhost:port?

This is my docker-compose.yml


version: "3"

services:
  chirpstack-network-server:
     
    image: chirpstack/chirpstack-network-server:3
    volumes:
      - ./configuration/chirpstack-network-server:/etc/chirpstack-network-server
    depends_on:
      - postgresql
      - mosquitto

  chirpstack-application-server:
    image: chirpstack/chirpstack-application-server:3
    ports:
      - 9090:9090
    volumes:
      - ./configuration/chirpstack-application-server:/etc/chirpstack-application-server
    depends_on:
      - chirpstack-network-server

  chirpstack-gateway-bridge:
    image: chirpstack/chirpstack-gateway-bridge:3
    ports:
      - 1700:1700/udp
    volumes:
      - ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
    depends_on: 
      - mosquitto

  postgresql:
    image: postgres:9.6-alpine

 environment:
      - POSTGRES_PASSWORD=root
    volumes:
      - ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
      - postgresqldata:/var/lib/postgresql/data

  redis:
    image: redis:5-alpine
    volumes:
      - redisdata:/data

  mosquitto:
    image: eclipse-mosquitto:2
    ports:
      - 1883:1883
    volumes: 
      - ./configuration/eclipse-mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf

volumes:
  postgresqldata:
  redisdata:

Since your docker-compose.yml file looks like the example, have you tried doing what the Readme said:

When adding the Network Server in the ChirpStack Application Server web-interface (see Network Servers), you must enter chirpstack-network-server:8000 as the Network Server hostname:IP.

If you changed the port number, then you should enter the new port number instead of 8000.

Thanks so much! It works now.