DEV Community

Reishi Mitani
Reishi Mitani

Posted on

Installing lorawan-stack in local machine

========================================

Prerequisites

  1. Make sure you have go version 14 or above. I had some issues with go version 13 when initializing the database.

  2. Make sure you have the GOPATH and other paths configured.

My environment:
MacOS Catalina
go version 15

========================================

Clone the development repository into your local machine, and initialize the repository.

$ git clone https://github.com/TheThingsNetwork/lorawan-stack $GOPATH/src/github.com/lorawan-stack

$ cd $GOPATH/src/github.com/lorawan-stack
$ make init
Enter fullscreen mode Exit fullscreen mode

Run the following command to set up the frontend. This may take about 10~20 mins.

$ tools/bin/mage js:build
Enter fullscreen mode Exit fullscreen mode

Run the following command to get the database started.

$ tools/bin/mage dev:dbStart
Creating network "lorawan-stack-dev_default" with the default driver
Creating lorawan-stack-dev_cockroach_1 ... done
Creating lorawan-stack-dev_redis_1     ... done
            Name                           Command               State                                Ports
-----------------------------------------------------------------------------------------------------------------------------------------
lorawan-stack-dev_cockroach_1   /cockroach/cockroach.sh st ...   Up      127.0.0.1:26256->26256/tcp, 127.0.0.1:26257->26257/tcp, 8080/tcp
lorawan-stack-dev_redis_1       docker-entrypoint.sh redis ...   Up      127.0.0.1:6379->6379/tcp
Enter fullscreen mode Exit fullscreen mode

Initialize the stack. This will take a few minutes as well.

$ tools/bin/mage dev:initStack
go: downloading github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
go: downloading go.thethings.network/lorawan-stack-legacy/v2 v2.0.2
go: downloading github.com/oklog/ulid v1.3.1
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9

etc....

  INFO Connecting to Identity Server database...
  INFO Detected database CockroachDB CCL v20.1.5 (x86_64-unknown-linux-gnu, built 2020/08/24 19:52:08, go1.13.9)
  INFO Initializing database...
  INFO Creating tables...
  INFO Successfully initialized
  INFO Connecting to Identity Server database...
  INFO Creating user...
  INFO Created user
  INFO Connecting to Identity Server database...
  INFO Creating OAuth client...
  INFO Created OAuth client                     secret=
  INFO Setting owner rights...
  INFO Set owner rights
  INFO Connecting to Identity Server database...
  INFO Creating OAuth client...
  INFO Created OAuth client                     secret=console
  INFO Setting owner rights...
  INFO Set owner rights
Enter fullscreen mode Exit fullscreen mode

Finally, run the code.

go run ./cmd/ttn-lw-stack -c ./config/stack/ttn-lw-stack.yml start
Enter fullscreen mode Exit fullscreen mode

Open localhost:1885 in your browser. Both the username and the password will be admin.

Alt Text

Once you login, you should see this page.

Alt Text

Top comments (0)