TTN Windows 10 Docker issues

Hello,
First of all I wish you an happy new year and all the best for 2022.
I am creating this topic because I would like to create on my Windows 10 machine with docker in localhost, a things stack but I am stuck…
I have install redis, cockroachdb and thethingsnetwork/lorawan images and start.

My docker-compose file is:

> version: '3.7'
> services:
> 
>   # If using CockroachDB:
>   cockroach:
>     # In production, replace 'latest' with tag from https://hub.docker.com/r/cockroachdb/cockroach/tags
>     image: cockroachdb/cockroach:latest
>     command: start --http-port 26256 --insecure
>     restart: unless-stopped
>     volumes:
>       - ${DEV_DATA_DIR:-.env/data}/cockroach:/cockroach/cockroach-data
>     ports:
>       - "127.0.0.1:26257:26257" # Cockroach
>       - "127.0.0.1:26256:26256" # WebUI
> 
>   # If using PostgreSQL:
>   # postgres:
>   #   image: postgres
>   #   restart: unless-stopped
>   #   environment:
>   #     - POSTGRES_PASSWORD=root
>   #     - POSTGRES_USER=root
>   #     - POSTGRES_DB=ttn_lorawan
>   #   volumes:
>   #     - ${DEV_DATA_DIR:-.env/data}/postgres:/var/lib/postgresql/data
>   #   ports:
>   #     - "127.0.0.1:5432:5432"
> 
>   redis:
>     # In production, replace 'latest' with tag from https://hub.docker.com/_/redis?tab=tags
>     image: redis:latest
>     command: redis-server --appendonly yes
>     restart: unless-stopped
>     volumes:
>       - ${DEV_DATA_DIR:-.env/data}/redis:/data
>     ports:
>       - "127.0.0.1:6379:6379"
> 
>   stack:
>     # In production, replace 'latest' with tag from https://hub.docker.com/r/thethingsnetwork/lorawan-stack/tags
>     image: thethingsnetwork/lorawan-stack:latest
>     entrypoint: ttn-lw-stack -c config/ttn-lw-stack-docker.yml
>     command: start
>     restart: unless-stopped
>     depends_on:
>       - redis
>       # If using CockroachDB:
>       - cockroach
>       # If using PostgreSQL:
>       # - postgres
>     volumes:
>       - ./blob:/srv/ttn-lorawan/public/blob
>       - ./config/stack:/config:ro
>       # If using Let's Encrypt:
>       # - ./acme:/var/lib/acme
>     environment:
>       TTN_LW_BLOB_LOCAL_DIRECTORY: /srv/ttn-lorawan/public/blob
>       TTN_LW_REDIS_ADDRESS: redis:6379
>       # If using CockroachDB:
>       TTN_LW_IS_DATABASE_URI: postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable
>       # # If using PostgreSQL:
>       # TTN_LW_IS_DATABASE_URI: postgres://root:root@postgres:5432/ttn_lorawan?sslmode=disable
> 
>     ports:
>       # If deploying on a public server:
>       - "80:1885"
>       - "443:8885"
>       - "1881:1881"
>       - "8881:8881"
>       - "1882:1882"
>       - "8882:8882"
>       - "1883:1883"
>       - "8883:8883"
>       - "1884:1884"
>       - "8884:8884"
>       - "1885:1885"
>       - "8885:8885"
>       - "1887:1887"
>       - "8887:8887"
>       - "1700:1700/udp"
> 
>     # If using custom certificates:
>     # secrets:
>     #   - ca.pem
>     #   - cert.pem
>     #   - key.pem
> 
> # If using custom certificates:
> # secrets:
> #   ca.pem:
> #     file: ./ca.pem
> #   cert.pem:
> #     file: ./cert.pem
> #   key.pem:
> #     file: ./key.pem
> 
> And my ttn-lw-stack-docker.yml which is in the config/stack folder is configured like that: 
> # Identity Server configuration
> # Email configuration for "thethings.example.com"
> is:
>   email:
>     sender-name: 'TTS Wisensor SN001'
>     sender-address: 'wisensor@ast.cl'
>     network:
>       name: 'Wisensor SN001'
>       console-url: 'http://localhost/console'
>       identity-server-url: 'http://localhost/oauth'
> 
>     # If sending email with Sendgrid
>     # provider: sendgrid
>     # sendgrid:
>     #   api-key: '...'              # enter Sendgrid API key
> 
> 
>     # If sending email with SMTP
>      #provider: smtp
>      #smtp:
>        #address:  'smtp.gmail.com'             # enter SMTP server address
>        #username: 'wisensor@ast.cl'             # enter SMTP server username
>        #password: 'xxxx'             # enter SMTP server password
> 
>   # Web UI configuration for "thethings.example.com":
>   oauth:
>     ui:
>       canonical-url: 'http://localhost/oauth'
>       is:
>         base-url: 'http://localhost/api/v3'
> 
> # HTTP server configuration
> http:
>   cookie:
>     block-key: ''                # generate 32 bytes (openssl rand -hex 32)
>     hash-key: ''                 # generate 64 bytes (openssl rand -hex 64)
>   metrics:
>     password: 'metrics'               # choose a password
>   pprof:
>     password: 'pprof'                 # choose a password
> 
> # If using custom certificates:
> #tls:
> #  source: file
> #  root-ca: /run/secrets/ca.pem
> #  certificate: /run/secrets/cert.pem
> #  key: /run/secrets/key.pem
> 
> # Let's encrypt for "thethings.example.com"
> tls:
>   source: 'acme'
>   acme:
>     dir: '/var/lib/acme'
>     email: 'you@thethings.example.com'
>     hosts: ['thethings.example.com']
>     default-host: 'thethings.example.com'
> 
> # If Gateway Server enabled, defaults for "thethings.example.com":
> gs:
>   mqtt:
>     public-address: 'localhost:1882'
>     public-tls-address: 'localhost:8882'
>   mqtt-v2:
>     public-address: 'localhost:1881'
>     public-tls-address: 'localhost:8881'
> 
> # If Gateway Configuration Server enabled, defaults for "thethings.example.com":
> gcs:
>   basic-station:
>     default:
>       lns-uri: 'wss://localhost:8887'
>   the-things-gateway:
>     default:
>       mqtt-server: 'mqtts://localhost:8881'
> 
> # Web UI configuration for "thethings.example.com":
> console:
>   ui:
>     canonical-url: 'http://localhost/console'
>     is:
>       base-url: 'http://localhost/api/v3'
>     gs:
>       base-url: 'http://localhost/api/v3'
>     ns:
>       base-url: 'http://localhost/api/v3'
>     as:
>       base-url: 'http://localhost/api/v3'
>     js:
>       base-url: 'http://localhost/api/v3'
>     qrg:
>       base-url: 'http://localhost/api/v3'
>     edtc:
>       base-url: 'http://localhost/api/v3'
> 
>   oauth:
>     authorize-url: 'http://localhost/oauth/authorize'
>     token-url: 'http://localhost/oauth/token'
>     logout-url: 'http://localhost/oauth/logout'
>     client-id: 'console'
>     client-secret: 'console'          # choose or generate a secret
> 
> # If Application Server enabled, defaults for "thethings.example.com":
> as:
>   mqtt:
>     public-address: 'http://localhost:1883'
>     public-tls-address: 'http://localhost:8883'
>   webhooks:
>     downlink:
>       public-address: 'http://localhost:1885/api/v3'
> 
> # If Device Claiming Server enabled, defaults for "thethings.example.com":
> dcs:
>   oauth:
>     authorize-url: 'http://localhost/oauth/authorize'
>     token-url: 'http://localhost/oauth/token'
>     logout-url: 'http://localhost/oauth/logout'
>     client-id: 'device-claiming'
>     client-secret: 'device-claiming'          # choose or generate a secret
>   ui:
>     canonical-url: 'http://localhost/claim'
>     as:
>       base-url: 'http://localhost/api/v3'
>     dcs:
>       base-url: 'http://localhost/api/v3'
>     is:
>       base-url: 'http://localhost/api/v3'
>     ns:
>       base-url: 'http://localhost/api/v3'
> 
> -------------------
> 
> I start the following command which is ok: 
> docker-compose pull
> 
> But when I push the following command:docker-compose run --rm stack is-db init, I get an error saying: 
> 
> Creating bin_stack_run ... done
> INFO    Connecting to Identity Server database...
> dial tcp 172.26.0.3:26257: connect: connection refused
>     correlation_id=facdc6753cfa4dd28f9552d8e673c246
> ERROR: 255
> 
> I understand that the connection between cockroach and the stack is not working but I don't know how to solve it.
> Can you please help me to solve it ? 
> 
> Best regards, 
> 
> Guillaume
> 
> > [/quote]

And my ttn-lw-stack-docker.yml which is in the config/stack folder is configured like that:

# Identity Server configuration
# Email configuration for "thethings.example.com"
is:
  email:
    sender-name: 'TTS Wisensor SN001'
    sender-address: 'wisensor@ast.cl'
    network:
      name: 'Wisensor SN001'
      console-url: 'http://localhost/console'
      identity-server-url: 'http://localhost/oauth'

    # If sending email with Sendgrid
    # provider: sendgrid
    # sendgrid:
    #   api-key: '...'              # enter Sendgrid API key


    # If sending email with SMTP
     #provider: smtp
     #smtp:
       #address:  'smtp.gmail.com'             # enter SMTP server address
       #username: 'wisensor@ast.cl'             # enter SMTP server username
       #password: 'xxxx'             # enter SMTP server password

  # Web UI configuration for "thethings.example.com":
  oauth:
    ui:
      canonical-url: 'http://localhost/oauth'
      is:
        base-url: 'http://localhost/api/v3'

# HTTP server configuration
http:
  cookie:
    block-key: ''                # generate 32 bytes (openssl rand -hex 32)
    hash-key: ''                 # generate 64 bytes (openssl rand -hex 64)
  metrics:
    password: 'metrics'               # choose a password
  pprof:
    password: 'pprof'                 # choose a password

# If using custom certificates:
#tls:
#  source: file
#  root-ca: /run/secrets/ca.pem
#  certificate: /run/secrets/cert.pem
#  key: /run/secrets/key.pem

# Let's encrypt for "thethings.example.com"
tls:
  source: 'acme'
  acme:
    dir: '/var/lib/acme'
    email: 'you@thethings.example.com'
    hosts: ['thethings.example.com']
    default-host: 'thethings.example.com'

# If Gateway Server enabled, defaults for "thethings.example.com":
gs:
  mqtt:
    public-address: 'localhost:1882'
    public-tls-address: 'localhost:8882'
  mqtt-v2:
    public-address: 'localhost:1881'
    public-tls-address: 'localhost:8881'

# If Gateway Configuration Server enabled, defaults for "thethings.example.com":
gcs:
  basic-station:
    default:
      lns-uri: 'wss://localhost:8887'
  the-things-gateway:
    default:
      mqtt-server: 'mqtts://localhost:8881'

# Web UI configuration for "thethings.example.com":
console:
  ui:
    canonical-url: 'http://localhost/console'
    is:
      base-url: 'http://localhost/api/v3'
    gs:
      base-url: 'http://localhost/api/v3'
    ns:
      base-url: 'http://localhost/api/v3'
    as:
      base-url: 'http://localhost/api/v3'
    js:
      base-url: 'http://localhost/api/v3'
    qrg:
      base-url: 'http://localhost/api/v3'
    edtc:
      base-url: 'http://localhost/api/v3'

  oauth:
    authorize-url: 'http://localhost/oauth/authorize'
    token-url: 'http://localhost/oauth/token'
    logout-url: 'http://localhost/oauth/logout'
    client-id: 'console'
    client-secret: 'console'          # choose or generate a secret

# If Application Server enabled, defaults for "thethings.example.com":
as:
  mqtt:
    public-address: 'http://localhost:1883'
    public-tls-address: 'http://localhost:8883'
  webhooks:
    downlink:
      public-address: 'http://localhost:1885/api/v3'

# If Device Claiming Server enabled, defaults for "thethings.example.com":
dcs:
  oauth:
    authorize-url: 'http://localhost/oauth/authorize'
    token-url: 'http://localhost/oauth/token'
    logout-url: 'http://localhost/oauth/logout'
    client-id: 'device-claiming'
    client-secret: 'device-claiming'          # choose or generate a secret
  ui:
    canonical-url: 'http://localhost/claim'
    as:
      base-url: 'http://localhost/api/v3'
    dcs:
      base-url: 'http://localhost/api/v3'
    is:
      base-url: 'http://localhost/api/v3'
    ns:
      base-url: 'http://localhost/api/v3'

I start the following command which is ok:
docker-compose pull

But when I push the following command:docker-compose run --rm stack is-db init, I get an error saying:

Creating bin_stack_run … done
INFO Connecting to Identity Server database…
dial tcp 172.26.0.3:26257: connect: connection refused
correlation_id=facdc6753cfa4dd28f9552d8e673c246
ERROR: 255

I understand that the connection between the cockroach and the stack is not working but I don’t know how to solve it, I setup an IP address into my virtual ethernet card to be in the same network 192.168.100.178
Can you please help me to solve it ?

Best regards,

Guillaume

Hello,

Anybody who got the same issues? Can you please help?