Stack_1 ttn-lw-stack-docker.yml:No such file or directory [Installation TTS Docker Windows]

Hi everyone, I’m trying to install TTS on Docker with Windows.
in powershell, run the following command in the file path to install:

docker-compose up

is well installed cockroachdb and redis, but at the time of stack1 the following error appears:
error-no such file or directory

the file path is as follows:

.- for “docker-compose.yml” —> C:\Users\lattepanda\tts\docker-compose.yml

ruta-tts

.- for “ttn-lw-stack-docker.yml” —> C:\Users\lattepanda\tts\config\ttn-lw-stack-docker.yml

ruta-tts(3)

I tried to modify the route in these ways, but it follows the same mistake, someone else has happened?

ruta1

ruta2

Why post pictures of text in stead of (quoted for readability) text?

Looking at the error it seems ttn-lw-stack-docker.yml is in the wrong place. It needs to be in the stack directory as that is mounted to /config in the container.

1 Like

OK if it’s my first post, I’ll take the suggestion.

Thanks for the installation path correction, now I have passed that stage, but I get a database error:

tts_stack_1 exited with code 255
stack_1 | INFO Setting up core component
stack_1 | WARN No cookie hash key configured, generated a random one
stack_1 | WARN No cookie block key configured, generated a random one
stack_1 | INFO Setting up Identity Server
stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1 | — error:pkg/identityserver:db_needs_migration (the database needs to be migrated)
stack_1 | — pq: database “ttn_lorawan” does not exist

Should the database be generated manually or configured in a script?

hi Jac @kersing

interesting - i d always read this (below, from the Getting Started Guide) as a tree, meaning
/config/stack

docker-compose.yml          # defines Docker services for running The Things Stack
config/
└── stack/
    └── ttn-lw-stack-docker.yml    # configuration file for The Things Stack

Isn’t that misleading then?

(i wouldnt notice as i configure in a different way)

What you are quoting is the structure on the Docker host and that is exactly where the config should be. In the container that directory is made available at a different location (/config).

1 Like

Sorry I can’t recall, it is a while ago I last tried and that was on a Linux host, what do the instructions say needs to be done?

right - thanks for clarifying!

Did you do
docker-compose run --rm stack is-db init

from the installation guide

?

1 Like

Hello:
Yes, I have followed these instructions:

instr_tts

but, in the command:

$ docker-compose run --rm stack is-db create-admin-user \
  --id admin \
  --email your@email.com

which I execute as:

docker-compose run --rm stack is-db create-admin-user \
>>   --id admin \
>>   --email wisensor@ast.cl

throws me the following mistake:

Creating tts_stack_run ... done                                                                                                                  INFO Connecting to Identity Server database...
error:cmd/ttn-lw-stack/commands:missing_flag (missing CLI flag `email`)
    flag=email
id : The term 'id' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:2 char:3
+   id admin \
+   ~~
    + CategoryInfo          : ObjectNotFound: (id:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

email : The term 'email' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:3 char:3
+   email wisensor@ast.cl
+   ~~~~~
    + CategoryInfo          : ObjectNotFound: (email:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

It looks like it’s not recognizing the flags after the newline. Try entering everything on one line, as

docker-compose run --rm stack is-db create-admin-user --id admin --email wisensor@ast.cl

thank you! , I was able to complete the configuration and run TTS, I installed it in a localhost environment, my configuration files remained as follows:

ttn-lw-stack-docker.yml:

# 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'

docker-compose.yml

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

start TTS with:

docker-compose up

the output I get is as follows:

Starting tts_cockroach_1 ... done                                                                                                              
Starting tts_redis_1     ... done                                                                                                             
Starting tts_stack_1     ... done                                                                                                              
Attaching to tts_redis_1, tts_cockroach_1, tts_stack_1
cockroach_1  | *
cockroach_1  | * WARNING: RUNNING IN INSECURE MODE!
cockroach_1  | *
cockroach_1  | * - Your cluster is open for any client that can access <all your IP addresses>.
cockroach_1  | * - Any user, even root, can log in without providing a password.
cockroach_1  | * - Any user, connecting as root, can read or write any data in your cluster.
cockroach_1  | * - There is no network encryption nor authentication, and thus no confidentiality.
cockroach_1  | *
cockroach_1  | * Check out how to secure your cluster: https://www.cockroachlabs.com/docs/v20.1/secure-a-cluster.html
cockroach_1  | *
cockroach_1  | *
cockroach_1  | * WARNING: running 'cockroach start' without --join is deprecated.
cockroach_1  | * Consider using 'cockroach start-single-node' or 'cockroach init' instead.
cockroach_1  | *
cockroach_1  | *
cockroach_1  | * WARNING: neither --listen-addr nor --advertise-addr was specified.
cockroach_1  | * The server will advertise "2c63b6df56e0" to other nodes, is this routable?
cockroach_1  | *
cockroach_1  | * Consider using:
cockroach_1  | * - for local-only servers:  --listen-addr=localhost
cockroach_1  | * - for multi-node clusters: --advertise-addr=<host/IP addr>
cockroach_1  | *
cockroach_1  | *
redis_1      | 1:C 10 Nov 2020 12:07:41.619 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1      | 1:C 10 Nov 2020 12:07:41.620 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1      | 1:C 10 Nov 2020 12:07:41.620 # Configuration loaded
redis_1      | 1:M 10 Nov 2020 12:07:41.643 * Running mode=standalone, port=6379.
redis_1      | 1:M 10 Nov 2020 12:07:41.645 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1      | 1:M 10 Nov 2020 12:07:41.645 # Server initialized
redis_1      | 1:M 10 Nov 2020 12:07:41.646 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1      | 1:M 10 Nov 2020 12:07:41.648 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').
redis_1      | 1:M 10 Nov 2020 12:07:41.701 * DB loaded from append only file: 0.037 seconds
redis_1      | 1:M 10 Nov 2020 12:07:41.701 * Ready to accept connections
cockroach_1  | CockroachDB node starting at 2020-11-10 12:07:51.5183637 +0000 UTC (took 9.3s)
cockroach_1  | build:               CCL v20.1.8 @ 2020/10/21 15:46:38 (go1.13.9)
cockroach_1  | webui:               http://2c63b6df56e0:26256
cockroach_1  | sql:                 postgresql://root@2c63b6df56e0:26257?sslmode=disable
cockroach_1  | RPC client flags:    /cockroach/cockroach <client cmd> --host=2c63b6df56e0:26257 --insecure
cockroach_1  | logs:                /cockroach/cockroach-data/logs
cockroach_1  | temp dir:            /cockroach/cockroach-data/cockroach-temp517203340
cockroach_1  | external I/O path:   /cockroach/cockroach-data/extern
cockroach_1  | store[0]:            path=/cockroach/cockroach-data
cockroach_1  | storage engine:      rocksdb
cockroach_1  | status:              restarted pre-existing node
cockroach_1  | clusterID:           5e359357-7621-4a7a-a849-dcda9b85ba06
cockroach_1  | nodeID:              1
stack_1      |   INFO Setting up core component
stack_1      |   WARN No cookie hash key configured, generated a random one
stack_1      |   WARN No cookie block key configured, generated a random one
stack_1      |   INFO Setting up Identity Server
stack_1      |   INFO Setting up Gateway Server
stack_1      |   INFO Setting up Network Server
stack_1      |   INFO Setting up Application Server
stack_1      |   INFO Setting up Join Server
stack_1      |   INFO Setting up Console
stack_1      |   INFO Setting up Gateway Configuration Server
stack_1      |   INFO Setting up Device Template Converter
stack_1      |   INFO Setting up QR Code Generator
stack_1      |   INFO Setting up Packet Broker Agent
stack_1      |   INFO Starting...
stack_1      |   WARN No cluster key configured, generated a random one key=3df2ac1088fa04d66f98c7597834d558d2fe0ea6e0d1a0fb051a3a1a96711e58
stack_1      |   INFO Listening for connections                address=:1884 namespace=grpc protocol=gRPC
stack_1      |   INFO Listening for connections                address=:8884 namespace=grpc protocol=gRPC/tls
stack_1      |   INFO Listening for connections                address=:1885 namespace=web protocol=Web
stack_1      |   INFO Listening for connections                address=:8885 namespace=web protocol=Web/tls
stack_1      |   INFO Listening for connections                address=:8886 namespace=interop protocol=Interop/tls
stack_1      |   INFO Request handled                          duration=1.1354ms method=GET namespace=web remote_addr=127.0.0.1 request_id=01EPS0XZC5M8KF1EECB749Y3H4 response_size=3 status=200 url=http://localhost:1885/healthz/live
stack_1      |   INFO Request handled                          duration=48.8µs method=GET namespace=web remote_addr=127.0.0.1 request_id=01EPS0ZTGPWJ9PSY9M743RAA1W response_size=3 status=200 url=http://localhost:1885/healthz/live
stack_1      |   INFO Request handled                          duration=65.1µs method=GET namespace=web remote_addr=127.0.0.1 request_id=01EPS11NXQ2NFQ8Q6V51NTAY9V response_size=3 status=200 url=http://localhost:1885/healthz/live
stack_1      |   INFO Request handled                          duration=129.3µs method=GET namespace=web remote_addr=127.0.0.1 request_id=01EPS13H4NT89FA7AH0ZBBTH04 response_size=3 status=200 url=http://localhost:1885/healthz/live
stack_1      |   INFO Request handled                          duration=139.8µs method=GET namespace=web remote_addr=127.0.0.1 request_id=01EPS15C6EEX3DSJPBS012DHXY response_size=3 status=200 url=http://localhost:1885/healthz/live

Once TTS started, I registered a user, when logging in redirects me to this screen but does not enter the console:

login tts

redirect login tts

What could be wrong with authentication?

Hmmm. After you get to that “you are now logged in” screen, what happens if you enter localhost/console in the browser? This looks like a missing redirect. @kschiffer do you know?

then in localhost/console I have this mistake:

login error

Yep. That is because the certificates for ‘localhost’ inside your docker container don’t match ‘localhost’ on your machine outside the container. We’ve updated our instructions with some special considerations for your case -> https://thethingsstack.io/getting-started/installation/configuration/#localhost

perfect, I’m following the instructions to Automatic Certificate Management (ACME), but the following command is for linux and does not work in windows, I tried to configure permissions in the file properties, but I can not add to 886

$ mkdir ./acme
$ sudo chown 886:886 ./acme

acme

some idea of how to do it in windows to grant permissions to: 886 (the uid and the gid of the user that runs The Things Stack in the Docker container)

It may work without changing the ownership of the file. Otherwise, here’s some instructions for doing it on windows https://serverfault.com/questions/27332/how-to-take-ownership-of-files-from-the-command-line